I have a little problem with my GitHub actions. It tries to build the stdlib for nightly-x86_64-unknown-linux-gnu
but The target specified in rust-toolchain.toml is x86_64-unknown-none
. Link to the action: HexiumOS/Hexium/actions/runs/14007145392/job/39222479504
the toolchain file specifies which targets to install, i.e. it corresponds to rustup target add <TARGET>
. it does NOT affect which targets to build by cargo
.
to specify the build target for cargo
, you either use command line flags (e.g. ), e.g. cargo build --target <TARGET>
, or you add a build.target
configuration, e.g.
# .cargo/config.toml
[build]
target = ["TARGET-TRIPLE1", "TARGET-TRIPLE2"]
the error message is not telling you it was building for the x86_64-unknown-linux-gnu
target, it means it was trying to build the standard library using the source code installed with the nightly-
toolchain, but the source code is not installed.
you should add the rust-src
component to the toolchain file, e.g.
# rust-toolchain.toml
[toolchain]
profile = "default"
components = ["rust-src"]
see: