meson building nativesdk recipes with python dependencies
cover meson building nativesdk recipes with python dependencies
When building nativesdk-at-spi2-core recipe:
bitbake nativesdk-at-spi2-core
I got the following issue related to meson not finding the correct python modules:
| Program g-ir-scanner skipped: feature introspection disabled | | ../sources/at-spi2-core-2.60.0/meson.build:200:17: ERROR: <PythonExternalProgram 'python3' -> ['/build/tmp-glibc-beamtools/work/x86_64-nativesdk-pokysdk-linux/nativesdk-at-spi2-core/2.60.0/recipe-sysroot-native/ usr/bin/python3-native/python3']> is not a valid python or it is missing distutils | | A full log can be found at /build/tmp-glibc-beamtools/work/x86_64-nativesdk-pokysdk-linux/nativesdk-at-spi2-core/2.60.0/build/meson-logs/meson-log.txt | | Last 10 lines of meson-log.txt: | File "/build/tmp-glibc-beamtools/work/x86_64-nativesdk-pokysdk-linux/nativesdk-at-spi2-core/2.60.0/recipe-sysroot-native/usr/lib/python3.14/importlib/__init__.py", line 88, in import_module | return _bootstrap._gcd_import(name[level:], package, level) | ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "<frozen importlib._bootstrap>", line 1406, in _gcd_import | File "<frozen importlib._bootstrap>", line 1371, in _find_and_load | File "<frozen importlib._bootstrap>", line 1335, in _find_and_load_unlocked | ModuleNotFoundError: No module named '_sysconfigdata' | | | ../sources/at-spi2-core-2.60.0/meson.build:200:17: ERROR: <PythonExternalProgram 'python3' -> ['/build/tmp-glibc-beamtools/work/x86_64-nativesdk-pokysdk-linux/nativesdk-at-spi2-core/2.60.0/recipe-sysroot-native/ usr/bin/python3-native/python3']> is not a valid python or it is missing distutils | | ERROR: meson setup failed | WARNING: exit code 1 from a shell command.
So, I think when nativesdk python/meson should look into native paths.
The same issue is also true for wrynose release.
João Henrique Ferreira de Freitas (1):
python3targetconfig: export native python paths
meta/classes-recipe/python3targetconfig.bbclass | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
PATCH 1/1 python3targetconfig: export native python paths
When building nativesdk recipes, python variables should use native paths instead of target ones.
Exporting native paths fixes the following build error:
--
| ../sources/at-spi2-core-2.60.0/meson.build:200:17: ERROR: <PythonExternalProgram 'python3' -> ['/build/tmp-glibc-beamtools/work/x86_64-nativesdk-pokysdk-linux/nativesdk-at-spi2-core/2.60.0/recipe-sysroot-native/ usr/bin/python3-native/python3']> is not a valid python or it is missing distutils
| | A full log can be found at /build/tmp-glibc-beamtools/work/x86_64-nativesdk-pokysdk-linux/nativesdk-at-spi2-core/2.60.0/build/meson-logs/meson-log.txt | | Last 10 lines of meson-log.txt: | File "/build/tmp-glibc-beamtools/work/x86_64-nativesdk-pokysdk-linux/nativesdk-at-spi2-core/2.60.0/recipe-sysroot-native/usr/lib/python3.14/importlib/__init__.py", line 88, in import_module | return _bootstrap._gcd_import(name[level:], package, level) | ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "<frozen importlib._bootstrap>", line 1406, in _gcd_import | File "<frozen importlib._bootstrap>", line 1371, in _find_and_load | File "<frozen importlib._bootstrap>", line 1335, in _find_and_load_unlocked | ModuleNotFoundError: No module named '_sysconfigdata' | | | ../sources/at-spi2-core-2.60.0/meson.build:200:17: ERROR: <PythonExternalProgram 'python3' -> ['/build/tmp-glibc-beamtools/work/x86_64-nativesdk-pokysdk-linux/nativesdk-at-spi2-core/2.60.0/recipe-sysroot-native/ usr/bin/python3-native/python3']> is not a valid python or it is missing distutils | | ERROR: meson setup failed | WARNING: exit code 1 from a shell command.
--
--- meta/classes-recipe/python3targetconfig.bbclass | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
meta/classes-recipe/python3targetconfig.bbclass +10 -3
@@ -17,6 +17,13 @@ setup_target_config() { export PATH=${STAGING_EXECPREFIXDIR}/python-target-config/:$PATH } +setup_nativesdk_config() { + export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata" + export _PYTHON_SYSCONFIGDATA_PATH="${STAGING_LIBDIR_NATIVE}/python-sysconfigdata" + export _PYTHON_PROJECT_BASE="${B}" + export PYTHONPATH=${STAGING_LIBDIR_NATIVE}/python-sysconfigdata:$PYTHONPATH +} + do_configure:prepend:class-target() { setup_target_config }
@@ -30,13 +37,13 @@ do_install:prepend:class-target() { } do_configure:prepend:class-nativesdk() { - setup_target_config + setup_nativesdk_config } do_compile:prepend:class-nativesdk() { - setup_target_config + setup_nativesdk_config } do_install:prepend:class-nativesdk() { - setup_target_config + setup_nativesdk_config }
Re: [OE-core] [PATCH 1/1] python3targetconfig: export native python paths
meta/classes-recipe/python3targetconfig.bbclass setup_target_config() { · line 25
Quoted 6 lines · João Henrique Ferreira de Freitas via lists.openembedded.org
meta/classes-recipe/python3targetconfig.bbclass +6
-0+setup_nativesdk_config() { + export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata" + export _PYTHON_SYSCONFIGDATA_PATH="${STAGING_LIBDIR_NATIVE}/python-sysconfigdata" + export _PYTHON_PROJECT_BASE="${B}" + export PYTHONPATH=${STAGING_LIBDIR_NATIVE}/python-sysconfigdata:$PYTHONPATH +}
Redirecting to native configuration does not look right. python3targetconfig class is meant specifically to provide target python configuration, regardless of whether the build environment is direct yocto, or yocto sdk.
You need to check why the target sysconfigdata is not found, perhaps by comparing how the recipe builds in plain yocto.
Alex
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [OE-core] [PATCH 1/1] python3targetconfig: export native python paths
Quoted 7 lines · Alexander Kanavin via lists.openembedded.org
Redirecting to native configuration does not look right. python3targetconfig class is meant specifically to provide target python configuration, regardless of whether the build environment is direct yocto, or yocto sdk.
You need to check why the target sysconfigdata is not found, perhaps by comparing how the recipe builds in plain yocto.
Sorry, I didn't quite pay attention: this is a nativesdk- recipe build. Neverthless, it's still a cross-build,and so it can't use native configuration.
I sent what I think is the right fix here, please check:
https://lists.openembedded.org/g/openembedded-core/message/237233
Alex