-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Indicate which version of MSVC Rust was built with #26258
Comments
It sounds like our best option will be to avoid the CRT entirely. I highly doubt there's a "correct" CRT to depend on and whatever we choose will likely cause pain for someone at some point, so not depending on one at all seems best. Apart from the standard library we also need to worry about the small bits of C code we link into the standard library, any object compiled with |
Hi ! |
Rust still relies on things which are not guaranteed by Microsoft to remain stable across versions. Fortunately the stuff that Rust currently relies on hasn't changed between the versions of msvc that we currently support. |
So I seem to recall an RFC and implementation recently regarding CRTs, does that fix this issue? Or at least update it in some way? |
Triage: not aware of changes that fixes this. |
When linking to the CRT on Windows, all code that is statically linked together needs to use the same version of the CRT. Different versions of the CRT (aka they have different DLL names) are not ABI compatible, so
msvcrt120.dll
andmsvcrt110.dll
are not ABI compatible. In particular, almost all Rust code links statically tolibstd
, so the version of the CRT thatlibstd
uses needs to be same version of the CRT that Rust code using thatlibstd
is using.For the gnu version of Rust, it relies on
msvcrt.dll
and since all versions of MinGW will link tomsvcrt.dll
everything is fine and dandy.However, for the MSVC version of Rust, it is linked against a specific versioned CRT such as
msvcrt120.dll
. Since the version of the CRT depends on which version of MSVC you build your code with, there is a possibility for you to use a different version of the CRT thanlibstd
was built with, causing room for potential ABI issues. There's even separate debug/release versions of the CRT for each version, as well as static/dynamically linked versions of the CRT.Therefore, to ensure that there is no ABI compatibility issues, distributions of the MSVC version of Rust should indicate exactly which version of MSVC and the CRT they were built with.
Note that this is purely an issue for developers using Rust to build their code with the msvc toolchain. End-users of binaries built by Rust merely need to have the appropriate redistributable installed and there's no ABI concerns there.
The text was updated successfully, but these errors were encountered: