Skip to content

Cmake: some people build shared libtbb - #23087

Closed
andresailer wants to merge 1 commit into
root-project:masterfrom
andresailer:master
Closed

Cmake: some people build shared libtbb#23087
andresailer wants to merge 1 commit into
root-project:masterfrom
andresailer:master

Conversation

@andresailer

@andresailer andresailer commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

This Pull request:

Changes or fixes:

It fixes build errors on mac OS 26 with shared library builds of libtbb.
When STATIC is given, the rpath configuration during the linking of libThread is incorrect,

[ 57%] Linking CXX shared library ../../lib/libThread.so
/Library/Developer/CommandLineTools/usr/bin/clang++  -Wc++11-narrowing -Wsign-compare -Wsometimes-uninitialized -Wconditional-uninitialized -Wheader-guard -Warray-bounds -Wcomment -Wtautological-compare -Wstrncat-size -Wloop-analysis -Wbool-conversion -m64 -pipe -W -Wall -Woverloaded-virtual -fsigned-char -fsized-deallocation -fno-common -Qunused-arguments -pthread -stdlib=libc++ -O3 -DNDEBUG -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -dynamiclib -Wl,-headerpad_max_install_names -m64 -Wl,-dead_strip_dylibs -o ../../lib/libThread.so -install_name @rpath/libThread.so CMakeFiles/Thread.dir/src/TCondition.cxx.o CMakeFiles/Thread.dir/src/TConditionImp.cxx.o CMakeFiles/Thread.dir/src/TMutex.cxx.o CMakeFiles/Thread.dir/src/TMutexImp.cxx.o CMakeFiles/Thread.dir/src/TReentrantRWLock.cxx.o CMakeFiles/Thread.dir/src/TRWLock.cxx.o CMakeFiles/Thread.dir/src/TRWMutexImp.cxx.o CMakeFiles/Thread.dir/src/TRWSpinLock.cxx.o CMakeFiles/Thread.dir/src/TSemaphore.cxx.o CMakeFiles/Thread.dir/src/TThread.cxx.o CMakeFiles/Thread.dir/src/TThreadFactory.cxx.o CMakeFiles/Thread.dir/src/TThreadImp.cxx.o CMakeFiles/Thread.dir/src/TPosixCondition.cxx.o CMakeFiles/Thread.dir/src/TPosixMutex.cxx.o CMakeFiles/Thread.dir/src/TPosixThread.cxx.o CMakeFiles/Thread.dir/src/TPosixThreadFactory.cxx.o CMakeFiles/G__Thread.dir/G__Thread.cxx.o  -Wl,-rpath,/Users/sftnight/build/workspace/lcg_nightly_pipeline/build/projects/ROOT-c050cbde/src/ROOT-c050cbde-build/lib ../../lib/libCore.so /Users/sftnight/build/workspace/lcg_nightly_pipeline/install/dev3/tbb/2023.1.0/arm64-mac26-clang170-opt/lib/libtbb.dylib

leading to errors later on.

[ 60%] Generating G__Net.cxx, ../../lib/Net.pcm
dyld[97986]: Library not loaded: @rpath/libtbb.12.dylib
  Referenced from: <0A33E4C2-1C88-3AEE-8935-D13F217B6639> /Volumes/build_drive/SPI-macOS-26/workspace/lcg_nightly_pipeline/build/projects/ROOT-c050cbde/src/ROOT-c050cbde-build/lib/libThread.so
  Reason: tried: '/Users/sftnight/build/workspace/lcg_nightly_pipeline/build/projects/ROOT-c050cbde/src/ROOT-c050cbde-build/lib/libtbb.12.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/sftnight/build/workspace/lcg_nightly_pipeline/build/projects/ROOT-c050cbde/src/ROOT-c050cbde-build/lib/libtbb.12.dylib' (no such file), '/Users/sftnight/build/workspace/lcg_nightly_pipeline/build/projects/ROOT-c050cbde/src/ROOT-c050cbde-build/lib/libtbb.12.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/sftnight/build/workspace/lcg_nightly_pipeline/build/projects/ROOT-c050cbde/src/ROOT-c050cbde-build/lib/libtbb.12.dylib' (no such file), '/Users/sftnight/build/workspace/lcg_nightly_pipeline/build/projects/ROOT-c050cbde/src/ROOT-c050cbde-build/lib/libtbb.12.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/sftnight/build/workspace/lcg_nightly_pipeline/build/projects/ROOT-c050cbde/src/ROOT-c050cbde-build/lib/libtbb.12.dylib' (no such file), '/Users/sftnight/build/workspace/lcg_nightly_pipeline/build/projects/ROOT-c050cbde/src/ROOT-c050cbde-build/lib/libtbb.12.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/sftnight/build/workspace/lcg_nightly_pipeline/build/projects/ROOT-c050cbde/src/ROOT-c050cbde-build/lib/libtbb.12.dylib' (no such file), '/Users/sftnight/build/workspace/lcg_nightly_pipeline/build/projects/ROOT-c050cbde/src/ROOT-c050cbde-build/lib/libtbb.12.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Users/sftnight/build/workspace/lcg_nightly_pipeline/build/projects/ROOT-c050cbde/src/ROOT-c050cbde-build/lib/libtbb.12.dylib' (no such file)
