refactor: statically link the c runtime on windows msvc x86_64
now the resulting EXE (x86_64-pc-windows-msvc) will not depend on the VCRUNTIME140.dll
before:
ldd target/release/static-web-server.exe
ntdll.dll => /c/Windows/SYSTEM32/ntdll.dll (0x7ff9bdeb0000)
KERNEL32.DLL => /c/Windows/System32/KERNEL32.DLL (0x7ff9bc210000)
KERNELBASE.dll => /c/Windows/System32/KERNELBASE.dll (0x7ff9bb640000)
advapi32.dll => /c/Windows/System32/advapi32.dll (0x7ff9bc510000)
msvcrt.dll => /c/Windows/System32/msvcrt.dll (0x7ff9bddd0000)
sechost.dll => /c/Windows/System32/sechost.dll (0x7ff9bdb80000)
RPCRT4.dll => /c/Windows/System32/RPCRT4.dll (0x7ff9bcb40000)
ws2_32.dll => /c/Windows/System32/ws2_32.dll (0x7ff9bdb10000)
bcrypt.dll => /c/Windows/System32/bcrypt.dll (0x7ff9bbde0000)
ucrtbase.dll => /c/Windows/System32/ucrtbase.dll (0x7ff9bbb30000)
VCRUNTIME140.dll => /c/Windows/SYSTEM32/VCRUNTIME140.dll (0x7ff9b29a0000)
CRYPTBASE.DLL => /c/Windows/SYSTEM32/CRYPTBASE.DLL (0x7ff9bae70000)
after:
ldd static-web-server.exe
ntdll.dll => /c/Windows/SYSTEM32/ntdll.dll (0x7ff9bdeb0000)
KERNEL32.DLL => /c/Windows/System32/KERNEL32.DLL (0x7ff9bc210000)
KERNELBASE.dll => /c/Windows/System32/KERNELBASE.dll (0x7ff9bb640000)
advapi32.dll => /c/Windows/System32/advapi32.dll (0x7ff9bc510000)
msvcrt.dll => /c/Windows/System32/msvcrt.dll (0x7ff9bddd0000)
sechost.dll => /c/Windows/System32/sechost.dll (0x7ff9bdb80000)
RPCRT4.dll => /c/Windows/System32/RPCRT4.dll (0x7ff9bcb40000)
ws2_32.dll => /c/Windows/System32/ws2_32.dll (0x7ff9bdb10000)
bcrypt.dll => /c/Windows/System32/bcrypt.dll (0x7ff9bbde0000)
CRYPTBASE.DLL => /c/Windows/SYSTEM32/CRYPTBASE.DLL (0x7ff9bae70000)
Diff
.cargo/config.toml | 7 +++++++
1 file changed, 7 insertions(+)
@@ -0,0 +1,7 @@
[registries.crates-io]
protocol = "sparse"
[target.x86_64-pc-windows-msvc]
rustflags = ["-C", "target-feature=+crt-static"]