Commit b55a2d54 by Sergey Mironov Committed by Tianqi Chen

[BUILD] Fix LLVM static/dynamic link issue (#1461)

This patch prevents libtvm.so from both containing static parts of LLVM
and link with libLLVM.so by removing the latter from link list.
parent 36d3a41e
......@@ -18,7 +18,14 @@ macro(find_llvm use_llvm)
if(LLVM_CONFIG STREQUAL "ON")
find_package(LLVM REQUIRED CONFIG)
llvm_map_components_to_libnames(LLVM_LIBS all)
list(REMOVE_ITEM LLVM_LIBS LTO)
list (FIND LLVM_LIBS "LLVM" _llvm_dynlib_index)
if (${_llvm_dynlib_index} GREATER -1)
set(LLVM_LIBS LLVM)
message(STATUS "Link with dynamic LLVM library")
else()
list(REMOVE_ITEM LLVM_LIBS LTO)
message(STATUS "Link with static LLVM libraries")
endif()
set(TVM_LLVM_VERSION ${LLVM_VERSION_MAJOR}${LLVM_VERSION_MINOR})
elseif(NOT LLVM_CONFIG STREQUAL "OFF")
# use llvm config
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment