From 308c9fbeb5b924661ab862f7f06ad3744cf0e471 Mon Sep 17 00:00:00 2001 From: Gene Hoffman Date: Mon, 23 Feb 2026 13:08:25 -0800 Subject: [PATCH 1/5] Add Ubuntu ARM64 support for vdf-client HW CI and packaging. This updates Linux FT4222 path selection for arm64 and extends the HW workflow to build, test, and publish architecture-specific Ubuntu artifacts for both amd64 and arm64 runners. Co-authored-by: Cursor --- .github/workflows/vdf-client-hw.yml | 28 +++++++++++++++------------- scripts/get-libft4222.sh | 16 ++++++++++++++-- src/CMakeLists.txt | 10 +++++++++- src/Makefile.vdf-client | 9 ++++++++- 4 files changed, 46 insertions(+), 17 deletions(-) diff --git a/.github/workflows/vdf-client-hw.yml b/.github/workflows/vdf-client-hw.yml index 0613ecd9..014fe14f 100644 --- a/.github/workflows/vdf-client-hw.yml +++ b/.github/workflows/vdf-client-hw.yml @@ -36,7 +36,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-latest, macos-13-intel, macos-13-arm64, windows-latest] + os: [ubuntu-latest, ubuntu-24.04-arm, macos-13-intel, macos-13-arm64, windows-latest] config: [optimized=1, TSAN=1, ASAN=1] exclude: - os: windows-latest @@ -70,12 +70,12 @@ jobs: # Apply before build because make TSAN=1 runs ./compile_asm during build. # See: https://github.com/google/sanitizers/issues/1716 - name: Adjust mmap_rnd_bits before Ubuntu TSAN build/test execution - if: matrix.os == 'ubuntu-latest' && matrix.config == 'TSAN=1' + if: startsWith(matrix.os, 'ubuntu') && matrix.config == 'TSAN=1' run: | sudo sysctl vm.mmap_rnd_bits=28 - name: Build on Ubuntu - if: matrix.os == 'ubuntu-latest' + if: startsWith(matrix.os, 'ubuntu') run: | # Keep mmap_rnd_bits workaround step above this build for TSAN=1: # make TSAN=1 executes thread-sanitized ./compile_asm during build. @@ -237,7 +237,7 @@ jobs: } - name: Run HW smoke test (Ubuntu/macOS) - if: matrix.os != 'windows-latest' && (matrix.config != 'TSAN=1' || matrix.os == 'ubuntu-latest') + if: matrix.os != 'windows-latest' && (matrix.config != 'TSAN=1' || startsWith(matrix.os, 'ubuntu')) run: | cd src # CI runners do not have FT4222 hardware attached; only validate binaries exist. @@ -249,7 +249,7 @@ jobs: ./emu_hw_vdf_client --list - name: Run vdf tests (optimized smoke) - if: matrix.config == 'optimized=1' && matrix.os != 'windows-latest' && matrix.os != 'ubuntu-latest' + if: matrix.config == 'optimized=1' && matrix.os != 'windows-latest' && !startsWith(matrix.os, 'ubuntu') run: | cd src echo "Running 1weso_test (fast smoke)" @@ -258,7 +258,7 @@ jobs: ./2weso_test 1000 - name: Run vdf tests (optimized protected threshold path) - if: matrix.config == 'optimized=1' && matrix.os == 'ubuntu-latest' + if: matrix.config == 'optimized=1' && startsWith(matrix.os, 'ubuntu') run: | cd src echo "Running 1weso_test (fast smoke)" @@ -280,7 +280,7 @@ jobs: # it prints to std::cout from multiple threads. Which is allowed by the # standard - name: Run prover test (Ubuntu/macOS) - if: matrix.os != 'windows-latest' && (matrix.config != 'TSAN=1' || matrix.os == 'ubuntu-latest') + if: matrix.os != 'windows-latest' && (matrix.config != 'TSAN=1' || startsWith(matrix.os, 'ubuntu')) run: | cd src echo "Running prover_test" @@ -380,6 +380,7 @@ jobs: src/emu_hw_vdf_client src/hw_vdf_client src/hw/libft4222/build-x86_64/libft4222.so + src/hw/libft4222/build-arm-v8/libft4222.so src/hw/libft4222/*.dylib - name: Upload binaries artifact (Windows) @@ -402,11 +403,12 @@ jobs: mpir_gc_x64/*.dll - name: Assemble Ubuntu .deb (same runner as build) - if: matrix.os == 'ubuntu-latest' && matrix.config == 'optimized=1' + if: startsWith(matrix.os, 'ubuntu') && matrix.config == 'optimized=1' env: RELEASE_TAG: ${{ github.event_name == 'release' && github.event.release.tag_name || '' }} INSTALLER_VERSION: "${{ github.event_name == 'release' && github.event.release.tag_name || format('0.0.1-{0}', github.run_id) }}" - PLATFORM: "amd64" + PLATFORM: ${{ matrix.os == 'ubuntu-24.04-arm' && 'arm64' || 'amd64' }} + LIBFT4222_DIR: ${{ matrix.os == 'ubuntu-24.04-arm' && 'build-arm-v8' || 'build-x86_64' }} run: | pip install jinjanator CLI_DEB_BASE="chiavdf_$INSTALLER_VERSION-1_$PLATFORM" @@ -422,19 +424,19 @@ jobs: cp src/hw_test dist/$CLI_DEB_BASE/usr/bin/ cp src/hw_vdf_client dist/$CLI_DEB_BASE/usr/bin/ cp src/emu_hw_vdf_client dist/$CLI_DEB_BASE/usr/bin/ - cp src/hw/libft4222/build-x86_64/libft4222.so dist/$CLI_DEB_BASE/usr/lib/ + cp "src/hw/libft4222/$LIBFT4222_DIR/libft4222.so" dist/$CLI_DEB_BASE/usr/lib/ echo 'SUBSYSTEM=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="601c", MODE="0666"' > dist/$CLI_DEB_BASE/etc/udev/rules.d/99-chiavdf.rules dpkg-deb --build --root-owner-group "dist/$CLI_DEB_BASE" - name: Upload Ubuntu installer - if: matrix.os == 'ubuntu-latest' && matrix.config == 'optimized=1' + if: startsWith(matrix.os, 'ubuntu') && matrix.config == 'optimized=1' uses: actions/upload-artifact@v6 with: - name: installer + name: installer-${{ matrix.os }} path: dist/*.deb - name: Upload release artifacts - if: matrix.os == 'ubuntu-latest' && matrix.config == 'optimized=1' && github.event_name == 'release' + if: startsWith(matrix.os, 'ubuntu') && matrix.config == 'optimized=1' && github.event_name == 'release' env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} RELEASE_TAG: ${{ github.event.release.tag_name }} diff --git a/scripts/get-libft4222.sh b/scripts/get-libft4222.sh index 0bca8601..71442e6d 100755 --- a/scripts/get-libft4222.sh +++ b/scripts/get-libft4222.sh @@ -92,10 +92,22 @@ install_linux() { fetch_with_retry "$LINUX_URL" "$LINUX_ARCHIVE" tgz 3 tar -xzf "$LINUX_ARCHIVE" -C "$WORK_DIR" + local linux_arch + linux_arch="$(uname -m)" + local libft4222_dir + case "$linux_arch" in + x86_64) libft4222_dir="build-x86_64" ;; + aarch64|arm64) libft4222_dir="build-arm-v8" ;; + *) + echo "Unsupported Linux architecture for libft4222: $linux_arch" >&2 + exit 1 + ;; + esac + rm -rf "$HW_DIR" ln -s "$WORK_DIR" "$HW_DIR" - ln -sf "$WORK_DIR/build-x86_64/libft4222.so.1.4.4.170" \ - "$WORK_DIR/build-x86_64/libft4222.so" + ln -sf "$WORK_DIR/$libft4222_dir/libft4222.so.1.4.4.170" \ + "$WORK_DIR/$libft4222_dir/libft4222.so" } install_macos() { diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 23f1ab6e..e288c34c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -458,8 +458,16 @@ if(BUILD_HW_TOOLS) ) set(HW_SOCKET_LIBS) else() + string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" HW_ARCH_LOWER) + if(HW_ARCH_LOWER STREQUAL "x86_64" OR HW_ARCH_LOWER STREQUAL "amd64") + set(HW_LIB_DIR "build-x86_64") + elseif(HW_ARCH_LOWER STREQUAL "aarch64" OR HW_ARCH_LOWER STREQUAL "arm64") + set(HW_LIB_DIR "build-arm-v8") + else() + set(HW_LIB_DIR "build-x86_64") + endif() set(HW_LIBS - ${CMAKE_CURRENT_SOURCE_DIR}/hw/libft4222/build-x86_64/libft4222.so + ${CMAKE_CURRENT_SOURCE_DIR}/hw/libft4222/${HW_LIB_DIR}/libft4222.so ) set(HW_SOCKET_LIBS) endif() diff --git a/src/Makefile.vdf-client b/src/Makefile.vdf-client index 66c5b93a..13a240b5 100644 --- a/src/Makefile.vdf-client +++ b/src/Makefile.vdf-client @@ -108,7 +108,14 @@ HW_LIB = hw/libft4222/libft4222.dylib HW_FTD2XX_LIB = hw/libft4222/libftd2xx.dylib HW_LIBS = $(HW_LIB) $(HW_FTD2XX_LIB) else -HW_LIB = hw/libft4222/build-x86_64/libft4222.so +ifeq ($(ARCH),x86_64) +HW_LIB_DIR = build-x86_64 +else ifneq (,$(filter aarch64 arm64,$(ARCH))) +HW_LIB_DIR = build-arm-v8 +else +HW_LIB_DIR = build-x86_64 +endif +HW_LIB = hw/libft4222/$(HW_LIB_DIR)/libft4222.so HW_LIBS = $(HW_LIB) endif endif From c932b211f71bab2e4713c5b8ee5c9c4d0aa04709 Mon Sep 17 00:00:00 2001 From: Gene Hoffman Date: Mon, 23 Feb 2026 13:26:40 -0800 Subject: [PATCH 2/5] Tighten Ubuntu/macOS artifact upload paths and CMake arch handling. This limits Linux artifact uploads to the active Ubuntu architecture and makes CMake fail fast on unsupported Linux processors while recognizing common armv8 variants. Co-authored-by: Cursor --- .github/workflows/vdf-client-hw.yml | 23 +++++++++++++++++++---- src/CMakeLists.txt | 6 ++++-- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/.github/workflows/vdf-client-hw.yml b/.github/workflows/vdf-client-hw.yml index 014fe14f..5faec8c1 100644 --- a/.github/workflows/vdf-client-hw.yml +++ b/.github/workflows/vdf-client-hw.yml @@ -364,8 +364,25 @@ jobs: .\vdf_bench.exe square_asm 2000000 if ($LASTEXITCODE -ne 0) { throw "vdf_bench failed with exit code $LASTEXITCODE" } - - name: Upload binaries artifact (Ubuntu/macOS) - if: matrix.os != 'windows-latest' && matrix.config == 'optimized=1' + - name: Upload binaries artifact (Ubuntu) + if: startsWith(matrix.os, 'ubuntu') && matrix.config == 'optimized=1' + uses: actions/upload-artifact@v6 + with: + name: binaries-${{ matrix.config }}-${{ matrix.os }} + path: | + src/vdf_client + src/vdf_bench + src/1weso_test + src/2weso_test + src/prover_test + src/emu_hw_test + src/hw_test + src/emu_hw_vdf_client + src/hw_vdf_client + ${{ matrix.os == 'ubuntu-24.04-arm' && 'src/hw/libft4222/build-arm-v8/libft4222.so' || 'src/hw/libft4222/build-x86_64/libft4222.so' }} + + - name: Upload binaries artifact (macOS) + if: startsWith(matrix.os, 'macos') && matrix.config == 'optimized=1' uses: actions/upload-artifact@v6 with: name: binaries-${{ matrix.config }}-${{ matrix.os }} @@ -379,8 +396,6 @@ jobs: src/hw_test src/emu_hw_vdf_client src/hw_vdf_client - src/hw/libft4222/build-x86_64/libft4222.so - src/hw/libft4222/build-arm-v8/libft4222.so src/hw/libft4222/*.dylib - name: Upload binaries artifact (Windows) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e288c34c..f3b28e1b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -461,10 +461,12 @@ if(BUILD_HW_TOOLS) string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" HW_ARCH_LOWER) if(HW_ARCH_LOWER STREQUAL "x86_64" OR HW_ARCH_LOWER STREQUAL "amd64") set(HW_LIB_DIR "build-x86_64") - elseif(HW_ARCH_LOWER STREQUAL "aarch64" OR HW_ARCH_LOWER STREQUAL "arm64") + elseif(HW_ARCH_LOWER STREQUAL "aarch64" OR HW_ARCH_LOWER STREQUAL "arm64" OR HW_ARCH_LOWER MATCHES "^armv8") set(HW_LIB_DIR "build-arm-v8") else() - set(HW_LIB_DIR "build-x86_64") + message(FATAL_ERROR + "Unsupported Linux architecture for FT4222 hardware tools: ${CMAKE_SYSTEM_PROCESSOR}. " + "Expected one of: x86_64, amd64, aarch64, arm64, armv8*.") endif() set(HW_LIBS ${CMAKE_CURRENT_SOURCE_DIR}/hw/libft4222/${HW_LIB_DIR}/libft4222.so From fddf0d7b8905feb38d67eff52ee6db6fa3c572e6 Mon Sep 17 00:00:00 2001 From: Gene Hoffman Date: Mon, 23 Feb 2026 13:50:39 -0800 Subject: [PATCH 3/5] Fail fast on unsupported Linux FT4222 architecture in Makefile. This aligns the Makefile behavior with the install script and CMake by emitting a clear error instead of silently defaulting to the x86_64 library path. Co-authored-by: Cursor --- src/Makefile.vdf-client | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile.vdf-client b/src/Makefile.vdf-client index 13a240b5..681cad7f 100644 --- a/src/Makefile.vdf-client +++ b/src/Makefile.vdf-client @@ -113,7 +113,7 @@ HW_LIB_DIR = build-x86_64 else ifneq (,$(filter aarch64 arm64,$(ARCH))) HW_LIB_DIR = build-arm-v8 else -HW_LIB_DIR = build-x86_64 +$(error Unsupported Linux architecture for FT4222 hardware tools: $(ARCH). Expected one of: x86_64, aarch64, arm64) endif HW_LIB = hw/libft4222/$(HW_LIB_DIR)/libft4222.so HW_LIBS = $(HW_LIB) From d22549973282c03e78a32cf35f6070edc2435381 Mon Sep 17 00:00:00 2001 From: Gene Hoffman Date: Mon, 23 Feb 2026 14:05:31 -0800 Subject: [PATCH 4/5] Normalize Makefile architecture detection for Linux HW builds. Allow ARCH overrides and canonicalize common aliases so FT4222 library selection and asm object gating work reliably across CI environments. Co-authored-by: Cursor --- src/Makefile.vdf-client | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/Makefile.vdf-client b/src/Makefile.vdf-client index 681cad7f..59fcbb63 100644 --- a/src/Makefile.vdf-client +++ b/src/Makefile.vdf-client @@ -1,5 +1,12 @@ UNAME := $(shell uname) -ARCH := $(shell uname -m) +# Allow callers/CI to override ARCH, otherwise detect from host. +ARCH ?= $(shell uname -m) +ARCH_CANON := $(ARCH) +ifeq ($(ARCH_CANON),amd64) +ARCH_CANON := x86_64 +else ifeq ($(ARCH_CANON),arm64) +ARCH_CANON := aarch64 +endif GIT_DESCRIBE := $(strip $(shell git describe --tags --always 2>/dev/null)) CHIAVDF_VERSION ?= $(if $(GIT_DESCRIBE),$(GIT_DESCRIBE),dev) @@ -64,7 +71,7 @@ endif .PHONY: all clean # Only x86_64 builds use the x86 asm objects -ifeq ($(ARCH),x86_64) +ifeq ($(ARCH_CANON),x86_64) ASM_OBJS = asm_compiled.o avx2_asm_compiled.o avx512_asm_compiled.o else ASM_OBJS = @@ -108,12 +115,12 @@ HW_LIB = hw/libft4222/libft4222.dylib HW_FTD2XX_LIB = hw/libft4222/libftd2xx.dylib HW_LIBS = $(HW_LIB) $(HW_FTD2XX_LIB) else -ifeq ($(ARCH),x86_64) +ifeq ($(ARCH_CANON),x86_64) HW_LIB_DIR = build-x86_64 -else ifneq (,$(filter aarch64 arm64,$(ARCH))) +else ifeq ($(ARCH_CANON),aarch64) HW_LIB_DIR = build-arm-v8 else -$(error Unsupported Linux architecture for FT4222 hardware tools: $(ARCH). Expected one of: x86_64, aarch64, arm64) +$(error Unsupported Linux architecture for FT4222 hardware tools: $(ARCH). Expected one of: x86_64, aarch64/arm64, amd64) endif HW_LIB = hw/libft4222/$(HW_LIB_DIR)/libft4222.so HW_LIBS = $(HW_LIB) From caeee52ec50619e11d96bbfa589b3bc082a2dc09 Mon Sep 17 00:00:00 2001 From: Gene Hoffman Date: Mon, 23 Feb 2026 14:10:53 -0800 Subject: [PATCH 5/5] Ignore local libft4222 staging directory. Exclude src/libft4222 generated by FT4222 setup scripts so local dependency artifacts do not appear as untracked changes. Co-authored-by: Cursor --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 15b54e97..1e1a2618 100644 --- a/.gitignore +++ b/.gitignore @@ -45,6 +45,7 @@ src/hw_vdf_client # external library /src/hw/libft4222 +/src/libft4222/ # pyenv .python-version