From: Tom Zanussi <tom.zanussi@intel.com>
To: "Cui, Dexuan" <dexuan.cui@intel.com>
Cc: Patches and discussions about the oe-core layer
<openembedded-core@lists.openembedded.org>
Subject: Re: [CONSOLIDATED PULL 17/17] python: skip setup.py 'import check' when cross-compiling
Date: Wed, 09 Nov 2011 07:42:25 -0600 [thread overview]
Message-ID: <1320846145.16608.0.camel@elmorro> (raw)
In-Reply-To: <1865303E0DED764181A9D882DEF65FB6DF1AE8C698@shsmsx502.ccr.corp.intel.com>
On Wed, 2011-11-09 at 02:34 -0800, Cui, Dexuan wrote:
> How I wish I could notice the patch this morning so I could save 1 day!
>
??? Can you please explain what you mean?
> Anyway, thanks TomZ for the patch! :-)
>
You're welcome, I guess!
Tom
> Thanks,
> -- Dexuan
>
>
> > -----Original Message-----
> > From: openembedded-core-bounces@lists.openembedded.org
> > [mailto:openembedded-core-bounces@lists.openembedded.org] On Behalf
> > Of Saul Wold
> > Sent: Wednesday, November 09, 2011 3:23 AM
> > To: openembedded-core@lists.openembedded.org
> > Subject: [OE-core] [CONSOLIDATED PULL 17/17] python: skip setup.py
> > 'import check' when cross-compiling
> >
> > From: Tom Zanussi <tom.zanussi@intel.com>
> >
> > 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>
> > ---
> > .../python/setup_py_skip_cross_import_check.patch | 27
> > ++++++++++++++++++++
> > meta/recipes-devtools/python/python_2.7.2.bb | 5 +++
> > 2 files changed, 32 insertions(+), 0 deletions(-)
> > create mode 100644
> > meta/recipes-devtools/python/python/setup_py_skip_cross_import_check.
> > patch
> >
> > diff --git
> > a/meta/recipes-devtools/python/python/setup_py_skip_cross_import_chec
> > k.patch
> > b/meta/recipes-devtools/python/python/setup_py_skip_cross_import_chec
> > k.patch
> > new file mode 100644
> > index 0000000..6ccdb94
> > --- /dev/null
> > +++
> > b/meta/recipes-devtools/python/python/setup_py_skip_cross_import_chec
> > k.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:
> > diff --git a/meta/recipes-devtools/python/python_2.7.2.bb
> > b/meta/recipes-devtools/python/python_2.7.2.bb
> > index bb088a4..360e64e 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 \
> > --
> > 1.7.6.4
> >
> >
> > _______________________________________________
> > Openembedded-core mailing list
> > Openembedded-core@lists.openembedded.org
> > http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core
next prev parent reply other threads:[~2011-11-09 13:47 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-08 19:22 [CONSOLIDATED PULL 00/17] Updates and Fixes Saul Wold
2011-11-08 19:22 ` [CONSOLIDATED PULL 01/17] pseudo: Uprev pseudo to version 1.2 Saul Wold
2011-11-08 21:59 ` Paul Menzel
2011-11-08 19:22 ` [CONSOLIDATED PULL 02/17] libcap: fix sstate for native package Saul Wold
2011-11-08 19:22 ` [CONSOLIDATED PULL 03/17] files/device_table-minimal.txt: add /dev/kmsg Saul Wold
2011-11-08 19:22 ` [CONSOLIDATED PULL 04/17] dhcp: drop unused dhcp3.inc file Saul Wold
2011-11-08 19:22 ` [CONSOLIDATED PULL 05/17] dhcp: rename dhcp4.inc to dhcp.inc Saul Wold
2011-11-08 19:22 ` [CONSOLIDATED PULL 06/17] dhcp: move server configuration to dhcp-server-config Saul Wold
2011-11-08 19:22 ` [CONSOLIDATED PULL 07/17] libarchive: update to 2.8.5 Saul Wold
2011-11-08 22:08 ` Paul Menzel
2011-11-08 23:23 ` [PATCH] libarchive: Remove obsolete comment and empty line at the end Paul Menzel
2011-11-08 19:22 ` [CONSOLIDATED PULL 08/17] distro_tracking_fields.inc: update to libarchive to 2.8.5 Saul Wold
2011-11-08 19:22 ` [CONSOLIDATED PULL 09/17] qmmp: update to 0.5.2 Saul Wold
2011-11-08 19:22 ` [CONSOLIDATED PULL 10/17] distro_tracking_fields.inc: Modify the status of qmmp Saul Wold
2011-11-08 19:22 ` [CONSOLIDATED PULL 11/17] Add new IMAGE_CLASSES variable for classes for image generation Saul Wold
2011-11-08 19:22 ` [CONSOLIDATED PULL 12/17] tune-corei7: Add tune file for Intel Core i7 machines Saul Wold
2011-11-08 19:22 ` [CONSOLIDATED PULL 13/17] tune-ivb: Add tune file for Intel Ivy Bridge machines Saul Wold
2011-11-08 19:22 ` [CONSOLIDATED PULL 14/17] machine/include/tune-atom.inc: add atom-specific settings Saul Wold
2011-11-08 19:22 ` [CONSOLIDATED PULL 15/17] gmp_5.0.2: Set CC_FOR_BUILD to BUILD_CC Saul Wold
2011-11-08 19:22 ` [CONSOLIDATED PULL 16/17] libzypp: fix mishandling of hyphenated arches Saul Wold
2011-11-08 19:22 ` [CONSOLIDATED PULL 17/17] python: skip setup.py 'import check' when cross-compiling Saul Wold
2011-11-09 9:39 ` Koen Kooi
2011-11-09 10:34 ` Cui, Dexuan
2011-11-09 13:42 ` Tom Zanussi [this message]
2011-11-10 0:57 ` Cui, Dexuan
2011-11-10 1:06 ` Tom Zanussi
2011-11-10 1:25 ` Cui, Dexuan
2011-11-08 21:46 ` [CONSOLIDATED PULL 00/17] Updates and Fixes Richard Purdie
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1320846145.16608.0.camel@elmorro \
--to=tom.zanussi@intel.com \
--cc=dexuan.cui@intel.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox