WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 3a67b95

Browse files
committed
build: stop linking to debug TBB version on Linux
1 parent 703351d commit 3a67b95

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

cmake/TBB.cmake

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,17 @@ include("cmake/Threading.cmake")
2525

2626
macro(handle_tbb_target)
2727
if(TBB_FOUND)
28-
set_property(TARGET TBB::tbb PROPERTY "MAP_IMPORTED_CONFIG_RELWITHMDD" "DEBUG")
28+
if(WIN32)
29+
# On Windows we must link to debug version of TBB library to ensure ABI compatibility
30+
# with MSVC debug runtime.
31+
set_property(TARGET TBB::tbb PROPERTY "MAP_IMPORTED_CONFIG_RELWITHMDD" "DEBUG")
32+
else()
33+
# On Linux TBB::tbb target may link to libtbb_debug.so which is not compatible with libtbb.so. Linking
34+
# application to both may result in undefined behavior.
35+
# See https://uxlfoundation.github.io/oneTBB/main/intro/limitations.html#debug-tbb-in-the-sycl-program
36+
set_property(TARGET TBB::tbb PROPERTY "MAP_IMPORTED_CONFIG_RELWITHMDD" "RELEASE")
37+
set_property(TARGET TBB::tbb PROPERTY "MAP_IMPORTED_CONFIG_DEBUG" "RELEASE")
38+
endif()
2939
include_directories_with_host_compiler(${_tbb_include_dirs})
3040
list(APPEND EXTRA_SHARED_LIBS TBB::tbb)
3141

0 commit comments

Comments
 (0)