Skip to content

Commit

Permalink
Ensure cargo uses correct linker when cross-compiling
Browse files Browse the repository at this point in the history
  • Loading branch information
lovell committed Aug 10, 2024
1 parent dc8d356 commit 82bee8f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions build/lin.sh
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ export CARGO_PROFILE_RELEASE_PANIC=abort
# https://reproducible-builds.org/docs/build-path/
export RUSTFLAGS+=" --remap-path-prefix=$CARGO_HOME/registry/="

# Ensure Cargo uses correct linker when cross-compiling
if [ "$LINUX" = true ] && [ -n "$CHOST" ]; then
echo "[target.${RUST_TARGET}]" >> "$CARGO_HOME/config"
echo "linker = \"${CHOST}-gcc\"" >> "$CARGO_HOME/config"
fi

# We don't want to use any native libraries, so unset PKG_CONFIG_PATH
unset PKG_CONFIG_PATH

Expand Down

0 comments on commit 82bee8f

Please sign in to comment.