Skip to content

Change Mono runtime to use static linked c-runtime on debug builds. #33715

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

Merged

Conversation

lateralusX
Copy link
Member

No description provided.

@jkotas
Copy link
Member

jkotas commented Mar 18, 2020

use static linked c-runtime, aligning with CoreCLR

CorecCLR does not use statically linked c-runtime:

image

We copy all the necessary files next to coreclr.dll.

@lateralusX
Copy link
Member Author

lateralusX commented Mar 18, 2020

@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?

@jkotas
Copy link
Member

jkotas commented Mar 18, 2020

Windows_NT.x64.Debug\coreclr.dll it didn't have any dependecies on c-runtime.

We statically link debug builds, but release builds are linked dynamically: https://github.com/dotnet/runtime/blob/master/src/coreclr/configurecompiler.cmake#L100

@lateralusX
Copy link
Member Author

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.

@jkotas
Copy link
Member

jkotas commented Mar 18, 2020

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.

@lateralusX lateralusX changed the title Change Mono runtime to use static linked c-runtime, aligning with CoreCLR- Change Mono runtime to use static linked c-runtime on debug builds. Mar 18, 2020
@lateralusX lateralusX force-pushed the lateralusX/mono-use-static-c-runtime branch from 7ad8f07 to e844613 Compare March 18, 2020 12:37
@lateralusX
Copy link
Member Author

Updated to only static link in debug build, but keep dynamic linked c-runtime in release builds.

@lateralusX
Copy link
Member Author

Next step to align with coreclr would be to static link whats coming in from vcruntime140.dll even in release build, dotnet/coreclr#4381.

@lateralusX lateralusX merged commit dc2dd27 into dotnet:master Mar 18, 2020
@lateralusX
Copy link
Member Author

#33853

@ghost ghost locked as resolved and limited conversation to collaborators Dec 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants