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
I'm working on an embedded Rust project. In order to be able to run it using cargo run, I use the target.<triplet>.runner attribute in .cargo/config.toml to launch an emulator. The target also used to be set in config.toml.
Recently, in order to use the xtask pattern, I decided to try out the per-package-target feature (#9406). I removed the target from config.toml and added a forced-target field to my Cargo.toml. Unfortunately, now cargo no longer executes my runner, instead trying to execute the binary directly (which, of course, doesn't work).
Cargo is building for the correct target, but for some reason not taking this into account when deciding whether or not to use the runner. Manually passing the --target option solves this issue, but that's exactly what I'm trying to avoid by using this feature.
Steps
Create a #![no_std] project for a different target triplet
Specify a runner for this triplet in .cargo/config.toml
Use the per-package-target cargo feature and the default-target or forced-target keys in Cargo.toml to specify the triplet
cargo run without a --target option
Observe that cargo is building for the correct triplet, but not using the runner.
Possible Solution(s)
There are multiple other issues (e.g. the -Zbuild-std one in #9451) that suggest cargo assumes it's building for the host during various stages of the build if no --target flag is passed. I don't know enough about the internals of cargo to tell if this is what's happening here.
Notes
No response
Version
cargo 1.63.0-nightly (8d42b0e87 2022-06-17)
The text was updated successfully, but these errors were encountered:
Problem
I'm working on an embedded Rust project. In order to be able to run it using
cargo run
, I use thetarget.<triplet>.runner
attribute in.cargo/config.toml
to launch an emulator. The target also used to be set in config.toml.Recently, in order to use the xtask pattern, I decided to try out the
per-package-target
feature (#9406). I removed the target from config.toml and added aforced-target
field to my Cargo.toml. Unfortunately, now cargo no longer executes my runner, instead trying to execute the binary directly (which, of course, doesn't work).Cargo is building for the correct target, but for some reason not taking this into account when deciding whether or not to use the runner. Manually passing the
--target
option solves this issue, but that's exactly what I'm trying to avoid by using this feature.Steps
#![no_std]
project for a different target triplet.cargo/config.toml
per-package-target
cargo feature and thedefault-target
orforced-target
keys in Cargo.toml to specify the tripletcargo run
without a--target
optionPossible Solution(s)
There are multiple other issues (e.g. the
-Zbuild-std
one in #9451) that suggest cargo assumes it's building for the host during various stages of the build if no--target
flag is passed. I don't know enough about the internals of cargo to tell if this is what's happening here.Notes
No response
Version
The text was updated successfully, but these errors were encountered: