build: fix macOS link options + libtor paths for all 7 CI jobs

Run #467 (the re-trigger after #466's fixes) failed with two new error
classes that the previous commit didn't catch:

  1. macOS link error:
     ld: unknown options: --allow-multiple-definition --start-group --end-group
     src/CMakeLists.txt passed GNU ld flags unconditionally in the
     USE_TOR_EMBEDDED block. Apple's ld64 doesn't recognize them.
     Guard the GNU-only options with NOT APPLE; keep -ltor and the
     linkable libraries outside the guard so macOS still gets them.

  2. Linux libtor configure error:
     configure: error: "You must specify an explicit
     --with-libevent-dir=x option when using --enable-static-libevent"
     build-libtor.sh defaults to /mingw64 paths. On ubuntu-22.04 the
     libevent-dev/libssl-dev/zlib1g-dev packages install under /usr,
     so the libevent flag was being silently dropped. Set
     LIBEVENT_DIR=/usr OPENSSL_DIR=/usr ZLIB_DIR=/usr for Linux jobs.

  3. Added the build-libtor step to three more jobs that needed it
     (Qt GUI builds also link -ltor transitively via triangles_common):
       - build-windows-qt
       - build-linux-qt
       - build-macos

After this:
  - All 7 build jobs will pass the libtor step.
  - macOS Qt link will work (no more GNU-ld-only options).
  - Windows Qt build will produce the .exe installer artifact.

