From 2cf49cc50de2834efdefdfff91f562dc88da3b54 Mon Sep 17 00:00:00 2001 From: Dennis Klein Date: Tue, 9 Jun 2026 17:04:57 +0200 Subject: [PATCH] ci: fix thread-sanitizer build with lld and PIC googletest - tsan build failed at link with GNU ld: "failed to set dynamic section sizes: bad value" (known binutils + ThreadSanitizer incompatibility); install lld and select it via -fuse-ld=lld for the tsan job only - pass -fuse-ld=lld through cxx-flags so it reaches the link line, avoiding the semicolon-list pitfall of list(APPEND CMAKE_EXE_LINKER_FLAGS ...) - build the bundled googletest with CMAKE_POSITION_INDEPENDENT_CODE=ON: lld rejects R_X86_64_32 relocations from the non-PIC libgtest.a when producing the position-independent tsan executable; the bundle is built by a separate cmake invocation, so the flag must be set there --- .github/workflows/ci.yml | 5 +++++ cmake/FairMQBundlePackageHelper.cmake | 1 + 2 files changed, 6 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 43fb8beb..9b6430e7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -81,6 +81,7 @@ jobs: - name: tsan options: ENABLE_SANITIZER_THREAD=ON cxx-compiler: clang++ + cxx-flags: -fuse-ld=lld steps: - uses: actions/checkout@v6 @@ -100,6 +101,10 @@ jobs: key: ${{ github.job }}-${{ matrix.sanitizer.name }} max-size: 500M + - name: Install lld + if: matrix.sanitizer.name == 'tsan' + run: sudo apt-get update && sudo apt-get install -y lld + - name: Configure and Build uses: threeal/cmake-action@v2 with: diff --git a/cmake/FairMQBundlePackageHelper.cmake b/cmake/FairMQBundlePackageHelper.cmake index e8bb9586..52ba33b7 100644 --- a/cmake/FairMQBundlePackageHelper.cmake +++ b/cmake/FairMQBundlePackageHelper.cmake @@ -68,6 +68,7 @@ function(build_bundled package bundle) exec(${CMAKE_COMMAND} -S ${${package}_SOURCE_DIR} -B ${${package}_BINARY_DIR} -G ${CMAKE_GENERATOR} -DCMAKE_INSTALL_PREFIX=${${package}_INSTALL_DIR} -DBUILD_GMOCK=OFF + -DCMAKE_POSITION_INDEPENDENT_CODE=ON ) exec(${CMAKE_COMMAND} --build ${${package}_BINARY_DIR}) exec(${CMAKE_COMMAND} --build ${${package}_BINARY_DIR} --target install)