Fix/workaround initialization order of static TBB/MKL
Was caused by recent refactor of dependencies in 517870a4a1
.
While there is no fully reliable solution to this issue other than
making TBB a dynamic library dependency (as documentation tells us
to do), there seems to be simple workaround which doesn't require
deeper changed in build process and packaging.
Tested on Brecht's computer who managed to reproduce the issue on
Linux (T72015#857423).
This commit is contained in:
parent
71d53ab465
commit
18343c230d
Notes:
blender-bot
2023-02-14 04:56:36 +01:00
Referenced by issue #73371, Appending Collections to a new empty file and trying to save that file causes Blender to crash [cause identified!] Referenced by issue #73371, Appending Collections to a new empty file and trying to save that file causes Blender to crash [cause identified!] Referenced by issue #73371, Appending Collections to a new empty file and trying to save that file causes Blender to crash [cause identified!] Referenced by issue #73364, Crash when calling particle_sytem.co_hair() on disabled particles Referenced by issue #72679, Vertex Color on the Viewport Shading causes crash
|
@ -78,29 +78,11 @@ set(LIB
|
|||
bf_blenlib
|
||||
)
|
||||
|
||||
# Source: https://github.com/PixarAnimationStudios/USD/blob/master/BUILDING.md#linking-whole-archives
|
||||
if(WIN32)
|
||||
list(APPEND LIB
|
||||
${USD_LIBRARIES}
|
||||
)
|
||||
elseif(CMAKE_COMPILER_IS_GNUCXX)
|
||||
list(APPEND LIB
|
||||
-Wl,--whole-archive ${USD_LIBRARIES} -Wl,--no-whole-archive
|
||||
)
|
||||
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
||||
list(APPEND LIB
|
||||
-Wl,-force_load ${USD_LIBRARIES}
|
||||
)
|
||||
else()
|
||||
message(FATAL_ERROR "Unknown how to link USD with your compiler ${CMAKE_CXX_COMPILER_ID}")
|
||||
endif()
|
||||
|
||||
list(APPEND LIB
|
||||
${BOOST_LIBRARIES}
|
||||
)
|
||||
|
||||
list(APPEND LIB
|
||||
${TBB_LIBRARIES}
|
||||
)
|
||||
|
||||
blender_add_lib(bf_usd "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
|
||||
|
@ -111,3 +93,16 @@ if(WIN32)
|
|||
set_property(TARGET bf_usd APPEND_STRING PROPERTY LINK_FLAGS_RELWITHDEBINFO " /WHOLEARCHIVE:${USD_RELEASE_LIB}")
|
||||
set_property(TARGET bf_usd APPEND_STRING PROPERTY LINK_FLAGS_MINSIZEREL " /WHOLEARCHIVE:${USD_RELEASE_LIB}")
|
||||
endif()
|
||||
|
||||
# Source: https://github.com/PixarAnimationStudios/USD/blob/master/BUILDING.md#linking-whole-archives
|
||||
if(WIN32)
|
||||
target_link_libraries(bf_usd ${USD_LIBRARIES})
|
||||
elseif(CMAKE_COMPILER_IS_GNUCXX)
|
||||
target_link_libraries(bf_usd "-Wl,--whole-archive ${USD_LIBRARIES} -Wl,--no-whole-archive ${TBB_LIBRARIES}")
|
||||
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
||||
target_link_libraries(bf_usd -Wl,-force_load ${USD_LIBRARIES})
|
||||
else()
|
||||
message(FATAL_ERROR "Unknown how to link USD with your compiler ${CMAKE_CXX_COMPILER_ID}")
|
||||
endif()
|
||||
|
||||
target_link_libraries(bf_usd ${TBB_LIBRARIES})
|
||||
|
|
|
@ -38,6 +38,14 @@ blender_include_dirs(
|
|||
)
|
||||
|
||||
set(LIB
|
||||
# This forces TBB libraries to be in front of MKL (which is a part of OpenImageDenoise).
|
||||
#
|
||||
# The need of this comes to need to ensure static libraries initialization order, making it
|
||||
# so TBB is initialized prior to MKL (or any other dpeendnecy).
|
||||
#
|
||||
# This isn't fully robust but seems to work.
|
||||
${TBB_LIBRARIES}
|
||||
|
||||
bf_windowmanager
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue