diff mbox series

[meta-python] python3-systemd: fix build failure caused by race condition

Message ID 20251105045818.2593363-1-Qi.Chen@windriver.com
State New
Headers show
Series [meta-python] python3-systemd: fix build failure caused by race condition | expand

Commit Message

ChenQi Nov. 5, 2025, 4:58 a.m. UTC
From: Chen Qi <Qi.Chen@windriver.com>

For now, building python3-systemd sometimes reports error:

  pyutil.o not found

This is because its setup.py is not written in a way to handle
race condition. Multiple modules are using the same .c file,
resulting in the corresponding .o file generated multiple times.

The latest release of python3-systemd is 235, and the latest codes
have switched away from setup.py. So we'd better not patch setup.py.
Instead, we handle this issue by making its modules compile one by
one. It only has 5 modules, so there should be little impact on
building time.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 .../recipes-devtools/python/python3-systemd_235.bb  | 13 +++++++++++++
 1 file changed, 13 insertions(+)
diff mbox series

Patch

diff --git a/meta-python/recipes-devtools/python/python3-systemd_235.bb b/meta-python/recipes-devtools/python/python3-systemd_235.bb
index 6b44751df7..0229b2a820 100644
--- a/meta-python/recipes-devtools/python/python3-systemd_235.bb
+++ b/meta-python/recipes-devtools/python/python3-systemd_235.bb
@@ -15,3 +15,16 @@  inherit pypi features_check pkgconfig setuptools3
 REQUIRED_DISTRO_FEATURES = "systemd"
 
 RDEPENDS:${PN} += "systemd python3-syslog python3-logging python3-syslog"
+
+do_compile() {
+        cd ${SETUPTOOLS_SETUP_PATH}
+
+        export STAGING_INCDIR=${STAGING_INCDIR}
+        export STAGING_LIBDIR=${STAGING_LIBDIR}
+
+        nativepython3 setup.py --verbose \
+            build -j 1 \
+            bdist_wheel --dist-dir ${PEP517_WHEEL_PATH} \
+            ${SETUPTOOLS_BUILD_ARGS}
+}
+do_compile[vardepsexclude] = "MACHINE"