-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Linker flag detection for lld fails when using LDFLAGS="-fuse-ld=lld" #14582
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Put both |
The issue is caused by the LLVMDynamicLinker.supports_flag() not using the flags from the
Obviously, the wrong linker has been used and the output does not include the "unknown argument: '--allow-shlib-undefined'" string, Meson is looking for, so the incompatibility is not detected. Instead, the following command line should be used for the check:
which would be processed correctly by Meson. |
That is my feeling as well. Thanks for digging into this. |
Describe the bug
When using the lld linker via Clang by setting the environment variables
LD="clang"
andLDFLAGS="-fuse-ld=lld"
, Meson fails to detect the supported lld linker flags and applies invalid flags to the linker invocation, e.g.-Wl,--allow-shlib-undefined
, which is unsupported for Windows targets.To Reproduce
Setup any Meson project on Windows for building with MinGW x86_64 CLang compiler, using the following environment variables:
A good example is the pkgconf project.
Detailed instructions for reproducing:
On a Windows machine,
pacman -S mingw-w64-x86_64-clang
meson setup build
in pkgconf repositorymeson compile -C build
in pkgconf repositoryActual behavior
meson setup
succeeds, but compilation fails in linking stage with the following error:This is caused by Meson, automatically applying the linker argument
-Wl,--allow-shlib-undefined
, which is not supported by clang/lld on Windows.Expected behavior
Meson should detect that the lld linker does not support the
--allow-shlib-undefined
flag. The build should succeed.system parameters
The text was updated successfully, but these errors were encountered: