aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorLyude Paul <lyude@redhat.com>2018-11-04 15:08:20 -0500
committerJussi Pakkanen <jpakkane@gmail.com>2018-11-06 21:12:10 +0200
commit11e3011a6bf0adeb51582c590c90b0f4dccb4df8 (patch)
tree082c8df7390e5c8b723603e335a72ef08feaf895 /mesonbuild
parentd178fd0ab333434bec92553f2ad16b0835360a44 (diff)
downloadmeson-11e3011a6bf0adeb51582c590c90b0f4dccb4df8.zip
meson-11e3011a6bf0adeb51582c590c90b0f4dccb4df8.tar.gz
meson-11e3011a6bf0adeb51582c590c90b0f4dccb4df8.tar.bz2
Don't use host pkg-config for native dependencies
When trying to cross-compile mesa on an aarch64 system, I noticed some strange behavior. Meson would only ever find the wayland-scanner binary in my host machine's sysroot (/mnt/amethyst): Native dependency wayland-scanner found: YES 1.16.0 Program /mnt/amethyst/usr/bin/wayland-scanner found: YES (/mnt/amethyst/usr/bin/wayland-scanner) It should be finding /usr/bin/wayland-scanner instead, since the wayland-scanner dependency is created as native. On closer inspection, it turned out that meson was ignoring the native argument passed to dependency(), and wuld always use the pkgconfig binary specified in my toolchain instead of the native one (/usr/bin/pkg-config): Native dependency wayland-scanner found: YES 1.16.0 Called `/home/lyudess/Projects/panfrost/scripts/amethyst-pkg-config --variable=wayland_scanner wayland-scanner` -> 0 Turns out that if we create a dependency() object with native:false, we end up caching the pkg-config path for the host machine in PkgConfigDependency.class_pkgbin, instead of the build machine's pkg-config path. This results causing in all pkg-config invocations for dependency() objects to use the host machine's pkg-config binary, regardless of whether or not 'native: true' was specified when the dependency() object was instantiated. So, fix this by never setting PkgConfigDependency.class_pkgbin for cross dependency() objects. Also, add some test cases for this. Since triggering this bug can be avoided by creating a dependency() objects with native:true before creating any with native:false, we make sure that our test has two modes: one where it starts with a native dependency first, and another where it starts with a cross dependency first. As a final note here: We currently skip this test on windows, because windows doesn't support directly executing python scripts as executables: something that we need in order to point pkgconfig to a wrapper script that sets the PKG_CONFIG_LIBDIR env appropriately before calling pkg-config. Signed-off-by: Lyude Paul <thatslyude@gmail.com>
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/dependencies/base.py1
1 files changed, 0 insertions, 1 deletions
diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py
index 7c7e7a2..e67f4c0 100644
--- a/mesonbuild/dependencies/base.py
+++ b/mesonbuild/dependencies/base.py
@@ -503,7 +503,6 @@ class PkgConfigDependency(ExternalDependency):
potential_pkgbin = ExternalProgram.from_cross_info(environment.cross_info, 'pkgconfig')
if potential_pkgbin.found():
self.pkgbin = potential_pkgbin
- PkgConfigDependency.class_pkgbin = self.pkgbin
else:
mlog.debug('Cross pkg-config %s not found.' % potential_pkgbin.name)
# Only search for the native pkg-config the first time and