Reputation: 41
I have this as my ./cargo/config:
[target.aarch64-unknown-linux-gnu]
linker = "aarch64-none-linux-gnu-gcc"
rustflags = ["-C", "target-feature=+crt-static"]
I have defined RUSTFLAGS in build.sh like so:
export RUSTFLAGS='--cfg chip_type="es"'
When I do:
cargo build --target=aarch64-unknown-linux-gnu
I find that the "-C", "target-feature=+crt-static"
is not included. How do I solve this problem?
Upvotes: 3
Views: 804
Reputation: 41
As can be seen from Cargo Configuration on build.rustflags
:
There are three mutually exclusive sources of extra flags. They are checked in order, with the first one being used:
RUSTFLAGS
environment variable.All matching
target.<triple>.rustflags
andtarget.<cfg>.rustflags
config entries joined together.
build.rustflags
config value.
So this new build.sh
code solves my problem:
RUSTFLAGS='--cfg chip_type="es" '$RUSTFLAGS
RUSTFLAGS='-C target-feature=+crt-static '$RUSTFLAGS
export RUSTFLAGS
Upvotes: 1