Closed mp4096 closed 7 years ago
It worked like this:
rustup default nightly
set "RUSTFLAGS=-C target-feature=+crt-static"
cargo build --release
Running dumpbin.exe /dependents target\release\indentex.exe
leads to this output:
Dump of file target\release\indentex.exe
File Type: EXECUTABLE IMAGE
Image has the following dependencies:
KERNEL32.dll
ADVAPI32.dll
USERENV.dll
SHELL32.dll
Summary
2000 .data
1000 .gfids
9000 .pdata
59000 .rdata
2000 .reloc
17B000 .text
Compare to this output without RUSTFLAGS
:
Dump of file target\release\indentex.exe
File Type: EXECUTABLE IMAGE
Image has the following dependencies:
KERNEL32.dll
ADVAPI32.dll
USERENV.dll
SHELL32.dll
VCRUNTIME140.dll
api-ms-win-crt-math-l1-1-0.dll
api-ms-win-crt-runtime-l1-1-0.dll
api-ms-win-crt-string-l1-1-0.dll
api-ms-win-crt-stdio-l1-1-0.dll
api-ms-win-crt-locale-l1-1-0.dll
api-ms-win-crt-heap-l1-1-0.dll
Summary
1000 .data
1000 .gfids
8000 .pdata
51000 .rdata
1000 .reloc
16F000 .text
It explicitly didn't work for:
set RUSTFLAGS='-C target-feature=+crt-static'
(note the placement of quotes)Using the nightly-x86_64-pc-windows-msvc
toolchain:
Build type | With RUSTFLAGS |
Without RUSTFLAGS |
diff |
---|---|---|---|
release | 1910 KB | 1823 KB | +87 KB |
debug | 6474 KB | 6384 KB | +90 KB |
Oh, the quotes in Windows command line... I've got bitten by them several times before and should have known better.
And I'm very surprised that it didn't work for stable Rust, it's really weird. However, I'm ok with using nightly for building Windows installs.
@syxolk Could you please refactor your current script to PowerShell and add a compilation command to it? Cf. the AppVeyor config.
Continued in #31
Started in #17
We now have to debug why
rustc
is failing. See the config.@syxolk Could you dig into this please? I don't have a Win box at hand.