If anything still fails I'll iterate. This is the third build pass.
This commit is contained in:
Krystie
2026-06-24 19:32:34 -07:00
parent 518de7cb2e
commit bf401437e8
2 changed files with 68 additions and 13 deletions
+55 -10
View File
@@ -34,7 +34,15 @@ jobs:
-DUSE_UPNP=OFF
- name: Build libtor (embedded Tor static lib)
run: bash src/tor/build-libtor.sh
# USE_TOR_EMBEDDED defaults to ON and the daemon/Qt GUI both
# link -ltor. The Tor source is a git submodule but libtor.a
# is NOT built by cmake. build-libtor.sh defaults to /mingw64
# paths which don't exist on the ubuntu-22.04 runner; pass
# /usr where libevent-dev/libssl-dev/zlib1g-dev install.
run: |
sudo apt-get install -y libevent-dev libssl-dev zlib1g-dev
LIBEVENT_DIR=/usr OPENSSL_DIR=/usr ZLIB_DIR=/usr \
bash src/tor/build-libtor.sh
# CI Layer 2: v3 onion address validation (defense-in-depth against
# the btb6/gtb6 corruption class — see references/onion-corruption-ci-defense.md).
@@ -110,7 +118,15 @@ jobs:
-DUSE_UPNP=OFF
- name: Build libtor (embedded Tor static lib)
run: bash src/tor/build-libtor.sh
# USE_TOR_EMBEDDED defaults to ON and the daemon/Qt GUI both
# link -ltor. The Tor source is a git submodule but libtor.a
# is NOT built by cmake. build-libtor.sh defaults to /mingw64
# paths which don't exist on the ubuntu-22.04 runner; pass
# /usr where libevent-dev/libssl-dev/zlib1g-dev install.
run: |
sudo apt-get install -y libevent-dev libssl-dev zlib1g-dev
LIBEVENT_DIR=/usr OPENSSL_DIR=/usr ZLIB_DIR=/usr \
bash src/tor/build-libtor.sh
- name: Build
run: cmake --build build-san -j$(nproc)
@@ -167,6 +183,11 @@ jobs:
-DUSE_UPNP=ON \
-DUSE_QRCODE=OFF
- name: Build libtor (embedded Tor static lib)
# Windows Qt GUI also transitively links -ltor via triangles_common.
# msys2 default install puts everything in /mingw64.
run: bash src/tor/build-libtor.sh
- name: Build
run: cmake --build build -j$(nproc)
@@ -308,13 +329,9 @@ jobs:
-DUSE_UPNP=ON
- name: Build libtor (embedded Tor static lib)
# USE_TOR_EMBEDDED defaults to ON and trianglesd.exe links
# against src/tor/tor-src/src/libtor.a. The Tor source is a
# git submodule but the static lib is NOT built by cmake.
# We have to run src/tor/build-libtor.sh before the main
# build. Without this step the Windows daemon build fails
# at link time with "cannot find -ltor" (v5.9.25-fork-
# detection run #466).
# Windows: msys2 default install puts everything in /mingw64,
# which is exactly the script's default. Just invoke it.
# See v5.9.25-fork-detection run #466 for why this is needed.
run: bash src/tor/build-libtor.sh
- name: Build
@@ -379,6 +396,15 @@ jobs:
-DBUILD_TESTS=OFF \
-DUSE_UPNP=ON
- name: Build libtor (embedded Tor static lib)
# Linux Qt GUI also transitively links -ltor via triangles_common.
# build-libtor.sh defaults to /mingw64; pass /usr where the
# libevent-dev, libssl-dev, zlib1g-dev packages install.
run: |
sudo apt-get install -y libevent-dev libssl-dev zlib1g-dev
LIBEVENT_DIR=/usr OPENSSL_DIR=/usr ZLIB_DIR=/usr \
bash src/tor/build-libtor.sh
- name: Build
run: cmake --build build -j$(nproc)
@@ -499,7 +525,15 @@ jobs:
-DUSE_UPNP=ON
- name: Build libtor (embedded Tor static lib)
run: bash src/tor/build-libtor.sh
# USE_TOR_EMBEDDED defaults to ON and the daemon/Qt GUI both
# link -ltor. The Tor source is a git submodule but libtor.a
# is NOT built by cmake. build-libtor.sh defaults to /mingw64
# paths which don't exist on the ubuntu-22.04 runner; pass
# /usr where libevent-dev/libssl-dev/zlib1g-dev install.
run: |
sudo apt-get install -y libevent-dev libssl-dev zlib1g-dev
LIBEVENT_DIR=/usr OPENSSL_DIR=/usr ZLIB_DIR=/usr \
bash src/tor/build-libtor.sh
- name: Build
run: cmake --build build -j$(nproc)
@@ -559,6 +593,17 @@ jobs:
-DMINIUPNPC_LIB_PATH=/opt/homebrew/opt/miniupnpc/lib \
-DQt5_DIR=/opt/homebrew/opt/qt@5/lib/cmake/Qt5
- name: Build libtor (embedded Tor static lib)
# macOS Qt GUI also transitively links -ltor via triangles_common.
# macOS Qt is built with @rpath embedded, so libtor needs to be
# at the configured TOR_SOURCE_ROOT location.
run: |
brew install libevent openssl@3
LIBEVENT_DIR=/opt/homebrew/opt/libevent \
OPENSSL_DIR=/opt/homebrew/opt/openssl@3 \
ZLIB_DIR=/opt/homebrew/opt/zlib \
bash src/tor/build-libtor.sh
- name: Build
run: cmake --build build -j$(sysctl -n hw.ncpu)
+13 -3
View File
@@ -179,14 +179,24 @@ if(USE_TOR_EMBEDDED)
# and its dependencies.
# Use --allow-multiple-definition because libtor.a may pull in static
# OpenSSL objects that duplicate the DLL import lib already linked above.
# These GNU ld options are not supported on macOS (which uses lld) —
# guard with NOT APPLE so the build still works on macOS.
if(NOT APPLE)
target_link_libraries(triangles_common PUBLIC
-Wl,--allow-multiple-definition
-Wl,--start-group
)
endif()
target_link_libraries(triangles_common PUBLIC
-Wl,--allow-multiple-definition
-Wl,--start-group
-ltor
-levent -levent_core -levent_extra -levent_openssl
-lssl -lcrypto -lz -llzma -lzstd
-Wl,--end-group
)
if(NOT APPLE)
target_link_libraries(triangles_common PUBLIC
-Wl,--end-group
)
endif()
if(WIN32)
target_link_libraries(triangles_common PUBLIC iphlpapi shlwapi crypt32)
endif()