Skip to content

Cmake: some people build shared libtbb - #23089

Open
andresailer wants to merge 1 commit into
root-project:masterfrom
andresailer:fixTBBMac26
Open

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

Conversation

@andresailer

Copy link
Copy Markdown
Contributor

This Pull request:

Replaces #23087

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 18, 2026

Copy link
Copy Markdown

Test Results

    16 files      16 suites   2d 13h 3m 50s ⏱️
 3 835 tests  3 833 ✅ 0 💤 2 ❌
53 840 runs  53 835 ✅ 2 💤 3 ❌

For more details on these failures, see this check.

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.") (@bellenot )

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.

We (ROOT) use builtin_tbb but I suppose you're right, if someone use his locally build TBB DLL, this might be useful...

@pcanal pcanal closed this Aug 18, 2026
@pcanal pcanal reopened this Aug 18, 2026

@pcanal pcanal left a comment

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.

LGTM. Thanks.

@andresailer

Copy link
Copy Markdown
Contributor Author

@bellenot Could you review this please?

@bellenot bellenot closed this Aug 19, 2026
@bellenot bellenot reopened this Aug 19, 2026

@bellenot bellenot left a comment

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.

LGTM, once all platforms are green...

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.

4 participants