Skip to content

Commit 82bee8f

Browse files
committed
Ensure cargo uses correct linker when cross-compiling
1 parent dc8d356 commit 82bee8f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

build/lin.sh

+6
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@ export CARGO_PROFILE_RELEASE_PANIC=abort
8585
# https://reproducible-builds.org/docs/build-path/
8686
export RUSTFLAGS+=" --remap-path-prefix=$CARGO_HOME/registry/="
8787

88+
# Ensure Cargo uses correct linker when cross-compiling
89+
if [ "$LINUX" = true ] && [ -n "$CHOST" ]; then
90+
echo "[target.${RUST_TARGET}]" >> "$CARGO_HOME/config"
91+
echo "linker = \"${CHOST}-gcc\"" >> "$CARGO_HOME/config"
92+
fi
93+
8894
# We don't want to use any native libraries, so unset PKG_CONFIG_PATH
8995
unset PKG_CONFIG_PATH
9096

0 commit comments

Comments
 (0)