From f6b492c43dbd64c61aa6d6d98f7659a526a41326 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 8 May 2023 12:47:32 +0200 Subject: [PATCH] Build: use versioned TBB library to avoid conflicts with Linux system libs Other shared libraries already do this, but for TBB it was off by default. The conflict would happen when LD_LIBRARY_PATH is set which overrides rpath, either manually by the user or by the Steam launcher. Ref #107385, #104895 Pull Request: https://projects.blender.org/blender/blender/pulls/107587 --- build_files/build_environment/cmake/harvest.cmake | 2 +- build_files/build_environment/cmake/opensubdiv.cmake | 3 +-- build_files/build_environment/cmake/tbb.cmake | 6 ++++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/build_files/build_environment/cmake/harvest.cmake b/build_files/build_environment/cmake/harvest.cmake index 22b3c052511..da601e52354 100644 --- a/build_files/build_environment/cmake/harvest.cmake +++ b/build_files/build_environment/cmake/harvest.cmake @@ -254,7 +254,7 @@ else() harvest(spnav/include spnav/include "*.h") harvest(spnav/lib spnav/lib "*.a") harvest(tbb/include tbb/include "*.h") - harvest_rpath_lib(tbb/lib tbb/lib "libtbb${SHAREDLIBEXT}") + harvest_rpath_lib(tbb/lib tbb/lib "libtbb${SHAREDLIBEXT}*") harvest(theora/lib ffmpeg/lib "*.a") harvest(tiff/include tiff/include "*.h") harvest(tiff/lib tiff/lib "*.a") diff --git a/build_files/build_environment/cmake/opensubdiv.cmake b/build_files/build_environment/cmake/opensubdiv.cmake index 4f643868bfb..30c86dfdf4a 100644 --- a/build_files/build_environment/cmake/opensubdiv.cmake +++ b/build_files/build_environment/cmake/opensubdiv.cmake @@ -31,8 +31,7 @@ if(WIN32) else() set(OPENSUBDIV_EXTRA_ARGS ${OPENSUBDIV_EXTRA_ARGS} - -DTBB_INCLUDE_DIR=${LIBDIR}/tbb/include - -DTBB_tbb_LIBRARY=${LIBDIR}/tbb/lib/${LIBPREFIX}tbb${SHAREDLIBEXT} + -DTBB_LOCATION=${LIBDIR}/tbb ) endif() diff --git a/build_files/build_environment/cmake/tbb.cmake b/build_files/build_environment/cmake/tbb.cmake index 17b1f0fd869..b5db2a31a1d 100644 --- a/build_files/build_environment/cmake/tbb.cmake +++ b/build_files/build_environment/cmake/tbb.cmake @@ -7,6 +7,12 @@ set(TBB_EXTRA_ARGS -DTBB_BUILD_TESTS=Off -DCMAKE_DEBUG_POSTFIX=_debug ) +# TBB does not use soversion by default unlike other libs, but it's needed +# to avoid conflicts with incompatible TBB system libs in LD_LIBRARY_PATH +# or the Steam environment. +if(UNIX AND NOT APPLE) + list(APPEND TBB_EXTRA_ARGS -DTBB_SET_SOVERSION=ON) +endif() set(TBB_LIBRARY tbb) set(TBB_STATIC_LIBRARY Off)