Skip to content

Commit

Permalink
build for arm
Browse files Browse the repository at this point in the history
  • Loading branch information
iker-barriocanal committed Aug 1, 2023
1 parent a333ee2 commit a0f470b
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"
rustflags = ["-C", "target-feature=+crt-static", "-C", "link-arg=-lgcc"]
31 changes: 30 additions & 1 deletion .github/workflows/build_binary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ env:

jobs:
linux:
name: Linux
name: Linux x86
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
4 changes: 3 additions & 1 deletion scripts/docker-build-linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit a0f470b

Please sign in to comment.