Conversation
This allow configuring how the MSVC CRT is linked without involving the compiler.
|
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @JohnTitor (or someone else) soon. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
|
Triage: This has been open for more than six months. Is there anything I can help here? |
|
Hmm... I don't think so, I'd hoped this would be part of a wider discussion on solving the issue but that discussion doesn't look like it's going to happen any time soon. I'll remove this for now and maybe revisit if/when I can gather more interest. It is something that needs broader input so I wouldn't want to move forward without that. |
Currently libc hard codes the MSVC CRT that's used by the compiler. Users can select between two CRTs (dynamic and static) by toggling the
target-feature=crt-staticoption. However, this is far from ideal given the number of possible configurations, especially when attempting to co-exist with existing C/C++ builds.At a minimum, it's also useful to be able to use the debug or release versions of these libraries. The following table shows these possible combinations:
msvcrtmsvcrtdlibcmtlibcmtdFurthermore, users may want to disable linking the crt entirely so that they can fully control what is linked and how.
To support these different configurations, this PR adds a new cfg,
msvc_crt_link=option, whereoptionis the link configuration option. This can be set in global rustflags (using--cfg) so that it's applied consistently. The two possible options are:debug: Use the debug versions of the CRT librariesnocrt: disable all CRT linking. This obviously overrides all other options because nothing is linked