aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/python/python
diff options
context:
space:
mode:
authorTom Zanussi <tom.zanussi@intel.com>2011-11-04 20:25:03 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-11-08 21:44:23 +0000
commit25fae81538a92e15eab3fc169ebce44505f67839 (patch)
treeb2850b3d5693e4aa1aee87b3a7eed61f8c07e78d /meta/recipes-devtools/python/python
parent5be9785f344ec4d7580f7ec68e29dba9fceb0a0a (diff)
downloadopenembedded-core-contrib-25fae81538a92e15eab3fc169ebce44505f67839.tar.gz
python: skip setup.py 'import check' when cross-compiling
build_extension() in setup.py, as part of the build process, does an 'import check' on the built extension. The import check in turn dlopen()'s the shared library associated with the extension, which isn't something that makes sense if that library was cross-compiled for a different architecture. This was noticed with an x86_64 target that was compiled with avx support, because it caused 'illegal instruction' exceptions: | /bin/sh: line 1: 14575 Illegal instruction ... -E ./setup.py -q build For other target architectures, it doesn't necessarily cause illegal instruction exceptions, but still fails. For example, on arm, the failure pathway causes this warning: *** WARNING: renaming "cmath" since importing it failed: .../cmath.so: wrong ELF class: ELFCLASS32 This patch to setup.py and the associated recipe changes allow the whole 'import check' logic to be skipped when cross-compiling. Signed-off-by: Tom Zanussi <tom.zanussi@intel.com>
Diffstat (limited to 'meta/recipes-devtools/python/python')
-rw-r--r--meta/recipes-devtools/python/python/setup_py_skip_cross_import_check.patch27
1 files changed, 27 insertions, 0 deletions
diff --git a/meta/recipes-devtools/python/python/setup_py_skip_cross_import_check.patch b/meta/recipes-devtools/python/python/setup_py_skip_cross_import_check.patch
new file mode 100644
index 0000000000..6ccdb948b9
--- /dev/null
+++ b/meta/recipes-devtools/python/python/setup_py_skip_cross_import_check.patch
@@ -0,0 +1,27 @@
+This patch skips over the 'import check' setup.py does when building
+extensions. This generally won't work when cross-compiling.
+
+Upstream-Status: Inappropriate [embedded-specific]
+
+Signed-off-by: Tom Zanussi <tom.zanussi@intel.com>
+
+Index: Python-2.7.2/setup.py
+===================================================================
+--- Python-2.7.2.orig/setup.py 2011-11-04 16:46:34.553796410 -0500
++++ Python-2.7.2/setup.py 2011-11-04 16:59:49.692802313 -0500
+@@ -287,6 +287,15 @@
+ (ext.name, sys.exc_info()[1]))
+ self.failed.append(ext.name)
+ return
++
++ # If we're cross-compiling, we want to skip the import check
++ # i.e. we shouldn't be dynamically loading target shared libs
++ if os.environ.get('CROSS_COMPILE') is not None:
++ self.announce(
++ 'WARNING: skipping import check for cross-compiled "%s"' %
++ ext.name)
++ return
++
+ # Workaround for Mac OS X: The Carbon-based modules cannot be
+ # reliably imported into a command-line Python
+ if 'Carbon' in ext.extra_link_args: