summaryrefslogtreecommitdiffstats
path: root/scripts/lib/scriptutils.py
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2025-08-20 23:45:25 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-08-25 17:47:20 +0100
commitefbba14b4dbe24051b287fbaf73a48b50514fc92 (patch)
tree765f3c1bbe90aa759f74099edbca17aac47c3791 /scripts/lib/scriptutils.py
parent86f54ee3cdcbc7544121d2dd7093a4049ea84333 (diff)
downloadpoky-efbba14b4dbe24051b287fbaf73a48b50514fc92.tar.gz
python3: Pass PLATFORM_TRIPLET explicitly when cross compiling
Do not rely on how python detects the platform triplet We have been lucky to get it cross-compiling since our build hosts are also using glibc, so the headers and gcc install locations match and the values it detects are mostly what we will need for glibc based targets, but when we use musl e.g. the problems show up where python3 is not able to automitically discover python modules so any python package having compiled .so modules fail to load. Example is ptest failures with TCLIBC = "musl" and running core-image-ptest-python3-rpds-py This is revamp of patch [1], currently its working for glibc based cross-compiling because we build on linux systems which are also glibc based, but python on musl shows the problem. When python was upgraded to 3.12 [2], this patch was wrongly dropped and sadly regression went unnoticed, without this patch Python's automatic module discovery does not work when it is cross-compiled this is because it tries host tools and compiler installation during configure to detect it. .so modules e.g. modulename.cpython-*.so are not seen as a result. This is seen when running python3-rpds-py ptests where it should load rpds.cpython-313-x86_64-linux-musl.so rpds.so but it does not and the module test fail. root@qemux86-64:/usr/lib/python3-rpds-py/ptest# python3 -c " import sysconfig import importlib.machinery print('Extension suffixes:', importlib.machinery.EXTENSION_SUFFIXES) print('Soabi:', sysconfig.get_config_var('SOABI')) print('Ext suffix:', sysconfig.get_config_var('EXT_SUFFIX')) print('Module suffix:', sysconfig.get_config_var('SO')) " Extension suffixes: ['.cpython-313.so', '.abi3.so', '.so'] Soabi: cpython-313 Ext suffix: .cpython-313.so Module suffix: None And after fix it is. root@qemux86-64:~# python3 -c " import sysconfig import importlib.machinery print('Extension suffixes:', importlib.machinery.EXTENSION_SUFFIXES) print('Soabi:', sysconfig.get_config_var('SOABI')) print('Ext suffix:', sysconfig.get_config_var('EXT_SUFFIX')) print('Module suffix:', sysconfig.get_config_var('SO')) " Extension suffixes: ['.cpython-313-x86_64-linux-musl.so', '.abi3.so', '.so'] Soabi: cpython-313-x86_64-linux-musl Ext suffix: .cpython-313-x86_64-linux-musl.so Module suffix: None [1] https://git.openembedded.org/openembedded-core/commit/?id=407744b00d702e3133304e1b43064a5634ca02cf [2] https://git.openembedded.org/openembedded-core/commit/?id=716d82352545d3667a658b69d65d6127678dd150 (From OE-Core rev: 7bb157e48f5e5272db7506c7eb3118209dc3b35f) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/scriptutils.py')
0 files changed, 0 insertions, 0 deletions