Skip to content

Commit

Permalink
print out which command needs an exe_wrapper
Browse files Browse the repository at this point in the history
It's not the first time I run into an issue with an intentionally missing
exe_wrapper during cross compilation. In pretty much all the cases the project
I tried to build already had code available to not need one in the first place.
Print out what command was actually the culprit to make debugging this easier.
  • Loading branch information
DerDakon committed Dec 18, 2024
1 parent bcb6052 commit ffba8f1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mesonbuild/backend/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ def get_executable_serialisation(
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 ' \
msg = 'An exe_wrapper is needed for ' + exe_cmd[0] + ' but was not found. Please define one ' \
'in cross file and check the command and/or add it to PATH.'
raise MesonException(msg)
exe_wrapper = self.environment.get_exe_wrapper()
Expand Down
5 changes: 4 additions & 1 deletion test cases/failing/126 generator host binary/test.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"stdout": [
{ "line": "ERROR: 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." }
{
"match": "re",
"line": "ERROR: An exe_wrapper is needed for .* but was not found. Please define one in cross file and check the command and/or add it to PATH."
}
]
}
2 changes: 1 addition & 1 deletion unittests/linuxcrosstests.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def test_exe_wrapper_behaviour(self):
self.meson_cross_files = [os.path.join(testdir, 'broken-cross.txt')]
# Force tracebacks so we can detect them properly
env = {'MESON_FORCE_BACKTRACE': '1'}
error_message = "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."
error_message = "An exe_wrapper is needed for " + self.builddir + "/prog.exe but was not found. Please define one in cross file and check the command and/or add it to PATH."

with self.assertRaises(MesonException) as cm:
# Must run in-process or we'll get a generic CalledProcessError
Expand Down

0 comments on commit ffba8f1

Please sign in to comment.