You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you try to actually enter this into a Windows cmd prompt, you get back:
D:\code>RUSTFLAGS='-C target-feature=+crt-static' cargo build --target x86_64-pc-windows-msvc
'RUSTFLAGS' is not recognized as an internal or external command,
operable program or batch file.
Similarly in PowerShell:
PS D:\code> RUSTFLAGS='-C target-feature=+crt-static' cargo build --target x86_64-pc-windows-msvc
RUSTFLAGS=-C target-feature=+crt-static : The term 'RUSTFLAGS=-C target-feature=+crt-static' is not recognized as the
name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was
included, verify that the path is correct and try again.
At line:1 char:1
+ RUSTFLAGS='-C target-feature=+crt-static' cargo build --target x86_64 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (RUSTFLAGS=-C target-feature=+crt-static:String) [], CommandNotFoundExce
ption
+ FullyQualifiedErrorId : CommandNotFoundException
The best way to do it that works with both cmd and PowerShell is set:
However, this is equivalent to export in /bin/sh, and will persist until the shell is closed.
Note also that you must not specify quotes here, otherwise it will break in cmd (because the environment variable includes those quotation marks):
error: failed to run `rustc` to learn about target-specific information
Caused by:
process didn't exit successfully: `rustc - --crate-name ___ --print=file-names '-C target-feature=+crt-static' --target x86_64-pc-windows-msvc --crate-type bin --crate-type rlib --crate-type dylib --crate-type cdylib --crate-type staticlib --crate-type proc-macro --print=sysroot --print=cfg` (exit code: 1)
--- stderr
error: multiple input filenames provided (first two filenames are `-` and `'-C`)
The only way that the present instructions could work with MSVC on Windows is with msys version of bash. However, that environment is generally geared towards *-pc-windows-gnu, which doesn't need the crt-static feature AFAIK.
From https://rust-lang.github.io/rfcs/1721-crt-static.html#lazy-link-attributes
When you try to actually enter this into a Windows
cmd
prompt, you get back:Similarly in PowerShell:
The best way to do it that works with both
cmd
and PowerShell isset
:However, this is equivalent to
export
in/bin/sh
, and will persist until the shell is closed.Note also that you must not specify quotes here, otherwise it will break in
cmd
(because the environment variable includes those quotation marks):The only way that the present instructions could work with MSVC on Windows is with msys version of bash. However, that environment is generally geared towards
*-pc-windows-gnu
, which doesn't need thecrt-static
feature AFAIK.Previously pointed out in rust-lang/cargo#1137 (comment) and rust-cli/team#34
The text was updated successfully, but these errors were encountered: