[OE-core] [RFC][PATCH] python: ensure usage of host modules while cross compiling

Alejandro Hernandez alejandro.hernandez at linux.intel.com
Mon Jan 25 14:49:53 UTC 2016


Ping

This has been here for a while now, if it doesnt apply let me know and I 
will rebase this, this fixes bug 8671.

On 11/02/2015 02:08 AM, Belal, Awais wrote:
> Ping!
>
> BR,
> Awais
>
> ________________________________________
> From: openembedded-core-bounces at lists.openembedded.org [openembedded-core-bounces at lists.openembedded.org] on behalf of Belal, Awais
> Sent: Friday, October 30, 2015 6:08 PM
> To: openembedded-core at lists.openembedded.org
> Subject: [OE-core] [RFC][PATCH] python: ensure usage of host modules while      cross compiling
>
> The issue is generally seen on x86 type of machines passing
> -march=bdverX (X=3,4 etc) flags but in general this should
> cause a problem when freshly built target modules are tried
> for an import during the cross build process.
> Aiding the PYTHONPATH with CROSSPYTHONPATH which contains
> the native modules resolves the issue.
>
> Signed-off-by: Awais Belal <awais_belal at mentor.com>
> ---
>   ...e-of-native-modules-while-cross-compiling.patch | 31 ++++++++++++++++++++++
>   meta/recipes-devtools/python/python_2.7.9.bb       |  1 +
>   2 files changed, 32 insertions(+)
>   create mode 100644 meta/recipes-devtools/python/python/0001-ensure-usage-of-native-modules-while-cross-compiling.patch
>
> diff --git a/meta/recipes-devtools/python/python/0001-ensure-usage-of-native-modules-while-cross-compiling.patch b/meta/recipes-devtools/python/python/0001-ensure-usage-of-native-modules-while-cross-compiling.patch
> new file mode 100644
> index 0000000..1e87e89
> --- /dev/null
> +++ b/meta/recipes-devtools/python/python/0001-ensure-usage-of-native-modules-while-cross-compiling.patch
> @@ -0,0 +1,31 @@
> +From 4eb30173f2d254f19d5ef18fabed3bdb2e5c1182 Mon Sep 17 00:00:00 2001
> +From: Awais Belal <awais_belal at mentor.com>
> +Date: Fri, 30 Oct 2015 17:47:07 +0500
> +Subject: [PATCH] ensure usage of native modules while cross compiling
> +
> +The PYTHONPATH variable augments the default search path and
> +is prepended to it. We need to make sure that host modules
> +are used while cross compiling otherwise an illegal instruction
> +error is generated if the modules built for target are imported.
> +
> +Signed-off-by: Awais Belal <awais_belal at mentor.com>
> +---
> + configure.ac | 2 +-
> + 1 file changed, 1 insertion(+), 1 deletion(-)
> +
> +diff --git a/configure.ac b/configure.ac
> +index 87a4f02..fa9e0dd 100644
> +--- a/configure.ac
> ++++ b/configure.ac
> +@@ -33,7 +33,7 @@ if test "$cross_compiling" = yes; then
> +           AC_MSG_ERROR([python$PACKAGE_VERSION interpreter not found])
> +       fi
> +         AC_MSG_RESULT($interp)
> +-      PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib:$(srcdir)/Lib/plat-$(MACHDEP) '$interp
> ++      PYTHON_FOR_BUILD='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(CROSSPYTHONPATH):$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib:$(srcdir)/Lib/plat-$(MACHDEP) '$interp
> +     fi
> + elif test "$cross_compiling" = maybe; then
> +     AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH])
> +--
> +1.9.1
> +
> diff --git a/meta/recipes-devtools/python/python_2.7.9.bb b/meta/recipes-devtools/python/python_2.7.9.bb
> index f7e2f27..9a43cf7 100644
> --- a/meta/recipes-devtools/python/python_2.7.9.bb
> +++ b/meta/recipes-devtools/python/python_2.7.9.bb
> @@ -26,6 +26,7 @@ SRC_URI += "\
>     file://parallel-makeinst-create-bindir.patch \
>     file://use_sysroot_ncurses_instead_of_host.patch \
>     file://avoid_parallel_make_races_on_pgen.patch \
> +  file://0001-ensure-usage-of-native-modules-while-cross-compiling.patch \
>   "
>
>   S = "${WORKDIR}/Python-${PV}"
> --
> 1.9.1
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core at lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core




More information about the Openembedded-core mailing list