From 15305c272f19324e507485d99104d053de258e62 Mon Sep 17 00:00:00 2001 From: David Rusu Date: Sun, 7 Jun 2026 11:55:04 -0400 Subject: [PATCH] fix(ci): build arm64 with TARGET_PLATFORM=aarch64 (use AArch64 asm, not x86 nasm) The default cmake config selects the x86_64 nasm field-arithmetic asm, which produced x86_64 objects inside the arm64 archive (mixed-arch, unlinkable). Pass TARGET_PLATFORM=aarch64 so the AArch64 .s sources are used, and add an architecture guard that fails the build on a mismatch. Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/build-pic-archives.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/build-pic-archives.yml b/.github/workflows/build-pic-archives.yml index 107697e..058aa05 100644 --- a/.github/workflows/build-pic-archives.yml +++ b/.github/workflows/build-pic-archives.yml @@ -35,9 +35,13 @@ jobs: - arch: x86_64 runner: ubuntu-latest slug: rapidsnark-linux-x86_64-pic + # Empty => cmake defaults to the x86_64 field-arithmetic asm (nasm). + target_platform: "" - arch: arm64 runner: ubuntu-22.04-arm slug: rapidsnark-linux-arm64-pic + # aarch64 => cmake uses the AArch64 .s field arithmetic, not x86 nasm. + target_platform: "aarch64" runs-on: ${{ matrix.runner }} # Build inside a glibc-2.35 image so the archives stay compatible with older # glibc hosts (avoids the __isoc23_* / newer-GLIBCXX symbol requirements). @@ -64,7 +68,12 @@ jobs: cd rs git submodule update --init --depth 1 depends/ffiasm depends/json mkdir bp && cd bp + PLATFORM_ARG="" + if [ -n "${{ matrix.target_platform }}" ]; then + PLATFORM_ARG="-DTARGET_PLATFORM=${{ matrix.target_platform }}" + fi cmake .. \ + $PLATFORM_ARG \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ -DUSE_ASM=ON \ @@ -72,6 +81,16 @@ jobs: -DUSE_LOGGER=ON make -j"$(nproc)" rapidsnarkStatic fr fq + - name: Verify archive architecture + run: | + fmt=$(objdump -f rs/bp/src/libfr.a | grep -m1 'file format') + echo "libfr.a -> $fmt" + case "${{ matrix.arch }}" in + x86_64) echo "$fmt" | grep -q 'elf64-x86-64' || { echo "::error::expected x86-64 objects"; exit 1; } ;; + arm64) echo "$fmt" | grep -q 'elf64-littleaarch64' || { echo "::error::expected aarch64 objects"; exit 1; } ;; + esac + echo "architecture OK for ${{ matrix.arch }}" + - name: Package archives run: | NAME="${{ matrix.slug }}-${RAPIDSNARK_VERSION}"