about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFolkert de Vries <folkert@folkertdev.nl>2025-04-21 16:18:07 +0200
committerAmanieu d'Antras <amanieu@gmail.com>2025-04-23 10:38:19 +0000
commite0b634ecaefbc0dd5bdc5fdbbdc15b34328d20ce (patch)
treed29b691dcf955a29134626da59ab0ae6fdef57d4
parenta4ddd6c5ff819dc7b97428ff5c029b145dc7474f (diff)
downloadrust-e0b634ecaefbc0dd5bdc5fdbbdc15b34328d20ce.tar.gz
rust-e0b634ecaefbc0dd5bdc5fdbbdc15b34328d20ce.zip
reset the host linker
The host's linker is used to compile build.rs files (e.g. for libc).
When the user configures a custom liker (e.g. mold) in their own
.cargo/config.toml or ~/.cargo/config.toml, that linker will likely not
work when running run-docker.sh. So, we now reset it to `cc`, which
should always be installed in the docker container.
-rwxr-xr-xlibrary/stdarch/ci/run-docker.sh6
1 files changed, 6 insertions, 0 deletions
diff --git a/library/stdarch/ci/run-docker.sh b/library/stdarch/ci/run-docker.sh
index 0958bc8e67b..af83a32ecae 100755
--- a/library/stdarch/ci/run-docker.sh
+++ b/library/stdarch/ci/run-docker.sh
@@ -11,6 +11,11 @@ if [ $# -lt 1 ]; then
 fi
 
 run() {
+    # Set the linker that is used for the host (e.g. when compiling a build.rs)
+    # This overrides any configuration in e.g. `.cargo/config.toml`, which will
+    # probably not work within the docker container.
+    HOST_LINKER="CARGO_TARGET_$(rustc --print host-tuple | tr '[:lower:]-' '[:upper:]_')_LINKER"
+
     # Prevent `Read-only file system (os error 30)`.
     cargo generate-lockfile
 
@@ -25,6 +30,7 @@ run() {
       --env CARGO_HOME=/cargo \
       --env CARGO_TARGET_DIR=/checkout/target \
       --env TARGET="${1}" \
+      --env "${HOST_LINKER}"="cc" \
       --env STDARCH_TEST_EVERYTHING \
       --env STDARCH_DISABLE_ASSERT_INSTR \
       --env NOSTD \