Skip to content

Commit

Permalink
Cross-compile to linux-aarch64 from linux-x64 in GitHub actions.
Browse files Browse the repository at this point in the history
This commit adds a new CI job called `linux_aarch64`.
This new job builds OpenSSL 3.1, liboqs and oqs-provider for linux-aarch64 (`elf64-littleaarch64`).
  • Loading branch information
thb-sb committed Sep 11, 2023
1 parent 6fb3b64 commit 462c31f
Showing 1 changed file with 83 additions and 0 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,86 @@ jobs:
- name: Run tests
run: ctest --test-dir build --output-on-failure

linux_aarch64:
name: "aarch64 cross-compilation"
runs-on: ubuntu-latest
strategy:
fail-fast: false
container:
image: openquantumsafe/ci-ubuntu-jammy:latest
env:
OPENSSL_BRANCH: "master"
INSTALL_DIR: "/opt/install"
CMAKE_TOOLCHAIN_FILE: "/opt/linux-aarch64-toolchain.cmake"

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install dependencies
run: apt-get update && apt-get install -y ninja-build git cmake nodejs gcc-aarch64-linux-gnu libc6-dev-arm64-cross

- name: Prepare install directory
run: mkdir -p "${INSTALL_DIR}"

- name: Clone and build OpenSSL(3) for linux-aarch64
working-directory: /opt/
run: |
git clone --depth=1 --branch "${OPENSSL_BRANCH}" https://github.com/openssl/openssl.git openssl
cd openssl
./Configure linux-aarch64 no-tests --prefix="${INSTALL_DIR}" \
--openssldir="${INSTALL_DIR}" \
--cross-compile-prefix=aarch64-linux-gnu- \
--release
make -j$(nproc)
make install_sw
cd ..
- name: Write CMake toolchain file for liboqs and oqs-provider
run: |
echo "set(CMAKE_SYSTEM_NAME Linux) \n
set(CMAKE_SYSTEM_PROCESSOR aarch64) \n
set(CMAKE_C_COMPILER "/usr/bin/aarch64-linux-gnu-gcc")\n" > "${CMAKE_TOOLCHAIN_FILE}"
- name: Clone and build liboqs for linux-aarch64
working-directory: /opt/
run: |
git clone --depth=1 --branch main https://github.com/open-quantum-safe/liboqs.git liboqs
cd liboqs
mkdir build install
cmake --toolchain "${CMAKE_TOOLCHAIN_FILE}" \
-GNinja -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
-DOQS_USE_OPENSSL=OFF
cmake --build build -j$(nproc)
cmake --install build
cd ..
- name: Build oqs-provider for linux-aarch64
run: |
cmake --toolchain "${CMAKE_TOOLCHAIN_FILE}" \
-GNinja -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}" \
-DOPENSSL_ROOT_DIR="${INSTALL_DIR}" \
-Dliboqs_DIR="${INSTALL_DIR}/lib/cmake/liboqs"
cmake --build build -j$(nproc)
cmake --install build
cd ..
- name: Verify that binaries and libraries are built for linux-aarch64.
run: |
if ! aarch64-linux-gnu-objdump -a "${INSTALL_DIR}/lib/ossl-modules/oqsprovider.so" | grep -q elf64-littleaarch64; then
echo "File hasn't been built for linux-aarch64"
exit 1
fi
- name: Build .deb install package
run: cpack
working-directory: build
- name: Retain .deb installer
uses: actions/upload-artifact@v3
with:
name: oqsprovider-aarch64
path: build/*.deb

0 comments on commit 462c31f

Please sign in to comment.