Skip to content

Commit 9407260

Browse files
committed
Discover target triple
The dev desktops are deployed to machines with different architectures (amd64 and arm64), which makes it necessary to discover the target triple when linking the stages. The current solution was chosen based on the following Stack Overflow post: https://stackoverflow.com/questions/52996949/how-can-i-find-the-current-rust-compilers-default-llvm-target-triple
1 parent 19edc68 commit 9407260

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

ansible/roles/dev-desktop/files/scripts/link_rust.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,21 @@
55
set -euo pipefail
66
IFS=$'\n\t'
77

8+
# Discover target triple (e.g. "aarch64-unknown-linux-gnu")
9+
target="$(rustc -vV | awk '/host/ { print $2 }')"
10+
811
for D in rust*; do
912
if [ -d "${D}" ]; then
1013
pushd "${D}"
1114

1215
./x.py build
1316

14-
if [[ -d "$D/build/aarch64-unknown-linux-gnu/stage1" ]]; then
15-
rustup toolchain link "$D"_stage1 "$D/build/aarch64-unknown-linux-gnu/stage1"
17+
if [[ -d "$D/build/$target/stage1" ]]; then
18+
rustup toolchain link "$D"_stage1 "$D/build/$target/stage1"
1619
fi
1720

18-
if [[ -d "$D/build/aarch64-unknown-linux-gnu/stage2" ]]; then
19-
rustup toolchain link "$D"_stage2 "$D/build/aarch64-unknown-linux-gnu/stage2"
21+
if [[ -d "$D/build/$target/stage2" ]]; then
22+
rustup toolchain link "$D"_stage2 "$D/build/$target/stage2"
2023
fi
2124

2225
popd

0 commit comments

Comments
 (0)