Skip to content

Commit ea48edb

Browse files
ci: build with openssl@3 on macOS and for a baseline cpu
Two things broke the builds on the new runner images and on a cache restored from another machine. macOS: the macos-15-arm64 image of 28 October (20261028.0489) ships openssl@4 4.1.0, brew --prefix openssl points to it, and boost 1.85 does not build with OpenSSL 4 (asio's rfc2818_verification.ipp reads ASN1_IA5STRING members, which are opaque now), so "Build monero" failed in epee/abstract_http_client.cpp. GitHub rolls the images out gradually: the run of the release pull request landed on the previous one (openssl@3 3.6.4) and passed, the next ones did not. Install openssl@3, export its prefix in OPENSSL_ROOT_DIR and pass it with -D to the cmake of monero-project and monero-cpp, which overwrite it with brew --prefix openssl and ignore the environment. The module finds it in the environment. openssl@4 is also linked into /opt/homebrew, and the -I/opt/homebrew/include of boost and zeromq comes before the one of openssl@3, so its headers were still found first in monero-cpp: unlink it, the keg stays where it is for the formulae that depend on it. Linux: monero-project builds with -march=native unless ARCH is set, and ccache does not know the cpu. The Linux build of a pull request hit 207 of 207 objects from the cache that main saved on another runner, and pytest died with an illegal instruction (exit 132) as soon as it loaded the module. The same objects end up in the deb packages and in the macOS Intel wheels, which then need the instructions of the cpu that built them. Pass ARCH explicitly, as the Windows job and monero-cpp already do: x86-64 on x86_64, armv8-a on arm64, the old default elsewhere (armhf). The flags change, so the objects in the existing caches are not used any more. Applies to Tests, Build MacOS and docker/build.sh. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
1 parent e46cc00 commit ea48edb

3 files changed

Lines changed: 41 additions & 9 deletions

File tree

‎.github/workflows/build-macos.yml‎

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,16 @@ jobs:
4141

4242
- name: Install dependencies
4343
run: |
44-
HOMEBREW_NO_AUTO_UPDATE=1 brew install python boost@1.85 hidapi openssl zmq libpgm miniupnpc expat libunwind-headers protobuf unbound ccache
44+
HOMEBREW_NO_AUTO_UPDATE=1 brew install python boost@1.85 hidapi openssl@3 zmq libpgm miniupnpc expat libunwind-headers protobuf unbound ccache
4545
brew unlink boost || true
4646
brew link boost@1.85 --force
47+
# brew links openssl@4 into /opt/homebrew, and the -I/opt/homebrew/include of boost and zeromq comes
48+
# before the one of openssl@3, so its headers win over the ones of OPENSSL_ROOT_DIR
49+
brew unlink openssl@4 || true
50+
# brew's openssl is OpenSSL 4 on the newer runner images, which boost 1.85 does not build with.
51+
# monero-project and monero-cpp take brew's openssl unless they are given another one, so
52+
# they get it on the command line, and the module finds it in the environment
53+
echo "OPENSSL_ROOT_DIR=$(brew --prefix openssl@3)" >> "$GITHUB_ENV"
4754
pip3 install pytest pytest-cov setuptools wheel scikit-build-core --break-system-packages
4855
4956
- name: Install pybind11 v2.13.6
@@ -70,7 +77,11 @@ jobs:
7077
cd external/monero-cpp/external/monero-project
7178
mkdir -p build/release
7279
cd build/release
73-
cmake -DSTATIC=ON -DBUILD_64=ON -DCMAKE_BUILD_TYPE=Release ../../
80+
# monero builds with -march=native unless it is told which cpu to build for, and objects compiled
81+
# on a runner with newer instructions, restored by ccache or shipped in a package, end in an illegal
82+
# instruction on another cpu
83+
ARCH=$([ "$(uname -m)" = x86_64 ] && echo x86-64 || echo armv8-a)
84+
cmake -DSTATIC=ON -DARCH="$ARCH" -DBUILD_64=ON -DCMAKE_BUILD_TYPE=Release -DOPENSSL_ROOT_DIR="$OPENSSL_ROOT_DIR" ../../
7485
make -j3 wallet cryptonote_protocol
7586
cd ../../../../../../
7687
@@ -79,7 +90,7 @@ jobs:
7990
cd external/monero-cpp
8091
mkdir -p build
8192
cd build
82-
cmake .. -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
93+
cmake .. -DOPENSSL_ROOT_DIR="$OPENSSL_ROOT_DIR" -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
8394
cmake --build .
8495
make -j3
8596
cd ../../../

‎.github/workflows/test.yml‎

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,10 @@ jobs:
9191
cd external/monero-cpp/external/monero-project
9292
mkdir -p build/release
9393
cd build/release
94-
cmake -DSTATIC=ON -DBUILD_64=ON -DCMAKE_BUILD_TYPE=Release ../../
94+
# monero builds with -march=native unless it is told which cpu to build for, and objects compiled
95+
# on a runner with newer instructions, restored by ccache or shipped in a package, end in an illegal
96+
# instruction on another cpu
97+
cmake -DSTATIC=ON -DARCH=x86-64 -DBUILD_64=ON -DCMAKE_BUILD_TYPE=Release ../../
9598
make -j3 wallet cryptonote_protocol
9699
cd ../../../../../../
97100
@@ -420,9 +423,16 @@ jobs:
420423

421424
- name: Install dependencies
422425
run: |
423-
HOMEBREW_NO_AUTO_UPDATE=1 brew install python boost@1.85 hidapi openssl zmq libpgm miniupnpc expat libunwind-headers protobuf unbound ccache
426+
HOMEBREW_NO_AUTO_UPDATE=1 brew install python boost@1.85 hidapi openssl@3 zmq libpgm miniupnpc expat libunwind-headers protobuf unbound ccache
424427
brew unlink boost || true
425428
brew link boost@1.85 --force
429+
# brew links openssl@4 into /opt/homebrew, and the -I/opt/homebrew/include of boost and zeromq comes
430+
# before the one of openssl@3, so its headers win over the ones of OPENSSL_ROOT_DIR
431+
brew unlink openssl@4 || true
432+
# brew's openssl is OpenSSL 4 on the newer runner images, which boost 1.85 does not build with.
433+
# monero-project and monero-cpp take brew's openssl unless they are given another one, so
434+
# they get it on the command line, and the module finds it in the environment
435+
echo "OPENSSL_ROOT_DIR=$(brew --prefix openssl@3)" >> "$GITHUB_ENV"
426436
pip3 install pytest pytest-rerunfailures pytest-timeout pytest-cov setuptools wheel scikit-build-core --break-system-packages
427437
428438
- name: Install pybind11 v2.13.6
@@ -445,7 +455,11 @@ jobs:
445455
cd external/monero-cpp/external/monero-project
446456
mkdir -p build/release
447457
cd build/release
448-
cmake -DSTATIC=ON -DBUILD_64=ON -DCMAKE_BUILD_TYPE=Release ../../
458+
# monero builds with -march=native unless it is told which cpu to build for, and objects compiled
459+
# on a runner with newer instructions, restored by ccache or shipped in a package, end in an illegal
460+
# instruction on another cpu
461+
ARCH=$([ "$(uname -m)" = x86_64 ] && echo x86-64 || echo armv8-a)
462+
cmake -DSTATIC=ON -DARCH="$ARCH" -DBUILD_64=ON -DCMAKE_BUILD_TYPE=Release -DOPENSSL_ROOT_DIR="$OPENSSL_ROOT_DIR" ../../
449463
make -j3 wallet cryptonote_protocol
450464
cd ../../../../../../
451465
@@ -454,7 +468,7 @@ jobs:
454468
cd external/monero-cpp
455469
mkdir -p build
456470
cd build
457-
cmake .. -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
471+
cmake .. -DOPENSSL_ROOT_DIR="$OPENSSL_ROOT_DIR" -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
458472
cmake --build .
459473
make -j3
460474
cd ../../../

‎docker/build.sh‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,17 @@ if [[ $(uname -s) == "MINGW64_NT"* || $(uname -s) == "MSYS"* ]]; then
4545
make release-static-win32 -j$HOST_NCORES
4646
fi
4747
else
48-
# OS is not windows
48+
# OS is not windows. monero builds with -march=native unless it is told which cpu to build for, and objects compiled
49+
# on a runner with newer instructions, restored by ccache or shipped in a package, end in an illegal
50+
# instruction on another cpu
51+
case $(uname -m) in
52+
x86_64) MONERO_ARCH="x86-64";;
53+
aarch64|arm64) MONERO_ARCH="armv8-a";;
54+
*) MONERO_ARCH="native";;
55+
esac
4956
mkdir -p build/release &&
5057
cd build/release &&
51-
cmake -DSTATIC=ON -DBUILD_64=ON -DCMAKE_BUILD_TYPE=Release ../../
58+
cmake -DSTATIC=ON -DARCH="$MONERO_ARCH" -DBUILD_64=ON -DCMAKE_BUILD_TYPE=Release ../../
5259
make -j$HOST_NCORES wallet cryptonote_protocol
5360
fi
5461
cd ../../../../

0 commit comments

Comments
 (0)