diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index d7db10b..ffce175 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -41,9 +41,16 @@ jobs: - name: Install dependencies run: | - HOMEBREW_NO_AUTO_UPDATE=1 brew install python boost@1.85 hidapi openssl zmq libpgm miniupnpc expat libunwind-headers protobuf unbound ccache + HOMEBREW_NO_AUTO_UPDATE=1 brew install python boost@1.85 hidapi openssl@3 zmq libpgm miniupnpc expat libunwind-headers protobuf unbound ccache brew unlink boost || true brew link boost@1.85 --force + # brew links openssl@4 into /opt/homebrew, and the -I/opt/homebrew/include of boost and zeromq comes + # before the one of openssl@3, so its headers win over the ones of OPENSSL_ROOT_DIR + brew unlink openssl@4 || true + # brew's openssl is OpenSSL 4 on the newer runner images, which boost 1.85 does not build with. + # monero-project and monero-cpp take brew's openssl unless they are given another one, so + # they get it on the command line, and the module finds it in the environment + echo "OPENSSL_ROOT_DIR=$(brew --prefix openssl@3)" >> "$GITHUB_ENV" pip3 install pytest pytest-cov setuptools wheel scikit-build-core --break-system-packages - name: Install pybind11 v2.13.6 @@ -70,7 +77,11 @@ jobs: cd external/monero-cpp/external/monero-project mkdir -p build/release cd build/release - cmake -DSTATIC=ON -DBUILD_64=ON -DCMAKE_BUILD_TYPE=Release ../../ + # monero builds with -march=native unless it is told which cpu to build for, and objects compiled + # on a runner with newer instructions, restored by ccache or shipped in a package, end in an illegal + # instruction on another cpu + ARCH=$([ "$(uname -m)" = x86_64 ] && echo x86-64 || echo armv8-a) + cmake -DSTATIC=ON -DARCH="$ARCH" -DBUILD_64=ON -DCMAKE_BUILD_TYPE=Release -DOPENSSL_ROOT_DIR="$OPENSSL_ROOT_DIR" ../../ make -j3 wallet cryptonote_protocol cd ../../../../../../ @@ -79,7 +90,7 @@ jobs: cd external/monero-cpp mkdir -p build cd build - cmake .. -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache + cmake .. -DOPENSSL_ROOT_DIR="$OPENSSL_ROOT_DIR" -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache cmake --build . make -j3 cd ../../../ diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e8b2808..792dc67 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -91,7 +91,10 @@ jobs: cd external/monero-cpp/external/monero-project mkdir -p build/release cd build/release - cmake -DSTATIC=ON -DBUILD_64=ON -DCMAKE_BUILD_TYPE=Release ../../ + # monero builds with -march=native unless it is told which cpu to build for, and objects compiled + # on a runner with newer instructions, restored by ccache or shipped in a package, end in an illegal + # instruction on another cpu + cmake -DSTATIC=ON -DARCH=x86-64 -DBUILD_64=ON -DCMAKE_BUILD_TYPE=Release ../../ make -j3 wallet cryptonote_protocol cd ../../../../../../ @@ -420,9 +423,16 @@ jobs: - name: Install dependencies run: | - HOMEBREW_NO_AUTO_UPDATE=1 brew install python boost@1.85 hidapi openssl zmq libpgm miniupnpc expat libunwind-headers protobuf unbound ccache + HOMEBREW_NO_AUTO_UPDATE=1 brew install python boost@1.85 hidapi openssl@3 zmq libpgm miniupnpc expat libunwind-headers protobuf unbound ccache brew unlink boost || true brew link boost@1.85 --force + # brew links openssl@4 into /opt/homebrew, and the -I/opt/homebrew/include of boost and zeromq comes + # before the one of openssl@3, so its headers win over the ones of OPENSSL_ROOT_DIR + brew unlink openssl@4 || true + # brew's openssl is OpenSSL 4 on the newer runner images, which boost 1.85 does not build with. + # monero-project and monero-cpp take brew's openssl unless they are given another one, so + # they get it on the command line, and the module finds it in the environment + echo "OPENSSL_ROOT_DIR=$(brew --prefix openssl@3)" >> "$GITHUB_ENV" pip3 install pytest pytest-rerunfailures pytest-timeout pytest-cov setuptools wheel scikit-build-core --break-system-packages - name: Install pybind11 v2.13.6 @@ -445,7 +455,11 @@ jobs: cd external/monero-cpp/external/monero-project mkdir -p build/release cd build/release - cmake -DSTATIC=ON -DBUILD_64=ON -DCMAKE_BUILD_TYPE=Release ../../ + # monero builds with -march=native unless it is told which cpu to build for, and objects compiled + # on a runner with newer instructions, restored by ccache or shipped in a package, end in an illegal + # instruction on another cpu + ARCH=$([ "$(uname -m)" = x86_64 ] && echo x86-64 || echo armv8-a) + cmake -DSTATIC=ON -DARCH="$ARCH" -DBUILD_64=ON -DCMAKE_BUILD_TYPE=Release -DOPENSSL_ROOT_DIR="$OPENSSL_ROOT_DIR" ../../ make -j3 wallet cryptonote_protocol cd ../../../../../../ @@ -454,7 +468,7 @@ jobs: cd external/monero-cpp mkdir -p build cd build - cmake .. -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache + cmake .. -DOPENSSL_ROOT_DIR="$OPENSSL_ROOT_DIR" -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache cmake --build . make -j3 cd ../../../ diff --git a/docker/build.sh b/docker/build.sh index 780b2c3..8fde234 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -45,10 +45,17 @@ if [[ $(uname -s) == "MINGW64_NT"* || $(uname -s) == "MSYS"* ]]; then make release-static-win32 -j$HOST_NCORES fi else - # OS is not windows + # OS is not windows. monero builds with -march=native unless it is told which cpu to build for, and objects compiled + # on a runner with newer instructions, restored by ccache or shipped in a package, end in an illegal + # instruction on another cpu + case $(uname -m) in + x86_64) MONERO_ARCH="x86-64";; + aarch64|arm64) MONERO_ARCH="armv8-a";; + *) MONERO_ARCH="native";; + esac mkdir -p build/release && cd build/release && - cmake -DSTATIC=ON -DBUILD_64=ON -DCMAKE_BUILD_TYPE=Release ../../ + cmake -DSTATIC=ON -DARCH="$MONERO_ARCH" -DBUILD_64=ON -DCMAKE_BUILD_TYPE=Release ../../ make -j$HOST_NCORES wallet cryptonote_protocol fi cd ../../../../