LLVM error "option ... registered more than once" while loading libtvm.so


#1

Hi. I’ve faced LLVM error in tests after enabling llvm on my machine. Error goes from very early stage of loading libtvm.so library, the exact place is ctype.CDLL call located in python/tvm/_ffi/base.py, executed from any import tvm statement.

The error says

: CommandLine Error: Option 'disable-symbolication' registered more than once!
LLVM ERROR: inconsistency in registered CommandLine options

After some googling I’ve found the https://github.com/CastXML/CastXML/issues/102#issuecomment-372488956
discussion suggesting to replace ${LLVM_LIBS} with LLVM in cmake rules. It seems to work in my case. Could anyone who is more familiar with llvm please explain the problem and possibly review the solution?

Note: I’m using latest tvm (cmake-based build system) and llvm-5.0


OpenCL Runtime error
#2

I am using llvm 5.0 and it work fine.
But with llvm4.0 I see some issue then moved to 5.0


#3

Thank you for the reply. I’ve re-checked the issue and it seems that the problem is actual at least for my particular Linux distribution. Below is a patch witch seems to fix it. Thanks.

diff --git a/cmake/modules/LLVM.cmake b/cmake/modules/LLVM.cmake
index 3e896a60..1246efe2 100644
--- a/cmake/modules/LLVM.cmake
+++ b/cmake/modules/LLVM.cmake
@@ -10,7 +10,7 @@ if(NOT USE_LLVM STREQUAL "OFF")
   # Set flags that are only needed for LLVM target
   add_definitions(-DTVM_LLVM_VERSION=${TVM_LLVM_VERSION})
   file(GLOB COMPILER_LLVM_SRCS src/codegen/llvm/*.cc)
-  list(APPEND TVM_LINKER_LIBS ${LLVM_LIBS})
+  list(APPEND TVM_LINKER_LIBS LLVM)
   list(APPEND COMPILER_SRCS ${COMPILER_LLVM_SRCS})
   if(NOT MSVC)
     set_source_files_properties(${COMPILER_LLVM_SRCS}

#4

Same problem on Manjaro Linux with LLVM 6.0


#5

Marty1885, did my solution help in your case?


#6

Yes it fixes the problem. Thank you! :smiley:


#7

Sent the patch as a pull-request https://github.com/dmlc/tvm/pull/1461