-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Fix Linking for MinGW Libraries on *-windows-gnu Targets #7927
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
Conversation
- Searches for "libfoo.dll.a" for linking against when targeting mingw (Windows + GNU Abi) - When targeting Mingw (windows + GNU Abi) use the ".dll.a" suffix for library files. - NB: This is a hacky solution and the resulting linked program only works when launched from WITHIN a Mingw session. This probably has to do with how Mingw+Windows do library lookups.
Thanks for the PR. I have a different plan for this: #6565 On windows zig will only deal with .lib files, not .dll.a files. |
Thanks Andrew, The issue with using This PR is not concerned with what Zig uses internally, so go on ahead with #6565. It's more concerned with compatibility for external packages and what Zig passes to lld for linking. I've added a commit that should fix the CI build. Would you like any other changes, or should this PR just be closed? |
If you don't mind, please leave it open, and when I implement #6565 I will have all the context loaded in my mind to know how the ideas in this PR should be merged (or not). Sound OK? |
Yeah that's fine. It's your code, so ultimately your say. In the meantime I've pushed added a patch that should fix builds for windows targets on non-windows OSs. |
Hi all I tried compiling SDL2 on win with zig cc, and the current holdup is exactly that sdl ships with sdlLibs.a instead of .libs on the mingw devel. |
Please see #7799 (comment) for how I am solving this. |
When building for
*-windows-gnu
targets, link against.dll.a
import libraries instead of.dll
files directly. LLD doesn't support linking against DLLs, but requires you to link against a.lib
or.dll.a
instead.Fixes #7799.