aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2020-05-07 16:58:22 -0400
committerXavier Claessens <xclaesse@gmail.com>2020-05-11 18:02:37 -0400
commit245d659522fd73857bf7f4e83bd572d9cdcd7469 (patch)
tree2b745c9ff1f4665a0fe22271fbb8ef54f084e1c0
parent630a00374600bffedbabb8ef623e16bed52f21c4 (diff)
downloadmeson-245d659522fd73857bf7f4e83bd572d9cdcd7469.zip
meson-245d659522fd73857bf7f4e83bd572d9cdcd7469.tar.gz
meson-245d659522fd73857bf7f4e83bd572d9cdcd7469.tar.bz2
ConfigToolDependency: Don't fallback to system tool when cross compiling
The system tool is always the wrong thing to use and cause hard to debug issues when trying to link system libraries with cross built binaries. The ExternalDependency base class already had a method to deal with this, used by PkgConfigDependency and QtBaseDependency, so it should make things more consistent.
-rw-r--r--docs/markdown/Dependencies.md3
-rw-r--r--docs/markdown/snippets/config_tool_no_cross_path.md7
-rw-r--r--mesonbuild/dependencies/base.py25
-rw-r--r--test cases/frameworks/21 libwmf/meson.build2
4 files changed, 15 insertions, 22 deletions
diff --git a/docs/markdown/Dependencies.md b/docs/markdown/Dependencies.md
index 17c9991..572a3d1 100644
--- a/docs/markdown/Dependencies.md
+++ b/docs/markdown/Dependencies.md
@@ -242,6 +242,9 @@ libgcrypt_dep = dependency('libgcrypt', version: '>= 1.8')
gpgme_dep = dependency('gpgme', version: '>= 1.0')
```
+*Since 0.55.0* Meson won't search $PATH any more for a config tool binary when
+cross compiling if the config tool did not have an entry in the cross file.
+
## AppleFrameworks
Use the `modules` keyword to list frameworks required, e.g.
diff --git a/docs/markdown/snippets/config_tool_no_cross_path.md b/docs/markdown/snippets/config_tool_no_cross_path.md
new file mode 100644
index 0000000..cec22e4
--- /dev/null
+++ b/docs/markdown/snippets/config_tool_no_cross_path.md
@@ -0,0 +1,7 @@
+## Config tool based dependencies no longer search PATH for cross compiling
+
+Before 0.55.0 config tool based dependencies (llvm-config, cups-config, etc),
+would search system $PATH if they weren't defined in the cross file. This has
+been a source of bugs and has been deprecated. It is now removed, config tool
+binaries must be specified in the cross file now or the dependency will not
+be found.
diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py
index 95a3956..bcb1531 100644
--- a/mesonbuild/dependencies/base.py
+++ b/mesonbuild/dependencies/base.py
@@ -437,28 +437,11 @@ class ConfigToolDependency(ExternalDependency):
"""
if not isinstance(versions, list) and versions is not None:
versions = listify(versions)
-
- tool = self.env.lookup_binary_entry(self.for_machine, self.tool_name)
- if tool is not None:
- tools = [tool]
- else:
- if not self.env.machines.matches_build_machine(self.for_machine):
- mlog.deprecation('No entry for {0} specified in your cross file. '
- 'Falling back to searching PATH. This may find a '
- 'native version of {0}! This will become a hard '
- 'error in a future version of meson'.format(self.tool_name))
- tools = [[t] for t in self.tools]
-
best_match = (None, None)
- for tool in tools:
- if len(tool) == 1:
- # In some situations the command can't be directly executed.
- # For example Shell scripts need to be called through sh on
- # Windows (see issue #1423).
- potential_bin = ExternalProgram(tool[0], silent=True)
- if not potential_bin.found():
- continue
- tool = potential_bin.get_command()
+ for potential_bin in self.search_tool(self.tool_name, self.tool_name, self.tools):
+ if not potential_bin.found():
+ continue
+ tool = potential_bin.get_command()
try:
p, out = Popen_safe(tool + [self.version_arg])[:2]
except (FileNotFoundError, PermissionError):
diff --git a/test cases/frameworks/21 libwmf/meson.build b/test cases/frameworks/21 libwmf/meson.build
index 6952bf7..9dbab6a 100644
--- a/test cases/frameworks/21 libwmf/meson.build
+++ b/test cases/frameworks/21 libwmf/meson.build
@@ -1,7 +1,7 @@
project('libwmf test', 'c')
wm = find_program('libwmf-config', required : false)
-if not wm.found()
+if not wm.found() or meson.is_cross_build()
error('MESON_SKIP_TEST: libwmf-config not installed')
endif