Skip to content

Commit

Permalink
Revert various cross compile changes
Browse files Browse the repository at this point in the history
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 mesonbuild#13403 and mesonbuild#13410
  • Loading branch information
lazka authored and eli-schwartz committed Jul 16, 2024
1 parent 2a8bb3b commit d9e2dd6
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion mesonbuild/backend/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,8 @@ def get_executable_serialisation(
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.'
Expand Down
4 changes: 2 additions & 2 deletions mesonbuild/compilers/cuda.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ def sanity_check(self, work_dir: str, env: 'Environment') -> None:
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
Expand All @@ -575,7 +575,7 @@ def sanity_check(self, work_dir: str, env: 'Environment') -> None:
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:
Expand Down
2 changes: 1 addition & 1 deletion mesonbuild/compilers/d.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ def sanity_check(self, work_dir: str, environment: 'Environment') -> None:
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
Expand Down
4 changes: 2 additions & 2 deletions mesonbuild/compilers/mixins/clike.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def _sanity_check_impl(self, work_dir: str, environment: 'Environment',
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
Expand Down Expand Up @@ -308,7 +308,7 @@ def _sanity_check_impl(self, work_dir: str, environment: 'Environment',
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
Expand Down
2 changes: 1 addition & 1 deletion mesonbuild/compilers/rust.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def sanity_check(self, work_dir: str, environment: 'Environment') -> None:
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
Expand Down

0 comments on commit d9e2dd6

Please sign in to comment.