Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

Fix for Thread Sanitizer build fail (#38023)

Alec Leckeya4b1ef7632b7
diff --git a/thirdparty/protobuf/CMakeLists.txt b/thirdparty/protobuf/CMakeLists.txt
index ebe472e7823..200fe01874d 100644
--- a/thirdparty/protobuf/CMakeLists.txt
+++ b/thirdparty/protobuf/CMakeLists.txt
@@ -9,6 +9,11 @@
if(ENABLE_THREAD_SANITIZER AND OV_COMPILER_IS_CLANG)
string(REPLACE "-ltsan" "" CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
string(REPLACE "-shared-libsan" "" CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
+ # protobuf 26 vendors abseil/utf8_range; disable TSan for the whole subtree so
+ # instrumented deps can't leak into the -fno-sanitize=thread protoc link
+ string(APPEND CMAKE_C_FLAGS " -fno-sanitize=thread")
+ string(APPEND CMAKE_CXX_FLAGS " -fno-sanitize=thread")
+ string(REPLACE "-shared-libsan" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
endif()
set(BUILD_SHARED_LIBS OFF)