From 8ba1bc76214e5508170ddb4f0176f4eb6a9512fc Mon Sep 17 00:00:00 2001 From: Michael Zhao Date: Wed, 2 Mar 2022 20:05:35 +0800 Subject: [PATCH] scripts: Fix musl build error in AArch64 unit test Signed-off-by: Michael Zhao --- scripts/run_unit_tests.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/run_unit_tests.sh b/scripts/run_unit_tests.sh index 972006703..42b8f62fa 100755 --- a/scripts/run_unit_tests.sh +++ b/scripts/run_unit_tests.sh @@ -12,5 +12,11 @@ if [[ $(uname -m) = "aarch64" || $hypervisor = "mshv" ]]; then cargo_args+=("--no-default-features") cargo_args+=("--features $hypervisor") fi + +if [[ "${BUILD_TARGET}" == "aarch64-unknown-linux-musl" ]]; then + export TARGET_CC="musl-gcc" + export RUSTFLAGS="-C link-arg=-lgcc -C link_arg=-specs -C link_arg=/usr/lib/aarch64-linux-musl/musl-gcc.specs" +fi + export RUST_BACKTRACE=1 cargo test --lib --bins --target $BUILD_TARGET --workspace ${cargo_args[@]} || exit 1;