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 + +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: diff --git a/meta/recipes-devtools/python/python_2.6.6.bb b/meta/recipes-devtools/python/python_2.6.6.bb index 77c0ff47b3..b3f79a377d 100644 --- a/meta/recipes-devtools/python/python_2.6.6.bb +++ b/meta/recipes-devtools/python/python_2.6.6.bb @@ -22,6 +22,7 @@ SRC_URI = "\ file://security_issue_2254_fix.patch \ file://cgi_py.patch \ file://remove_sqlite_rpath.patch \ + file://setup_py_skip_cross_import_check.patch \ " SRC_URI[md5sum] = "cf4e6881bb84a7ce6089e4a307f71f14" @@ -62,6 +63,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} \ @@ -83,6 +86,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 \