[Build] Strip the static libraries symbol from the triton shared library (#1240)

This is to solve https://github.com/openai/triton/issues/1236

This commit hides the symbols of the shared libraries for
`libtriton.so`, so that when other object link against `libtriton.so`,
it won't have confilct.
This commit is contained in:
Stonepia
2023-02-23 15:39:31 +08:00
committed by GitHub
parent b5efa91e2a
commit a38d2defb8

View File

@@ -238,6 +238,10 @@ if(TRITON_BUILD_PYTHON_MODULE)
target_link_options(triton PRIVATE ${LLVM_LDFLAGS})
endif()
if (UNIX AND NOT APPLE)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--exclude-libs,ALL")
endif()
if(TRITON_BUILD_PYTHON_MODULE AND NOT WIN32)
set(CMAKE_SHARED_LIBRARY_SUFFIX ".so")
# Check if the platform is MacOS