-
-
Notifications
You must be signed in to change notification settings - Fork 2.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
the windows zig binaries from the download page dynamically link vcredist140.dll instead of static linking #3391
Comments
zig hello world does not depend on vcredist140.dll |
Ah, you're talking about the downloaded zig.exe binary, got it. |
Yep! :) zig-windows-x86_64-0.5.0+57112346.zip to be precise. |
It seems this is a regression caused by upgrading to MSVC 2019, which has also caused #3024. We may want to downgrade back to 2017. |
Please see the helpful comments in the above linked duplicate issue; it's an ongoing effort to restore static linking of this library. |
It looks that zig releases have always built with using this command →
|
This looks related: rust-lang/libc#290 |
This issue is about linking a rust executable with the static CRT, but in our case that is the compiler that's linked dynamically to the CRT. If you want The recommended approach by cmake is override files, however we can also choose to do a dynamic replace. Note that while doing this, we can make progress towards allowing |
Why do we need override files? Looks like we can put this directly into if(MSVC)
set(CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /Zi /Ob0 /Od /RTC1")
set(CMAKE_C_FLAGS_MINSIZEREL_INIT "/MT /O1 /Ob1 /D NDEBUG")
set(CMAKE_C_FLAGS_RELEASE_INIT "/MT /O2 /Ob2 /D NDEBUG")
set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MT /Zi /O2 /Ob1 /D NDEBUG")
set(CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /Zi /Ob0 /Od /RTC1")
set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MT /O1 /Ob1 /D NDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE_INIT "/MT /O2 /Ob2 /D NDEBUG")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MT /Zi /O2 /Ob1 /D NDEBUG")
endif() Do you know if this will require rebuilding the windows tarball of clang & llvm? |
The doc says it has to then be enabled via To use |
OK, so then the question is what's the simplest way to update the instructions on the wiki to include building llvm & clang with /MT: https://github.com/ziglang/zig/wiki/How-to-build-LLVM,-libclang,-and-liblld-from-source#windows That's exciting that we can finally have release llvm + debug zig on windows! I'll start a /MT build of llvm & clang on my windows laptop. |
I'm trying a static build of LLVM and zig, will update with results. |
So I've been able to build llvm & clang with I've opened a PR with the changes on Zig's side. However, maybe we could also make our Now I get
|
Thank you for doing this investigation @Sahnvour! I'll start updating the prebuilt tarball for the CI purposes. Do you think we should downgrade to MSVC 2017 to avoid the codegen bug as well? |
I'm ok with using |
Just downloaded and tried to build the hello.zig example, but when I did in the terminal (Powershell/cmd), got no output at all. At a whim I doubleclicked zig.exe and got an errormessage for missing the vcredist140 dll - so downloaded the latest VC runtime, and now it works. Would be nice if there was a heads-up in the documentation. :)
The text was updated successfully, but these errors were encountered: