blob: 3e2b1d1c2eba737e8491324e8f69845fc8ecad74 [file] [log] [blame]
Patrick Williamsc124f4f2015-09-15 14:41:29 -05001Upstream-Status: Pending
2
3The CC variable,sometimes like:"x86_64-poky-linux-gcc -m64 --sysroot=/${TMPDIR}/sysroots/qemux86-64", contains option information.
4This will lead to wrong compiler name "qemux86-64" rather than "x86_64-poky-linux-gcc" when python finding the compiler name.
5
6Secondly add -L=<path> this way linker will be able to resolve /usr/lib w.r.t sysroot and not
7use hardcoded /usr/lib to look for libs which is wrong in cross compile environment and this will work
8ok on native systems too since sysroot for native compilers is /
9
10Signed-off-by: Mei Lei <lei.mei@intel.com>
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12Index: Python-3.3.2/Lib/distutils/unixccompiler.py
13===================================================================
14--- Python-3.3.2.orig/Lib/distutils/unixccompiler.py 2013-05-15 09:32:54.000000000 -0700
15+++ Python-3.3.2/Lib/distutils/unixccompiler.py 2013-08-01 00:58:18.629056286 -0700
16@@ -202,7 +202,9 @@
17 # ccompiler.py.
18
19 def library_dir_option(self, dir):
20- return "-L" + dir
Patrick Williamsc0f7c042017-02-23 20:41:17 -060021+ if dir.startswith("/"):
22+ return "-L=" + dir
23+ return "-L" + dir
Patrick Williamsc124f4f2015-09-15 14:41:29 -050024
25 def _is_gcc(self, compiler_name):
26 return "gcc" in compiler_name or "g++" in compiler_name
27@@ -221,7 +221,7 @@
28 # this time, there's no way to determine this information from
29 # the configuration data stored in the Python installation, so
30 # we use this hack.
31- compiler = os.path.basename(sysconfig.get_config_var("CC"))
32+ compiler = sysconfig.get_config_var("CC")
33 if sys.platform[:6] == "darwin":
34 # MacOSX's linker doesn't understand the -R flag at all
35 return "-L" + dir