Skip to contentSkip to conversation

python/python3: use cc_basename to replace CC for checking compiler

PATCH New Li Zhou 1 participant 1 message Jan 16, 2018

lore
Share & tools
lore

Li Zhou

author
#0 lore raw

PATCH 1/1 python/python3: use cc_basename to replace CC for checking compiler

When working path contains "clang"/"gcc"/"icc", it might be part of $CC because of the "--sysroot" parameter. That could cause judgement error about clang/gcc/icc compilers. e.g.
When "icc" is containded in working path, below errors are reported when compiling python/python3:
x86_64-wrs-linux-gcc: error: strict: No such file or directory
x86_64-wrs-linux-gcc: error: unrecognized command line option '-fp-model'

Here use cc_basename to replace CC for checking compiler to avoid such kind of issue.

---
 ...cc_basename-to-replace-CC-for-checking-co.patch | 118 ++++++++++++++++++
 ...-cc_basename-to-replace-CC-for-checking-c.patch | 136 +++++++++++++++++++++
 meta/recipes-devtools/python/python3_3.5.3.bb      |   1 +
 meta/recipes-devtools/python/python_2.7.13.bb      |   1 +
 4 files changed, 256 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python/0001-python-use-cc_basename-to-replace-CC-for-checking-co.patch
 create mode 100644 meta/recipes-devtools/python/python3/0001-python3-use-cc_basename-to-replace-CC-for-checking-c.patch
meta/recipes-devtools/python/python/0001-python-use-cc_basename-to-replace-CC-for-checking-co.patch new file +118 -0
new file mode 100644
index 0000000..fae324f
@@ -0,0 +1,118 @@
+From b60dea18372dabbef0ec9abf06855e209af4f53d Mon Sep 17 00:00:00 2001
+From: Li Zhou <[email protected]>
+Date: Tue, 16 Jan 2018 10:31:49 +0800
+Subject: [PATCH] python: use cc_basename to replace CC for checking compiler
+
+When working path contains "clang"/"gcc"/"icc", it might be part of $CC
+because of the "--sysroot" parameter. That could cause judgement error
+about clang/gcc/icc compilers. e.g.
+When "icc" is containded in working path, below errors are reported when
+compiling python:
+x86_64-wrs-linux-gcc: error: strict: No such file or directory
+x86_64-wrs-linux-gcc: error: unrecognized command line option '-fp-model'
+
+Here use cc_basename to replace CC for checking compiler to avoid such
+kind of issue.
+
+Upstream-Status: Pending
+
+Signed-off-by: Li Zhou <[email protected]>
+---
+ configure.ac | 19 ++++++++++---------
+ 1 file changed, 10 insertions(+), 9 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index dcf733f..f1e9a7b 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -15,6 +15,7 @@ AC_CONFIG_HEADER(pyconfig.h)
+ AC_CANONICAL_HOST
+ AC_SUBST(build)
+ AC_SUBST(host)
++LT_INIT
+ 
+ # pybuilddir.txt will be created by --generate-posix-vars in the Makefile
+ rm -f pybuilddir.txt
+@@ -670,7 +671,7 @@ AC_MSG_RESULT($with_cxx_main)
+ preset_cxx="$CXX"
+ if test -z "$CXX"
+ then
+-        case "$CC" in
++        case "$cc_basename" in
+         gcc)    AC_PATH_TOOL(CXX, [g++], [g++], [notfound]) ;;
+         cc)     AC_PATH_TOOL(CXX, [c++], [c++], [notfound]) ;;
+         esac
+@@ -743,14 +744,14 @@ rmdir CaseSensitiveTestDir
+ 
+ case $MACHDEP in
+ bsdos*)
+-    case $CC in
++    case $cc_basename in
+     gcc) CC="$CC -D_HAVE_BSDI";;
+     esac;;
+ esac
+ 
+ case $ac_sys_system in
+ hp*|HP*)
+-    case $CC in
++    case $cc_basename in
+     cc|*/cc) CC="$CC -Ae";;
+     esac;;
+ SunOS*)
+@@ -1073,7 +1074,7 @@ then
+         fi
+ 
+         # Clang also needs -fwrapv
+-        case $CC in
++        case $cc_basename in
+             *clang*) WRAP="-fwrapv"
+             ;;
+         esac
+@@ -1277,7 +1278,7 @@ yes)
+ esac
+ 
+ # ICC needs -fp-model strict or floats behave badly
+-case "$CC" in
++case "$cc_basename" in
+ *icc*)
+     BASECFLAGS="$BASECFLAGS -fp-model strict"
+     ;;
+@@ -1417,7 +1418,7 @@ else
+ fi],
+ [AC_MSG_RESULT(no)])
+ if test "$Py_LTO" = 'true' ; then
+-  case $CC in
++  case $cc_basename in
+     *clang*)
+       # Any changes made here should be reflected in the GCC+Darwin case below
+       LTOFLAGS="-flto"
+@@ -1482,7 +1483,7 @@ then
+   fi
+ fi
+ LLVM_PROF_ERR=no
+-case $CC in
++case $cc_basename in
+   *clang*)
+     # Any changes made here should be reflected in the GCC+Darwin case below
+     PGO_PROF_GEN_FLAG="-fprofile-instr-generate"
+@@ -2300,7 +2301,7 @@ then
+ 		then CCSHARED="-fPIC"
+ 		else CCSHARED="-Kpic -belf"
+ 		fi;;
+-	IRIX*/6*)  case $CC in
++	IRIX*/6*)  case $cc_basename in
+ 		   *gcc*) CCSHARED="-shared";;
+ 		   *) CCSHARED="";;
+ 		   esac;;
+@@ -2344,7 +2345,7 @@ then
+ 		then
+ 			LINKFORSHARED="-Wl,--export-dynamic"
+ 		fi;;
+-	SunOS/5*) case $CC in
++	SunOS/5*) case $cc_basename in
+ 		  *gcc*)
+ 		    if $CC -Xlinker --help 2>&1 | grep export-dynamic >/dev/null
+ 		    then
+-- 
+1.9.1
+
meta/recipes-devtools/python/python3/0001-python3-use-cc_basename-to-replace-CC-for-checking-c.patch new file +136 -0

136 lines not on this page · raw message

meta/recipes-devtools/python/python3_3.5.3.bb +1 -0
index 13df12f..593dc5b 100644
@@ -40,6 +40,7 @@ SRC_URI += "\
             file://0001-Issue-21272-Use-_sysconfigdata.py-to-initialize-dist.patch \
             file://Fix-29519-weakref-spewing-exceptions-during-interp-f.patch \
             file://pass-missing-libraries-to-Extension-for-mul.patch \
+            file://0001-python3-use-cc_basename-to-replace-CC-for-checking-c.patch \
            "
 SRC_URI[md5sum] = "57d1f8bfbabf4f2500273fb0706e6f21"
 SRC_URI[sha256sum] = "eefe2ad6575855423ab630f5b51a8ef6e5556f774584c06beab4926f930ddbb0"
meta/recipes-devtools/python/python_2.7.13.bb +1 -0
index 8770699..ea5f8c3 100644
@@ -29,6 +29,7 @@ SRC_URI += "\
   file://Don-t-use-getentropy-on-Linux.patch \
   file://pass-missing-libraries-to-Extension-for-mul.patch \
   file://support_SOURCE_DATE_EPOCH_in_py_compile_2.7.patch \
+  file://0001-python-use-cc_basename-to-replace-CC-for-checking-co.patch \
 "
 
 S = "${WORKDIR}/Python-${PV}"
Signature · 1 line
1.9.1