build(gui): exclude libsam3.a from re-exported symbols (fixes Ninja Windows build)

With the Ninja generator on Windows, the GUI (-Wl,--export-all-symbols) re-exports
the symbols of the static libs it links; libsam3.a was missing from --exclude-libs,
so plugins that also link libsam3.a (FeedReader) failed with "multiple definition
of sam3GenerateKeys". The MSYS Makefiles generator does not hit this, but adding
libsam3.a to --exclude-libs keeps Ninja builds working too.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
jolavillette 2026-06-06 18:19:41 +02:00
parent d4a20720ae
commit a53e1e919e

View File

@ -196,7 +196,13 @@ if(WIN32)
ARCHIVE_OUTPUT_NAME "retroshare-gui"
)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_link_options(${PROJECT_NAME} PRIVATE "-Wl,--export-all-symbols" "-Wl,--exclude-libs,libretroshare.a:libbitdht.a:librnp.a:libsexpp.a")
# Exclude static libs from the re-exported symbol set. This matters for the
# Ninja generator on Windows: there the GUI otherwise re-exports the symbols
# of these static libs, and plugins that also link the same lib (e.g.
# libsam3.a in FeedReader) then fail with "multiple definition" at link time.
# The MSYS Makefiles generator does not hit this, but excluding them keeps
# Ninja builds working too.
target_link_options(${PROJECT_NAME} PRIVATE "-Wl,--export-all-symbols" "-Wl,--exclude-libs,libretroshare.a:libbitdht.a:librnp.a:libsexpp.a:libsam3.a")
endif()
endif()
install(TARGETS ${PROJECT_NAME} DESTINATION ${RS_BIN_INSTALL_DIR})