[meta-virtualization] [PATCH] lxc: fix build issue - unable to find Python.h

Bruce Ashfield bruce.ashfield at windriver.com
Mon Mar 21 07:26:52 PDT 2016


On 2016-03-17 12:25 PM, Mark Asselstine wrote:
> Prior to poky commit 3d45853eef1269b455d840a60491802251368378
> [python3: fix do_configure check platform triplet error] lxc's
> configure scripts would fail to find python3 and would therefor
> configure with python3 support disabled.
>
> After poky integrated the above commit lxc can, and does, detect
> python3 and attempts to configure with python support. Unfortunately
> it would detect the host's python3 which it would use to run setup.py
> and therefor get the host's include path etc. and ultimately fail to
> build.
>
> To fix this we make 'python' support configurable via a PACKAGECONFIG
> and we default to not configuring with this support, to match our
> previous configuration. We also fix things such that 'python' support
> can be enabled in the PACKAGECONFIG and the build will complete
> successfully, using our python3 and not the host's.

merged as-is to master.

>
> We might want to eventually enable the python support but since this
> not only enables python extensions but even goes as far as turning
> scripts like lxc-ls into python scripts, instead of shell scripts,
> keeping it disabled for now is the minimally invasive approach.

Indeed. That's overkill for now, but definitely something to consider.

Bruce

>
> Signed-off-by: Mark Asselstine <mark.asselstine at windriver.com>
> ---
>   recipes-containers/lxc/lxc_1.1.4.bb | 21 +++++++++++++++++++++
>   1 file changed, 21 insertions(+)
>
> diff --git a/recipes-containers/lxc/lxc_1.1.4.bb b/recipes-containers/lxc/lxc_1.1.4.bb
> index e017dcf..a4c44d2 100644
> --- a/recipes-containers/lxc/lxc_1.1.4.bb
> +++ b/recipes-containers/lxc/lxc_1.1.4.bb
> @@ -64,6 +64,13 @@ PACKAGECONFIG[apparmour] = "--enable-apparmor,--disable-apparmor,apparmor,apparm
>   PACKAGECONFIG[templates] = ",,, ${PN}-templates"
>   PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,libselinux,libselinux"
>   PACKAGECONFIG[seccomp] ="--enable-seccomp,--disable-seccomp,libseccomp,libseccomp"
> +PACKAGECONFIG[python] = "--enable-python,--disable-python,python3,python3-core"
> +
> +# required by python3 to run setup.py
> +export BUILD_SYS
> +export HOST_SYS
> +export STAGING_INCDIR
> +export STAGING_LIBDIR
>
>   inherit autotools pkgconfig ptest update-rc.d systemd
>
> @@ -78,6 +85,7 @@ INITSCRIPT_PARAMS_${PN}-setup = "${OS_DEFAULT_INITSCRIPT_PARAMS}"
>   FILES_${PN}-doc = "${mandir} ${infodir}"
>   # For LXC the docdir only contains example configuration files and should be included in the lxc package
>   FILES_${PN} += "${docdir}"
> +FILES_${PN} += "${libdir}/python3*"
>   FILES_${PN}-dbg += "${libexecdir}/lxc/.debug"
>   PACKAGES =+ "${PN}-templates ${PN}-setup ${PN}-networking"
>   FILES_${PN}-templates += "${datadir}/lxc/templates"
> @@ -92,6 +100,12 @@ FILES_${PN}-setup += "/etc/init.d"
>
>   PRIVATE_LIBS_${PN}-ptest = "liblxc.so.1"
>
> +CACHED_CONFIGUREVARS += " \
> +    ac_cv_path_PYTHON='${STAGING_BINDIR_NATIVE}/python3-native/python3' \
> +    am_cv_python_pyexecdir='${exec_prefix}/${libdir}/python3.5/site-packages' \
> +    am_cv_python_pythondir='${prefix}/${libdir}/python3.5/site-packages' \
> +"
> +
>   do_install_append() {
>   	# The /var/cache/lxc directory created by the Makefile
>   	# is wiped out in volatile, we need to create this at boot.
> @@ -107,6 +121,13 @@ do_install_append() {
>   	    install -d ${D}${sysconfdir}/init.d
>   	    install -m 755 config/init/sysvinit/lxc* ${D}${sysconfdir}/init.d
>   	fi
> +
> +	# since python3-native is used for install location this will not be
> +	# suitable for the target and we will have to correct the package install
> +	if ${@bb.utils.contains('PACKAGECONFIG', 'python', 'true', 'false', d)}; then
> +	    if [ -d ${D}${exec_prefix}/lib/python* ]; then mv ${D}${exec_prefix}/lib/python* ${D}${libdir}/; fi
> +	    rmdir --ignore-fail-on-non-empty ${D}${exec_prefix}/lib
> +	fi
>   }
>
>   EXTRA_OEMAKE += "TEST_DIR=${D}${PTEST_PATH}/src/tests"
>



More information about the meta-virtualization mailing list