Change Mono runtime to use static linked c-runtime on debug builds.#33715
Conversation
|
@jkotas Looked in the generated .sln and there the settings was /MTd for debug and /MT for release and when I looked at imports for runtime\artifacts\bin\coreclr\Windows_NT.x64.Debug\coreclr.dll it didn't have any dependecies on c-runtime. Looking at coreclr.dll that is part of a downloaded package have dynamic dependecy on c-runtime. Is things different configured when doing local build vs build ending up in package? Problem I believe we have when running debug Mono on for example CI is that we don't have needed redists, so question is if there is a difference when building using regular build.cmd and when doing build ending up in final product? |
We statically link debug builds, but release builds are linked dynamically: https://github.com/dotnet/runtime/blob/master/src/coreclr/configurecompiler.cmake#L100 |
|
I was looking at the release config in the solution generated for debug build, that's why it was the same on both debug and release. So to sum up, static linked C-runtime on debug and dynamic linked on release. If we do that on Mono we will do similar to what I guess the static on debug also resolve the issues we see on CI where we don't have debug version of c-runtime on CI. |
|
dotnet/coreclr#4381 was the CoreCLR that introduced the CRT scheme that we are using. I am not sure where the reasons for this complex setup are still valid, but we are definitely not statically linking the whole CRT in the shipping bits. |
7ad8f07 to
e844613
Compare
|
Updated to only static link in debug build, but keep dynamic linked c-runtime in release builds. |
|
Next step to align with coreclr would be to static link whats coming in from vcruntime140.dll even in release build, dotnet/coreclr#4381. |

No description provided.