Skip to content
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

Fix static linking when using MinGW-w64 #15167

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

HertzDevil
Copy link
Contributor

Resolves part of #6170.

  • The MinGW-w64 equivalent for MSVC's libcmt.lib or msvcrt.lib is provided by MinGW-w64's built-in spec files directly (see cc -dumpspecs), so we do not link against it.
  • MinGW-w64 still supplies -lmsvcrt by default, but this is a symlink or copy of the old C runtime library. Using -static -lmsvcrt -lucrt all together leads to a crash in the startup code. Passing -mcrtdll=ucrt suppresses this default and means Crystal doesn't have to provide an explicit @[Link] annotation for -lucrt. (This -mcrtdll in turn is what we comment out in order to support the MINGW64 environment.)

@HertzDevil HertzDevil added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib:runtime platform:windows-gnu Windows support based on the MinGW-w64 toolchain + MSYS2 labels Nov 6, 2024
@straight-shoota straight-shoota modified the milestones: 1.14.1, 1.15.0 Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. platform:windows-gnu Windows support based on the MinGW-w64 toolchain + MSYS2 topic:stdlib:runtime
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants