[PATCH 0/1] MR4966: winebuild: On macOS, search for tools un-prefixed as a last resort.
When cross-compiling on macOS, like building on ARM64 to target x86_64 [1], `make install` would fail with `winebuild: cannot find the 'ar' tool`. `winebuild` was looking for `x86_64-apple-darwin-ar`, but macOS does not install prefixed tools. As a last step before failing in `find_tool()`, search for the un-prefixed tool name. [1]: with a `configure` invocation like: `../configure --enable-archs=i386,x86_64 --host=x86_64-apple-darwin CC="clang -arch x86_64"` -- https://gitlab.winehq.org/wine/wine/-/merge_requests/4966
From: Brendan Shanks <bshanks(a)codeweavers.com> --- tools/winebuild/utils.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tools/winebuild/utils.c b/tools/winebuild/utils.c index 9f51a60c01f..dec11d5ce2c 100644 --- a/tools/winebuild/utils.c +++ b/tools/winebuild/utils.c @@ -229,6 +229,7 @@ struct strarray find_tool( const char *name, const char * const *names ) struct strarray ret = empty_strarray; const char *file; const char *alt_names[2]; + const char * const *orig_names; if (!names) { @@ -236,6 +237,7 @@ struct strarray find_tool( const char *name, const char * const *names ) alt_names[1] = NULL; names = alt_names; } + orig_names = names; while (*names) { @@ -253,6 +255,20 @@ struct strarray find_tool( const char *name, const char * const *names ) file = find_clang_tool( clang, strmake( "llvm-%s", name )); } } + + /* macOS does not prefix tools like ar and ranlib, search for + * them un-prefixed before failing. + */ + if (!file && target.platform == PLATFORM_APPLE) + { + names = orig_names; + while (*names) + { + if ((file = find_binary( NULL, *names ))) break; + names++; + } + } + if (!file) fatal_error( "cannot find the '%s' tool\n", name ); strarray_add( &ret, file ); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/4966
Maybe we should just always pass `--cc-cmd` to winebuild. This would allow `find_clang_tool` to work. We could also, as a last resort, search for `clang` and use that for `find_clang_tool` instead of limiting that code path to explicitly passed compiler. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/4966#note_59511
participants (3)
-
Brendan Shanks -
Brendan Shanks (@bshanks) -
Jacek Caban (@jacek)