From d5f14ab761de0fb2e975a99d8466bd5f6a7a4943 Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Wed, 13 Oct 2021 12:12:02 +0200 Subject: [PATCH] Makefile & Cross.toml hack to work around an aarch64 cross-compilation issue (https://github.com/rust-embedded/cross/issues/598) --- Cross.toml | 6 ++++++ Makefile | 9 +++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 Cross.toml diff --git a/Cross.toml b/Cross.toml new file mode 100644 index 0000000..86caa02 --- /dev/null +++ b/Cross.toml @@ -0,0 +1,6 @@ +[build.env] +# Both of these are needed to workaround https://github.com/rust-embedded/cross/issues/598 +passthrough = [ + "RUSTFLAGS", + "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS", +] diff --git a/Makefile b/Makefile index 79e1fcf..0a7a631 100644 --- a/Makefile +++ b/Makefile @@ -64,10 +64,15 @@ arm-binary-release: arm-binary-debug: cross build --target=armv7-unknown-linux-musleabihf --all-targets --features vendored-openssl +# Hack to workaround https://github.com/rust-embedded/cross/issues/598 +HACK_WORKAROUND_ISSUE_598=CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-C link-arg=/usr/local/aarch64-linux-musl/lib/libc.a" + aarch64-binary: aarch64-binary-release aarch64-binary-release: - cross build --target=aarch64-unknown-linux-musl --release --all-targets --features vendored-openssl + $(HACK_WORKAROUND_ISSUE_598) \ + cross build --target=aarch64-unknown-linux-musl --release --all-targets --features vendored-openssl aarch64-binary-debug: - cross build --target=aarch64-unknown-linux-musl --all-targets --features vendored-openssl + $(HACK_WORKAROUND_ISSUE_598) \ + cross build --target=aarch64-unknown-linux-musl --all-targets --features vendored-openssl