From 23d2eaf9d283cae47e52d1151f0d4ad53bbbe8a0 Mon Sep 17 00:00:00 2001 From: Tom Zanussi Date: Fri, 4 Nov 2011 20:25:03 -0500 Subject: 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. (From OE-Core rev: 25fae81538a92e15eab3fc169ebce44505f67839) Signed-off-by: Tom Zanussi Signed-off-by: Richard Purdie --- meta/recipes-devtools/python/python_2.7.2.bb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'meta/recipes-devtools/python/python_2.7.2.bb') diff --git a/meta/recipes-devtools/python/python_2.7.2.bb b/meta/recipes-devtools/python/python_2.7.2.bb index bb088a4620..360e64e9a6 100644 --- a/meta/recipes-devtools/python/python_2.7.2.bb +++ b/meta/recipes-devtools/python/python_2.7.2.bb @@ -18,6 +18,7 @@ SRC_URI += "\ file://multilib.patch \ file://cgi_py.patch \ file://remove_sqlite_rpath.patch \ + file://setup_py_skip_cross_import_check.patch \ " S = "${WORKDIR}/Python-${PV}" @@ -57,6 +58,8 @@ do_compile() { # then call do_install twice we get Makefile.orig == Makefile.sysroot install -m 0644 Makefile Makefile.sysroot + export CROSS_COMPILE="${TARGET_PREFIX}" + oe_runmake HOSTPGEN=${STAGING_BINDIR_NATIVE}/pgen \ HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python \ STAGING_LIBDIR=${STAGING_LIBDIR} \ @@ -78,6 +81,8 @@ do_install() { # make install needs the original Makefile, or otherwise the inclues would # go to ${D}${STAGING...}/... install -m 0644 Makefile.orig Makefile + + export CROSS_COMPILE="${TARGET_PREFIX}" oe_runmake HOSTPGEN=${STAGING_BINDIR_NATIVE}/pgen \ HOSTPYTHON=${STAGING_BINDIR_NATIVE}/python \ -- cgit v1.2.3-54-g00ecf