Skip to content

Commit 4bbcf2d

Browse files
authored
ci: build vizd on arm64 in every pull request (#213)
build: link natively on arm64 (Apple Silicon); compile-time profile
2 parents bf5389e + b745ded commit 4bbcf2d

5 files changed

Lines changed: 55 additions & 125 deletions

File tree

‎.github/workflows/docker-pr-build.yml‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,45 @@ jobs:
156156
-DCHAINBASE_CHECK_LOCKING=FALSE ..
157157
make -j"$(nproc)" vizd
158158
159+
# arm64 end of the platform range: nothing in the tree may be x86-only. fc used to vendor an
160+
# SSE-only equihash that no VIZ code called, and it kept every arm64 host (Apple Silicon,
161+
# Graviton, Ampere) from linking vizd for years because amd64 CI never saw it. Label-gated
162+
# like check-boost-range: add `check-arm64` to any PR that touches thirdparty submodule
163+
# pointers, vendored C, intrinsics, or the build files.
164+
build_arm64:
165+
name: Build on arm64 (distro Boost)
166+
runs-on: ubuntu-24.04-arm
167+
if: contains(github.event.pull_request.labels.*.name, 'check-arm64')
168+
169+
steps:
170+
- uses: actions/checkout@v6
171+
with:
172+
submodules: recursive
173+
174+
- name: Install distro Boost and build deps
175+
timeout-minutes: 15
176+
run: |
177+
set -euo pipefail
178+
sudo sed -i 's|azure.archive.ubuntu.com|archive.ubuntu.com|g' \
179+
/etc/apt/apt-mirrors.txt /etc/apt/sources.list 2>/dev/null || true
180+
apt="sudo apt-get -o Acquire::Retries=3 -o Acquire::http::Timeout=20 -o Acquire::https::Timeout=20"
181+
$apt update
182+
$apt install -y --no-install-recommends \
183+
build-essential cmake libboost-all-dev libssl-dev \
184+
libbz2-dev liblzma-dev libzstd-dev libreadline-dev \
185+
libtool ncurses-dev pkg-config zlib1g-dev
186+
187+
- name: Configure and build
188+
run: |
189+
set -euo pipefail
190+
sed -i '/add_subdirectory(tests)/d' thirdparty/fc/CMakeLists.txt
191+
mkdir -p build && cd build
192+
cmake -DCMAKE_BUILD_TYPE=Release \
193+
-DBUILD_SHARED_LIBRARIES=FALSE \
194+
-DCHAINBASE_CHECK_LOCKING=FALSE ..
195+
make -j"$(nproc)" vizd cli_wallet
196+
programs/vizd/vizd --version
197+
159198
# L3 (audit 2026-08-13): the tree's PM unit tests (LMSR vector parity, parimutuel
160199
# conservation, leverage math, meta parsing, chain-properties validate() sweep) were
161200
# only ever run manually — CI proved compilation alone. Gated on the `pm-tests` label

‎CMakeLists.txt‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,15 @@ else(WIN32) # Apple AND Linux
267267
# Apple Specific Options Here
268268
message(STATUS "Configuring VIZ on OS X")
269269
set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -std=c++14 -stdlib=libc++ -Wall -Wno-conversion -Wno-deprecated-declarations")
270+
# Homebrew's static Boost.Iostreams config names its dependencies bare (bz2, lzma,
271+
# zstd, icuuc, ...). The Apple linker does not search the Homebrew prefix on its own,
272+
# and icu4c is keg-only, so without these -L paths every executable fails to link
273+
# with "library 'zstd' not found".
274+
execute_process(COMMAND brew --prefix
275+
OUTPUT_VARIABLE _brew_prefix OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
276+
if(_brew_prefix)
277+
link_directories("${_brew_prefix}/lib" "${_brew_prefix}/opt/icu4c/lib")
278+
endif()
270279
else(APPLE)
271280
# Linux Specific Options Here
272281
message(STATUS "Configuring VIZ on Linux")

‎docs/development/building.md‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ Requires Xcode Command Line Tools and Homebrew. The script installs: `boost`, `c
5757
./build-mac.sh --boost-root /opt/boost_1_74_0
5858
```
5959

60+
Apple Silicon builds natively: the tree contains no x86-only code (the SSE-only `equihash` that fc once vendored was unused and has been removed), and CMake adds the Homebrew library directories to the link path so the static Boost.Iostreams dependencies (`zstd`, `lzma`, `icu*`) resolve. A cold `vizd` build takes about 10 minutes on an 8-core M-series laptop, against roughly an hour for the same build under amd64 emulation in Docker.
61+
62+
### Where compile time goes
63+
64+
Measured with clang `-ftime-trace` on a Release build. Five translation units account for a third of the project's compile time: `libraries/chain/database.cpp` (~250 s), `libraries/wallet/wallet.cpp`, `libraries/network/dlt_p2p_node.cpp`, `libraries/protocol/operations.cpp` and `plugins/snapshot/plugin.cpp` (100–160 s each). In a typical unit about two thirds of the time is the optimizer, not the parser: every file that serializes a `signed_block` instantiates the `fc::raw` pack/unpack visitors for every field of every operation (about 1,500 functions), and `-O3` then optimizes each of them again. Precompiled headers (`-DENABLE_PCH=ON`) therefore shave only the parsing third; `ccache` is what makes rebuilds fast.
65+
6066
---
6167

6268
## Windows (MinGW)

‎tests/consensus_sim/fc-arm64-portability.patch‎

Lines changed: 0 additions & 124 deletions
This file was deleted.

0 commit comments

Comments
 (0)