Compilation fails on Windows with GNU toolchain
On Windows, with the MSVC toolchain, no issue. With the GNU toolchain, I get an error. Does it require a separate installation of Mingw that includes gcc?
So, more specifically
* `rustup default stable-x86_64-pc-windows-msvc` works
* `rustup default stable-x86_64-pc-windows-gnu` gives the error below
```
Microsoft Windows [Version 10.0.19045.5487]
(c) Microsoft Corporation. All rights reserved.
D:\projects\rust\_clones\stacker>cargo build
Compiling cfg-if v1.0.0
Compiling psm v0.1.25 (D:\projects\rust\_clones\stacker\psm)
Compiling stacker v0.1.19 (D:\projects\rust\_clones\stacker)
Compiling windows_x86_64_gnu v0.52.6
Compiling libc v0.2.171
Compiling windows-targets v0.52.6
Compiling windows-sys v0.59.0
warning: stacker@0.1.19: Compiler family detection failed due to error: ToolNotFound: failed to find tool "gcc.exe": program not found (see https://docs.rs/cc/latest/cc/#compile-time-requirements for help)
error: failed to run custom build command for `stacker v0.1.19 (D:\projects\rust\_clones\stacker)`
Caused by:
process didn't exit successfully: `D:\projects\rust\_clones\stacker\target\debug\build\stacker-9b86e9bdd73208ee\build-script-build` (exit code: 1)
--- stdout
OUT_DIR = Some(D:\projects\rust\_clones\stacker\target\debug\build\stacker-f050fe67fe900bca\out)
OPT_LEVEL = Some(0)
TARGET = Some(x86_64-pc-windows-gnu)
HOST = Some(x86_64-pc-windows-gnu)
cargo:rerun-if-env-changed=CC_x86_64-pc-windows-gnu
CC_x86_64-pc-windows-gnu = None
cargo:rerun-if-env-changed=CC_x86_64_pc_windows_gnu
CC_x86_64_pc_windows_gnu = None
cargo:rerun-if-env-changed=HOST_CC
HOST_CC = None
cargo:rerun-if-env-changed=CC
CC = None
cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
cargo:warning=Compiler family detection failed due to error: ToolNotFound: failed to find tool "gcc.exe": program not found (see https://docs.rs/cc/latest/cc/#compile-time-requirements for help)
RUSTC_WRAPPER = None
cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some(true)
CARGO_CFG_TARGET_FEATURE = Some(cmpxchg16b,fxsr,sse,sse2,sse3)
cargo:rerun-if-env-changed=CFLAGS
CFLAGS = None
cargo:rerun-if-env-changed=HOST_CFLAGS
HOST_CFLAGS = None
cargo:rerun-if-env-changed=CFLAGS_x86_64_pc_windows_gnu
CFLAGS_x86_64_pc_windows_gnu = None
cargo:rerun-if-env-changed=CFLAGS_x86_64-pc-windows-gnu
CFLAGS_x86_64-pc-windows-gnu = None
CARGO_ENCODED_RUSTFLAGS = Some()
--- stderr
error occurred in cc-rs: failed to find tool "gcc.exe": program not found (see https://docs.rs/cc/latest/cc/#compile-time-requirements for help)
warning: build failed, waiting for other jobs to finish...
warning: psm@0.1.25: Compiler family detection failed due to error: ToolNotFound: failed to find tool "gcc.exe": program not found (see https://docs.rs/cc/latest/cc/#compile-time-requirements for help)
warning: psm@0.1.25: Compiler family detection failed due to error: ToolNotFound: failed to find tool "gcc.exe": program not found (see https://docs.rs/cc/latest/cc/#compile-time-requirements for help)
error: failed to run custom build command for `psm v0.1.25 (D:\projects\rust\_clones\stacker\psm)`
Caused by:
process didn't exit successfully: `D:\projects\rust\_clones\stacker\target\debug\build\psm-fb2b73dd4fd8303e\build-script-build` (exit code: 1)
--- stdout
cargo:rustc-check-cfg=cfg(switchable_stack,asm,link_asm)
OPT_LEVEL = Some(0)
OUT_DIR = Some(D:\projects\rust\_clones\stacker\target\debug\build\psm-b519261e4261083d\out)
TARGET = Some(x86_64-pc-windows-gnu)
HOST = Some(x86_64-pc-windows-gnu)
cargo:rerun-if-env-changed=CC_x86_64-pc-windows-gnu
CC_x86_64-pc-windows-gnu = None
cargo:rerun-if-env-changed=CC_x86_64_pc_windows_gnu
CC_x86_64_pc_windows_gnu = None
cargo:rerun-if-env-changed=HOST_CC
HOST_CC = None
cargo:rerun-if-env-changed=CC
CC = None
cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
cargo:warning=Compiler family detection failed due to error: ToolNotFound: failed to find tool "gcc.exe": program not found (see https://docs.rs/cc/latest/cc/#compile-time-requirements for help)
RUSTC_WRAPPER = None
cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some(true)
CARGO_CFG_TARGET_FEATURE = Some(cmpxchg16b,fxsr,sse,sse2,sse3)
cargo:rerun-if-env-changed=CFLAGS
CFLAGS = None
cargo:rerun-if-env-changed=HOST_CFLAGS
HOST_CFLAGS = None
cargo:rerun-if-env-changed=CFLAGS_x86_64_pc_windows_gnu
CFLAGS_x86_64_pc_windows_gnu = None
cargo:rerun-if-env-changed=CFLAGS_x86_64-pc-windows-gnu
CFLAGS_x86_64-pc-windows-gnu = None
CARGO_ENCODED_RUSTFLAGS = Some()
cargo:rustc-cfg=asm
cargo:rustc-cfg=link_asm
cargo:warning=Compiler family detection failed due to error: ToolNotFound: failed to find tool "gcc.exe": program not found (see https://docs.rs/cc/latest/cc/#compile-time-requirements for help)
--- stderr
error occurred in cc-rs: failed to find tool "gcc.exe": program not found (see https://docs.rs/cc/latest/cc/#compile-time-requirements for help)
D:\projects\rust\_clones\stacker>
```
关闭于 2025-04-25 3 条评论