diff mbox series

[1/1] python3targetconfig: export native python paths

Message ID 20260517133241.2972125-2-joaohf@gmail.com
State Changes Requested
Headers show
Series meson building nativesdk recipes with python dependencies | expand

Commit Message

João Henrique Ferreira de Freitas May 17, 2026, 1:32 p.m. UTC
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.
--

Signed-off-by: João Henrique Ferreira de Freitas <joaohf@gmail.com>
---
 meta/classes-recipe/python3targetconfig.bbclass | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

Comments

Alexander Kanavin May 18, 2026, 10:35 a.m. UTC | #1
On Sun, 17 May 2026 at 15:33, João Henrique Ferreira de Freitas via
lists.openembedded.org <joaohf=gmail.com@lists.openembedded.org>
wrote:
> +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
Alexander Kanavin May 18, 2026, 11:18 a.m. UTC | #2
On Mon, 18 May 2026 at 12:35, Alexander Kanavin via
lists.openembedded.org <alex.kanavin=gmail.com@lists.openembedded.org>
wrote:

> 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
diff mbox series

Patch

diff --git a/meta/classes-recipe/python3targetconfig.bbclass b/meta/classes-recipe/python3targetconfig.bbclass
index 2877665737..b7dc90b844 100644
--- a/meta/classes-recipe/python3targetconfig.bbclass
+++ b/meta/classes-recipe/python3targetconfig.bbclass
@@ -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
 }