aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2024-07-11 22:31:39 +0200
committerEli Schwartz <eschwartz93@gmail.com>2024-07-16 02:01:21 -0400
commitd9e2dd6c806b5edf0f686c088fff2b3836ba1624 (patch)
tree42574611b21dd495940435814681c6a0c675d67c
parent2a8bb3b9f10f180c50930db92eaf23e8c4c9b81a (diff)
downloadmeson-d9e2dd6c806b5edf0f686c088fff2b3836ba1624.zip
meson-d9e2dd6c806b5edf0f686c088fff2b3836ba1624.tar.gz
meson-d9e2dd6c806b5edf0f686c088fff2b3836ba1624.tar.bz2
Revert various cross compile changes
c1076241af11f10acac28d771688bb54c6b0b340 changed the logic in multiple places, in particular it looks like it was assumed that is_cross is always the same as need_exe_wrapper(), but that's not true. Also the commit only talks about mypy, so this was definitely not intended. This reverts all the cases where need_exe_wrapper() was introduced back to is_cross. The change in backends.py could be a correct simplification, but I don't know the code base enough, so reverting that too. See #13403 and #13410
-rw-r--r--mesonbuild/backend/backends.py3
-rw-r--r--mesonbuild/compilers/cuda.py4
-rw-r--r--mesonbuild/compilers/d.py2
-rw-r--r--mesonbuild/compilers/mixins/clike.py4
-rw-r--r--mesonbuild/compilers/rust.py2
5 files changed, 8 insertions, 7 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index c6fe4f0..8c4003b 100644
--- a/mesonbuild/backend/backends.py
+++ b/mesonbuild/backend/backends.py
@@ -570,7 +570,8 @@ class Backend:
else:
extra_paths = []
- if self.environment.need_exe_wrapper(exe_for_machine):
+ is_cross_built = not self.environment.machines.matches_build_machine(exe_for_machine)
+ if is_cross_built and self.environment.need_exe_wrapper():
if not self.environment.has_exe_wrapper():
msg = 'An exe_wrapper is needed but was not found. Please define one ' \
'in cross file and check the command and/or add it to PATH.'
diff --git a/mesonbuild/compilers/cuda.py b/mesonbuild/compilers/cuda.py
index 9af1542..2fd6d17 100644
--- a/mesonbuild/compilers/cuda.py
+++ b/mesonbuild/compilers/cuda.py
@@ -553,7 +553,7 @@ class CudaCompiler(Compiler):
flags += self.get_ccbin_args(env.coredata.optstore)
# If cross-compiling, we can't run the sanity check, only compile it.
- if env.need_exe_wrapper(self.for_machine) and not env.has_exe_wrapper():
+ if self.is_cross and not env.has_exe_wrapper():
# Linking cross built apps is painful. You can't really
# tell if you should use -nostdlib or not and for example
# on OSX the compiler binary is the same but you need
@@ -575,7 +575,7 @@ class CudaCompiler(Compiler):
raise EnvironmentException(f'Compiler {self.name_string()} cannot compile programs.')
# Run sanity check (if possible)
- if env.need_exe_wrapper(self.for_machine):
+ if self.is_cross:
if not env.has_exe_wrapper():
return
else:
diff --git a/mesonbuild/compilers/d.py b/mesonbuild/compilers/d.py
index 9420d7a..67aa2b1 100644
--- a/mesonbuild/compilers/d.py
+++ b/mesonbuild/compilers/d.py
@@ -456,7 +456,7 @@ class DCompiler(Compiler):
if pc.returncode != 0:
raise EnvironmentException('D compiler %s cannot compile programs.' % self.name_string())
- if environment.need_exe_wrapper(self.for_machine):
+ if self.is_cross:
if not environment.has_exe_wrapper():
# Can't check if the binaries run so we have to assume they do
return
diff --git a/mesonbuild/compilers/mixins/clike.py b/mesonbuild/compilers/mixins/clike.py
index 70e81a4..1fddb0f 100644
--- a/mesonbuild/compilers/mixins/clike.py
+++ b/mesonbuild/compilers/mixins/clike.py
@@ -278,7 +278,7 @@ class CLikeCompiler(Compiler):
mode = CompileCheckMode.LINK
if self.is_cross:
binname += '_cross'
- if environment.need_exe_wrapper(self.for_machine) and not environment.has_exe_wrapper():
+ if not environment.has_exe_wrapper():
# Linking cross built C/C++ apps is painful. You can't really
# tell if you should use -nostdlib or not and for example
# on OSX the compiler binary is the same but you need
@@ -308,7 +308,7 @@ class CLikeCompiler(Compiler):
if pc.returncode != 0:
raise mesonlib.EnvironmentException(f'Compiler {self.name_string()} cannot compile programs.')
# Run sanity check
- if environment.need_exe_wrapper(self.for_machine):
+ if self.is_cross:
if not environment.has_exe_wrapper():
# Can't check if the binaries run so we have to assume they do
return
diff --git a/mesonbuild/compilers/rust.py b/mesonbuild/compilers/rust.py
index 7bcab3a..d071559 100644
--- a/mesonbuild/compilers/rust.py
+++ b/mesonbuild/compilers/rust.py
@@ -87,7 +87,7 @@ class RustCompiler(Compiler):
if pc.returncode != 0:
raise EnvironmentException(f'Rust compiler {self.name_string()} cannot compile programs.')
self._native_static_libs(work_dir, source_name)
- if environment.need_exe_wrapper(self.for_machine):
+ if self.is_cross:
if not environment.has_exe_wrapper():
# Can't check if the binaries run so we have to assume they do
return