diff --git a/common/build-helper/rust.sh b/common/build-helper/rust.sh index 6fcd3bd7d9e..431cb5f0fd4 100644 --- a/common/build-helper/rust.sh +++ b/common/build-helper/rust.sh @@ -17,6 +17,12 @@ if [ "$CROSS_BUILD" ]; then # [build] # target = ${RUST_TARGET} export CARGO_BUILD_TARGET="$RUST_TARGET" + + # If cc-rs needs to build host binaries, it guesses the compiler and + # uses default (wrong) flags unless they are specified explicitly; + # innocuous flags are used here just to disable its defaults + export HOST_CC="gcc" + export HOST_CFLAGS="-O2" else unset CARGO_BUILD_TARGET fi