Skip to content

Commit ccdbbbe

Browse files
committed
Revert various cross compile changes
c107624 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
1 parent f978b26 commit ccdbbbe

5 files changed

Lines changed: 8 additions & 7 deletions

File tree

‎mesonbuild/backend/backends.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,8 @@ def get_executable_serialisation(
570570
else:
571571
extra_paths = []
572572

573-
if self.environment.need_exe_wrapper(exe_for_machine):
573+
is_cross_built = not self.environment.machines.matches_build_machine(exe_for_machine)
574+
if is_cross_built and self.environment.need_exe_wrapper():
574575
if not self.environment.has_exe_wrapper():
575576
msg = 'An exe_wrapper is needed but was not found. Please define one ' \
576577
'in cross file and check the command and/or add it to PATH.'

‎mesonbuild/compilers/cuda.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ def sanity_check(self, work_dir: str, env: 'Environment') -> None:
553553
flags += self.get_ccbin_args(env.coredata.optstore)
554554

555555
# If cross-compiling, we can't run the sanity check, only compile it.
556-
if env.need_exe_wrapper(self.for_machine) and not env.has_exe_wrapper():
556+
if self.is_cross and not env.has_exe_wrapper():
557557
# Linking cross built apps is painful. You can't really
558558
# tell if you should use -nostdlib or not and for example
559559
# on OSX the compiler binary is the same but you need
@@ -575,7 +575,7 @@ def sanity_check(self, work_dir: str, env: 'Environment') -> None:
575575
raise EnvironmentException(f'Compiler {self.name_string()} cannot compile programs.')
576576

577577
# Run sanity check (if possible)
578-
if env.need_exe_wrapper(self.for_machine):
578+
if self.is_cross:
579579
if not env.has_exe_wrapper():
580580
return
581581
else:

‎mesonbuild/compilers/d.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ def sanity_check(self, work_dir: str, environment: 'Environment') -> None:
456456
if pc.returncode != 0:
457457
raise EnvironmentException('D compiler %s cannot compile programs.' % self.name_string())
458458

459-
if environment.need_exe_wrapper(self.for_machine):
459+
if self.is_cross:
460460
if not environment.has_exe_wrapper():
461461
# Can't check if the binaries run so we have to assume they do
462462
return

‎mesonbuild/compilers/mixins/clike.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ def _sanity_check_impl(self, work_dir: str, environment: 'Environment',
278278
mode = CompileCheckMode.LINK
279279
if self.is_cross:
280280
binname += '_cross'
281-
if environment.need_exe_wrapper(self.for_machine) and not environment.has_exe_wrapper():
281+
if not environment.has_exe_wrapper():
282282
# Linking cross built C/C++ apps is painful. You can't really
283283
# tell if you should use -nostdlib or not and for example
284284
# on OSX the compiler binary is the same but you need
@@ -308,7 +308,7 @@ def _sanity_check_impl(self, work_dir: str, environment: 'Environment',
308308
if pc.returncode != 0:
309309
raise mesonlib.EnvironmentException(f'Compiler {self.name_string()} cannot compile programs.')
310310
# Run sanity check
311-
if environment.need_exe_wrapper(self.for_machine):
311+
if self.is_cross:
312312
if not environment.has_exe_wrapper():
313313
# Can't check if the binaries run so we have to assume they do
314314
return

‎mesonbuild/compilers/rust.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def sanity_check(self, work_dir: str, environment: 'Environment') -> None:
8787
if pc.returncode != 0:
8888
raise EnvironmentException(f'Rust compiler {self.name_string()} cannot compile programs.')
8989
self._native_static_libs(work_dir, source_name)
90-
if environment.need_exe_wrapper(self.for_machine):
90+
if self.is_cross:
9191
if not environment.has_exe_wrapper():
9292
# Can't check if the binaries run so we have to assume they do
9393
return

0 commit comments

Comments
 (0)