Skip to content

Commit 0bd5a06

Browse files
committed
scripts: enhance cross-compilation setup by adding apt-get update and removing redundant installations
1 parent b278764 commit 0bd5a06

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

scripts/setup-cross-compilation.sh

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
#!/bin/bash
2-
set -euo pipefail
2+
set -euox pipefail
33

44
TARGETARCH="$1"
55
BUILDARCH="$2"
66

7+
apt-get update
8+
79
if [ "$TARGETARCH" = "$BUILDARCH" ]; then
810
# Native build
911
rustup target list --installed > /tmp/TARGET
@@ -16,24 +18,15 @@ elif [ "$TARGETARCH" = "arm64" ]; then
1618
echo "aarch64-unknown-linux-gnu" > /tmp/TARGET
1719
echo "aarch64-linux-gnu-gcc" > /tmp/LINKER
1820

19-
apt-get update
2021
apt-get install -y gcc-aarch64-linux-gnu libgcc-s1-arm64-cross pkg-config
2122

2223
LIBDIR="/usr/aarch64-linux-gnu/lib"
23-
24-
# Also install gcc for aarch64 to get libgcc
25-
apt-get install -y gcc-aarch64-linux-gnu
26-
2724
elif [ "$TARGETARCH" = "arm" ]; then
2825
echo "armv7-unknown-linux-gnueabihf" > /tmp/TARGET
2926
echo "arm-linux-gnueabihf-gcc" > /tmp/LINKER
3027

31-
apt-get update
3228
apt-get install -y gcc-arm-linux-gnueabihf libgcc-s1-armhf-cross cmake libclang1 clang pkg-config
3329

34-
# Ensure gcc-arm-linux-gnueabihf is available
35-
apt-get install -y gcc-arm-linux-gnueabihf
36-
3730
cargo install --force --locked bindgen-cli
3831

3932
SYSROOT=$(arm-linux-gnueabihf-gcc -print-sysroot)

0 commit comments

Comments
 (0)