diff --git a/scripts/setup-cross-compilation.sh b/scripts/setup-cross-compilation.sh index 5f877cbe..1c01db4a 100755 --- a/scripts/setup-cross-compilation.sh +++ b/scripts/setup-cross-compilation.sh @@ -1,9 +1,11 @@ #!/bin/bash -set -euo pipefail +set -euox pipefail TARGETARCH="$1" BUILDARCH="$2" +apt-get update + if [ "$TARGETARCH" = "$BUILDARCH" ]; then # Native build rustup target list --installed > /tmp/TARGET @@ -16,24 +18,15 @@ elif [ "$TARGETARCH" = "arm64" ]; then echo "aarch64-unknown-linux-gnu" > /tmp/TARGET echo "aarch64-linux-gnu-gcc" > /tmp/LINKER - apt-get update apt-get install -y gcc-aarch64-linux-gnu libgcc-s1-arm64-cross pkg-config LIBDIR="/usr/aarch64-linux-gnu/lib" - - # Also install gcc for aarch64 to get libgcc - apt-get install -y gcc-aarch64-linux-gnu - elif [ "$TARGETARCH" = "arm" ]; then echo "armv7-unknown-linux-gnueabihf" > /tmp/TARGET echo "arm-linux-gnueabihf-gcc" > /tmp/LINKER - apt-get update apt-get install -y gcc-arm-linux-gnueabihf libgcc-s1-armhf-cross cmake libclang1 clang pkg-config - # Ensure gcc-arm-linux-gnueabihf is available - apt-get install -y gcc-arm-linux-gnueabihf - cargo install --force --locked bindgen-cli SYSROOT=$(arm-linux-gnueabihf-gcc -print-sysroot)