Skip to content

Commit

Permalink
add build support for aarch64 linux binary (deislabs#328)
Browse files Browse the repository at this point in the history
  • Loading branch information
VishnuJin authored and vdice committed Dec 7, 2022
1 parent 46616eb commit e372ff7
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .cargo/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"
41 changes: 39 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ jobs:
env: {},
targetPath: "target/release/",
}
- {
os: "ubuntu-latest",
arch: "aarch64",
extension: "",
env: { OPENSSL_DIR: "/usr/local/openssl-aarch64" },
targetPath: "target/aarch64-unknown-linux-gnu/release/",
}
- {
os: "macos-latest",
arch: "amd64",
Expand Down Expand Up @@ -68,15 +75,38 @@ jobs:
default: true
components: clippy, rustfmt

- name: setup for cross-compile builds
if: matrix.config.arch == 'aarch64' && matrix.config.os == 'ubuntu-latest'
run: |
sudo apt install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
cd /tmp
git clone https://github.com/openssl/openssl
cd openssl
git checkout OpenSSL_1_1_1l
sudo mkdir -p $OPENSSL_DIR
./Configure linux-aarch64 --prefix=$OPENSSL_DIR --openssldir=$OPENSSL_DIR shared
make CC=aarch64-linux-gnu-gcc
sudo make install
rustup target add aarch64-unknown-linux-gnu
- name: Install latest Rust stable toolchain
uses: actions-rs/toolchain@v1
if: matrix.config.arch == 'aarch64'
if: matrix.config.arch == 'aarch64' && matrix.config.os == 'macos-latest'
with:
toolchain: stable
default: true
components: clippy, rustfmt
target: aarch64-apple-darwin

- name: Install latest Rust stable toolchain
uses: actions-rs/toolchain@v1
if: matrix.config.arch == 'aarch64' && matrix.config.os == 'ubuntu-latest'
with:
toolchain: stable
default: true
components: clippy, rustfmt
target: aarch64-unknown-linux-gnu

- name: build release
uses: actions-rs/cargo@v1
if: matrix.config.arch != 'aarch64'
Expand All @@ -86,11 +116,18 @@ jobs:

- name: build release
uses: actions-rs/cargo@v1
if: matrix.config.arch == 'aarch64'
if: matrix.config.arch == 'aarch64' && matrix.config.os == 'macos-latest'
with:
command: build
args: "--all-features --release --target aarch64-apple-darwin"

- name: build release
uses: actions-rs/cargo@v1
if: matrix.config.arch == 'aarch64' && matrix.config.os == 'ubuntu-latest'
with:
command: build
args: "--all-features --release --target aarch64-unknown-linux-gnu"

- name: package release assets
shell: bash
run: |
Expand Down

0 comments on commit e372ff7

Please sign in to comment.