-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
LNK 1107 on windows with clang++/link.exe(MSVC)/ninja #10022
Comments
I'm surprised 6 months have passed and the bug has not been fixed. Thanks. I edit |
@eli-schwartz i thought we backed out thin library support? |
It turns out we only did that for a particular stable branch, see e.g. #9453 and #9482 Our heuristic of checking --help output was known to fail on OSX and was manually disabled there at the time of initial implementation. It also failed as reported in those tickets for certain types of consumers such as cuda / custom targets. Apparently it's additionally broken on link.exe (I'm surprised the heuristic matches there???). So that's just a bundle of cases where it fails, which is disappointing. And we quite obviously don't handle them all. I didn't expect this when I originally implemented it, and honestly I'm not too attached to using thin archives. I seem to recall saying somewhere that I was not opposed to reverting it altogether. I don't know, maybe it can be saved, but I don't even know why it currently fails so I'm probably not the best person to figure out how to save it. Hardcoding "don't use it on Windows just like we don't use it on macOS"? Please feel free to revert or fix it as you wish. I won't be back home yet for a day or two. |
Okay, I won’t have a chance to look till Monday either, and doing have a windows machine atm |
I put a list of know workarrounds in the description so any new user can check them, if it gets fixed on a newer release feel free to close it or update this issue |
List of know workarounds
Adding this list of known workarrounds so any user that sees this Issue can use them without reading the whole conversation or related issues.
You can run one of the following workarounds
CXX
toclang++
CXX_LD
tolld-link
0.60.1
as this issue was not ported to0.60.1
+pip install meson==0.60.1
as for this time the issue is present on
1.0.0
, if this gets fixed on a newer release feel free to comment it so I can update this description or close the issue if requiredas for the time I recommend using the first workaround as is a one setup fix(and you can use any version of meson).
Description
Describe the bug
A LNK 1107 is throw when trying to compile a static library on windows.
To Reproduce
the following repo shows this behavior: meson-compile-clang-issue
the
compile-meson-MSVC-link.ps1
creates a native build using the default compiler (clang++ detected) and default static compiler(link.exe), this will produce an LNK1107 as MSVC link.exe does not support thin static libraries and clang++ will pick link.exe by default.Expected behavior
Meson should not use the --thin(T) flag when using link.exe (detected by default) or try to use the lld-link compiler when using clang++ in a static library.
manually editing the
build.ninja
and removing the flag makes it compile successfully:using the
compile-meson-lld-link.ps1
will force the use oflld-link
(which support thin static libraries generated by LLVM-AR) instead and the code will compile with the following output:system parameters
Environment:
Clear Windows machine (can be a VM), on this example the Windows 11 dev environment provided by Hyper-V in windows 11 and on my machine.
if installed in that order better
if there is anything else needed, please let me know
The text was updated successfully, but these errors were encountered: