Skip to content

Commit 6965309

Browse files
committed
fix devtool build for musl on aarch64
Since we are using the --target for builiding, rustc will consider it a cross compilation. Thus, on a aarch64 machie will try to look for the aarch64-linux-musl-gcc binary. Give cargo the path to musl-gcc in such scenario. Signed-off-by: Diana Popa <[email protected]>
1 parent 73b6c60 commit 6965309

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tools/devtool

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,14 @@ cmd_build() {
438438
# Cargo uses the debug profile by default. If we're building the release
439439
# binaries, we need to pass an extra argument to cargo.
440440
cargo_args=("$@")
441+
442+
# When musl build is triggered, make sure that cargo finds the path to
443+
# the musl-gcc binary.
444+
TARGET_CC=""
445+
if [[ ${cargo_args[@]} = *"musl"* ]]; then
446+
TARGET_CC=/usr/bin/musl-gcc
447+
fi
448+
441449
[ $profile = "release" ] && cargo_args+=("--release")
442450

443451
# Run the cargo build process inside the container.
@@ -446,6 +454,7 @@ cmd_build() {
446454
run_devctr \
447455
--user "$(id -u):$(id -g)" \
448456
--workdir "$CTR_FC_ROOT_DIR" \
457+
--env TARGET_CC=$TARGET_CC \
449458
-- \
450459
cargo build \
451460
--target-dir "${CTR_CARGO_TARGET_DIR}" \

0 commit comments

Comments
 (0)