dependencies: Don't allow using the default binary for host on cross compiles

Otherwise we can end up finding dependencies from the build machine for
the host machine, which is incorrect. This alters cmake, pkg-config, and
all config-tool based dependencies.

Fixes: #7276
pull/7314/head
Dylan Baker 5 years ago
parent 18d8dbd3bd
commit f5bd3254e9
  1. 2
      mesonbuild/cmake/executor.py
  2. 8
      mesonbuild/dependencies/base.py

@ -93,7 +93,7 @@ class CMakeExecutor:
mlog.debug('CMake binary for %s is not cached' % self.for_machine) mlog.debug('CMake binary for %s is not cached' % self.for_machine)
for potential_cmakebin in find_external_program( for potential_cmakebin in find_external_program(
environment, self.for_machine, 'cmake', 'CMake', environment, self.for_machine, 'cmake', 'CMake',
environment.default_cmake): environment.default_cmake, allow_default_for_cross=False):
version_if_ok = self.check_cmake(potential_cmakebin) version_if_ok = self.check_cmake(potential_cmakebin)
if not version_if_ok: if not version_if_ok:
continue continue

@ -444,7 +444,7 @@ class ConfigToolDependency(ExternalDependency):
best_match = (None, None) best_match = (None, None)
for potential_bin in find_external_program( for potential_bin in find_external_program(
self.env, self.for_machine, self.tool_name, self.env, self.for_machine, self.tool_name,
self.tool_name, self.tools): self.tool_name, self.tools, allow_default_for_cross=False):
if not potential_bin.found(): if not potential_bin.found():
continue continue
tool = potential_bin.get_command() tool = potential_bin.get_command()
@ -568,9 +568,9 @@ class PkgConfigDependency(ExternalDependency):
else: else:
assert PkgConfigDependency.class_pkgbin[self.for_machine] is None assert PkgConfigDependency.class_pkgbin[self.for_machine] is None
mlog.debug('Pkg-config binary for %s is not cached.' % self.for_machine) mlog.debug('Pkg-config binary for %s is not cached.' % self.for_machine)
for potential_pkgbin in find_external_program(self.env, self.for_machine, 'pkgconfig', 'Pkg-config', environment.default_pkgconfig): for potential_pkgbin in find_external_program(
mlog.debug('Trying pkg-config binary {} for machine {} at {}' self.env, self.for_machine, 'pkgconfig', 'Pkg-config',
.format(potential_pkgbin.name, self.for_machine, potential_pkgbin.command)) environment.default_pkgconfig, allow_default_for_cross=False):
version_if_ok = self.check_pkgconfig(potential_pkgbin) version_if_ok = self.check_pkgconfig(potential_pkgbin)
if not version_if_ok: if not version_if_ok:
continue continue

Loading…
Cancel
Save