package/ set Python sysconfigdata
diff mbox series

Message ID
State New
Headers show
  • package/ set Python sysconfigdata
Related show

Commit Message

Arnout Vandecappelle (Essensium/Mind) Aug. 4, 2019, 10:05 p.m. UTC
meson has support for Python dependencies, to e.g. build Python modules.
It parses Python's sysconfig module to find the appropriate
configuration variables. However, the sysconfig module is the one for
the host, _not_ for the target. Therefore, wrong values may be set. Many
of them get overridden anyway by the cross-compilation.conf. One
particular one that is problematic is that it uses the python-XXX.pc
pkg-config file for the host instead of the target, because it
explicitly sets the PKG_CONFIG_LIBDIR found in sysconfig.

Use the same trick as for python package: pass PYTHONPATH,
point to staging instead of host. This ensures the sysconfig from the
target is used instead of the one from the host.

An alternative would be to patch meson to not use the PKG_CONFIG_LIBDIR
from sysconfig. However, it is likely that other problems will pop up at
some point because of using the wrong sysconfig.

Note that this approach will still break things when meson needs to
build something for the host during a target build.

Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <>
Cc: Adam Duskett <>
Cc: Eric Le Bihan <>
Cc: Peter Seiderer <>
Cc: James Hilliard <>
Cc: Yann E. MORIN <>
The setting of _PYTHON_SYSCONFIGDATA_NAME is different from the one in I don't understand how that definition could work: for
Python2, it is empty, so sysconfig tries to import a module with name
"". So apparently the call paths used by meson and by
setuptools/distutils are slightly different.
 package/ | 3 +++
 1 file changed, 3 insertions(+)

diff mbox series

diff --git a/package/ b/package/
index 0b811d1cc0..3f875c08ce 100644
--- a/package/
+++ b/package/
@@ -81,6 +81,9 @@  define $(2)_CONFIGURE_CMDS
 	    -e "s%@HOST_DIR@%$$(HOST_DIR)%g" \
 	    package/meson/ \
 	    > $$($$(PKG)_SRCDIR)/build/cross-compilation.conf
 	PATH=$$(BR_PATH) $$($$(PKG)_CONF_ENV) $$(MESON) \
 		--prefix=/usr \
 		--libdir=lib \