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

Add Windows Support for --static to guides/static_linking #800

Closed
wants to merge 1 commit into from

Conversation

sol-vin
Copy link

@sol-vin sol-vin commented Nov 14, 2024

Not sure if there is anything else that needs to be added for this. For #776

Copy link

netlify bot commented Nov 14, 2024

Deploy Preview for crystal-book ready!

Name Link
🔨 Latest commit ed297bd
🔍 Latest deploy log https://app.netlify.com/sites/crystal-book/deploys/67364b820d444d000837455e
😎 Deploy Preview https://deploy-preview-800--crystal-book.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@Blacksmoke16 Blacksmoke16 linked an issue Nov 14, 2024 that may be closed by this pull request
@HertzDevil
Copy link
Contributor

What makes you think so?

In order to distinguish static libraries from DLL import libraries, when the compiler searches for a library `foo.lib` in a given directory, `foo-static.lib` will be attempted first while linking statically, and `foo-dynamic.lib` will be attempted first while linking dynamically. The official Windows MSVC packages are distributed with both static and DLL import libraries for all third-party dependencies, except for LLVM, which is only available as an import library.

Static linking implies using the static version of Microsoft's Universal C Runtime (`/MT`), and dynamic linking implies the dynamic version (`/MD`); extra C libraries should be built with this in mind to avoid linker warnings about mixing CRT versions. There is currently no way to use the dynamic CRT while linking statically.
Windows fully supports static linking using the `--static` option.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only targets that "fully" support static linking are the musl-libc ones, every other libc has some dynamically linked component, so this is incorrect.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, I guess I didn't understand the point of crystal-lang/crystal#14292

@sol-vin sol-vin closed this Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update information about static linking on Windows
2 participants