From 5e936ceac79b8af1885df9bafa0398de291218ff Mon Sep 17 00:00:00 2001 From: Julien Olivain Date: Mon, 28 Oct 2024 21:34:42 +0100 Subject: [PATCH] package/jailhouse: fix build when python helper scripts are enabled When compiling jailhouse with BR2_PACKAGE_JAILHOUSE_HELPER_SCRIPTS=y, build is failing with error: Traceback (most recent call last): File "/buildroot/output/build/jailhouse-e57d1eff6d55aeed5f977fe4e2acfb6ccbdd7560/setup.py", line 18, in setup(name="pyjailhouse", version=version, File "/buildroot/output/host/lib/python3.12/site-packages/setuptools/__init__.py", line 108, in setup return distutils.core.setup(**attrs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ... File "/buildroot/output/host/lib/python3.12/sysconfig.py", line 549, in _init_posix _temp = __import__(name, globals(), locals(), ['build_time_vars'], 0) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ValueError: Empty module name This is due to a missing dependency on the target python3 package. Jailhouse Python scripts are using setuptools with host-python3 which reads its sysconfig data from the target-python3. See: https://gitlab.com/buildroot.org/buildroot/-/blob/2024.08.1/package/pkg-python.mk?ref_type=tags#L33 If the target python3 is not installed, this get expanded as an empty string, leading to this "ValueError: Empty module name" error. Pure Python packages which are using the python-package infrastructure usually get this dependency automatically from: https://gitlab.com/buildroot.org/buildroot/-/blob/2024.08.1/package/pkg-python.mk?ref_type=tags#L295 Here, the jailhouse package rather uses the generic-package infrastructure, then installs the Python scripts (if enabled) with dedicated macros. This is why the target python3 is needed. This commit fixes the issue by adding this missing dependency. Signed-off-by: Julien Olivain Signed-off-by: Thomas Petazzoni (cherry picked from commit c808e271e3e487a46f23b144b44ace54f97f3aab) Signed-off-by: Peter Korsgaard --- package/jailhouse/jailhouse.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package/jailhouse/jailhouse.mk b/package/jailhouse/jailhouse.mk index 1354acf600..a1c86f0e91 100644 --- a/package/jailhouse/jailhouse.mk +++ b/package/jailhouse/jailhouse.mk @@ -21,7 +21,8 @@ JAILHOUSE_MAKE_OPTS = \ ifeq ($(BR2_PACKAGE_JAILHOUSE_HELPER_SCRIPTS),y) JAILHOUSE_DEPENDENCIES += \ host-python-mako \ - host-python-setuptools + host-python-setuptools \ + python3 JAILHOUSE_MAKE_OPTS += \ HAS_PYTHON_MAKO="yes" \ PYTHON_PIP_USABLE="yes"