Subprocess aborted

After this change:

[ 55%] Linking CXX shared library ../../lib/libThread.so
cd /Users/sailer/SPI/lcgcmake/projects/ROOT-c050cbde/src/ROOT-c050cbde-build/core/thread && /Applications/CMake.app/Contents/bin/cmake -E cmake_link_script CMakeFiles/Thread.dir/link.txt --verbose=1 /Library/Developer/CommandLineTools/usr/bin/c++  -Wc++11-narrowing -Wsign-compare -Wsometimes-uninitialized -Wconditional-uninitialized -Wheader-guard -Warray-bounds -Wcomment -Wtautological-compare -Wstrncat-size -Wloop-analysis -Wbool-conversion -m64 -pipe -W -Wall -Woverloaded-virtual -fsigned-char -fsized-deallocation -fno-common -Qunused-arguments -pthread -stdlib=libc++ -O3 -DNDEBUG -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -dynamiclib -Wl,-headerpad_max_install_names -m64 -Wl,-dead_strip_dylibs -o ../../lib/libThread.so -install_name @rpath/libThread.so CMakeFiles/Thread.dir/src/TCondition.cxx
.o CMakeFiles/Thread.dir/src/TConditionImp.cxx.o CMakeFiles/Thread.dir/src/TMutex.cxx.o CMakeFiles/Thread.dir/src/TMutexImp.cxx.o CMakeFiles/Thread.dir/src/TReentrantRWLock.cxx.o CMakeFiles/Thread.dir/src/TRWLock.
cxx.o CMakeFiles/Thread.dir/src/TRWMutexImp.cxx.o CMakeFiles/Thread.dir/src/TRWSpinLock.cxx.o CMakeFiles/Thread.dir/src/TSemaphore.cxx.o CMakeFiles/Thread.dir/src/TThread.cxx.o CMakeFiles/Thread.dir/src/TThreadFactory.cxx.o CMakeFiles/Thread.dir/src/TThreadImp.cxx.o CMakeFiles/Thread.dir/src/TPosixCondition.cxx.o CMakeFiles/Thread.dir/src/TPosixMutex.cxx.o CMakeFiles/Thread.dir/src/TPosixThread.cxx.o CMakeFiles/Thread.dir/src/TPosixThreadFactory.cxx.o CMakeFiles/G__Thread.dir/G__Thread.cxx.o  -Wl,-rpath,/Users/sailer/SPI/lcgcmake/projects/ROOT-c050cbde/src/ROOT-c050cbde-build/lib -Wl,-rpath,/Users/sailer/SPI/install/dev3/tbb/2023.1.0/arm64-mac26-clang170-opt/lib ../../lib/libCore.so /Users/sailer/SPI/install/dev3/tbb/2023.1.0/arm64-mac26-clang170-opt/lib/libtbb.dylib

Note the rpath setting before libtbb.dylib here

Checklist:

  • tested changes locally for macos 26

@github-actions

github-actions Bot commented Aug 17, 2026

Copy link
Copy Markdown

Test Results

     6 files       6 suites   23h 3m 28s ⏱️
 3 807 tests  3 802 ✅ 5 💤 0 ❌
20 993 runs  20 993 ✅ 0 💤 0 ❌

Results for commit 4887ff4.

♻️ This comment has been updated with latest results.


if(TBB_FOUND)
add_library(TBB::tbb IMPORTED STATIC GLOBAL)
add_library(TBB::tbb IMPORTED UNKNOWN GLOBAL)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side note: this may (or may not) also be beneficial on Windows (CMake documentation says "[using] UNKOWN ... This is especially useful on Windows where a static library and a DLL's import library both have the same file extension.")

@pcanal

pcanal commented Aug 17, 2026

Copy link
Copy Markdown
Member

@andresailer We currently do not support merging in local branches named master. All the CI build fails with:

Fatal error:  The branch name in the fork and the base-ref are both called master. This is not supported. Please change the name of the branch in the forked repository.

@andresailer

Copy link
Copy Markdown
Contributor Author

Replaced by #23089

Since Github utterly failed, I couldn't replace it until end of business yesterday

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants