diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 00000000000..e403b791586 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,3 @@ +[target.aarch64-unknown-linux-gnu] +linker = "aarch64-linux-gnu-gcc" +rustflags = ["-C", "target-feature=+crt-static", "-C", "link-arg=-lgcc"] diff --git a/.github/workflows/build_binary.yml b/.github/workflows/build_binary.yml index bd80edf42b0..a0d3e2791cc 100644 --- a/.github/workflows/build_binary.yml +++ b/.github/workflows/build_binary.yml @@ -10,7 +10,7 @@ env: jobs: linux: - name: Linux + name: Linux x86 runs-on: ubuntu-latest steps: @@ -38,6 +38,35 @@ jobs: name: ${{ github.sha }} path: target/x86_64-unknown-linux-gnu/release/relay-Linux-x86_64* + linux_arm: + name: Linux ARM + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Build in Docker + run: | + # Get the latest stable rust toolchain version available + TOOLCHAIN=$(curl -s 'https://static.rust-lang.org/dist/channel-rust-stable.toml' | awk '/\[pkg.rust\]/ {getline;print;}' | sed -r 's/^version = "([0-9.]+) .*/\1/') + scripts/docker-build-linux.sh "$TOOLCHAIN" + env: + BUILD_ARCH: aarch64 + RELAY_FEATURES: + + - name: Bundle Debug File + run: | + cd target/aarch64-unknown-linux-gnu/release/ + zip relay-Linux-aarch64-debug.zip relay.debug + mv relay relay-Linux-aarch64 + + - uses: actions/upload-artifact@v3 + with: + name: ${{ github.sha }} + path: target/aarch64-unknown-linux-gnu/release/relay-Linux-aarch64* + macos: name: macOS runs-on: macos-11 diff --git a/Dockerfile b/Dockerfile index 171ea556aee..249f8ba2a7a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,7 @@ ENV RUST_TOOLCHAIN_VERSION=${RUST_TOOLCHAIN_VERSION} RUN yum -y update \ && yum -y install centos-release-scl epel-release \ # install a modern compiler toolchain - && yum -y install cmake3 devtoolset-10 git \ + && yum -y install cmake3 devtoolset-10 git aarch64-linux-gnu-gcc \ # below required for sentry-native llvm-toolset-7.0-clang-devel \ && yum clean all \ diff --git a/scripts/docker-build-linux.sh b/scripts/docker-build-linux.sh index 86caa12f78e..6d2336661ec 100755 --- a/scripts/docker-build-linux.sh +++ b/scripts/docker-build-linux.sh @@ -3,7 +3,9 @@ set -eux TOOLCHAIN=$1 -if [ "${BUILD_ARCH}" = "x86_64" ]; then +if [ "${BUILD_ARCH}" = "aarch64" ]; then + DOCKER_ARCH="arm64" +elif [ "${BUILD_ARCH}" = "x86_64" ]; then DOCKER_ARCH="amd64" elif [ "${BUILD_ARCH}" = "i686" ]; then DOCKER_ARCH="i386"