From fa0cca564a78d30c18d01030beebde59f6872618 Mon Sep 17 00:00:00 2001 From: Jose Quintana Date: Wed, 7 Jun 2023 23:35:50 +0200 Subject: [PATCH] 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) --- .cargo/config.toml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..cbe2504 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,7 @@ +[registries.crates-io] +protocol = "sparse" + +# Statically link the C runtime on Windows MSVC x86_64, +# so that the resulting EXE doesn't depend on the VCRUNTIME140.dll. +[target.x86_64-pc-windows-msvc] +rustflags = ["-C", "target-feature=+crt-static"] -- libgit2 1.7.2