LLVM Discussion Forums

Opt: Option registered more than once!

When I run my pass, it comes with CommandLine Error

/home/happy/Source/build_llvm/bin/opt -load=libFiber.so --scp test.ll -S -o test_modified.ll
opt: CommandLine Error: Option 'debug' registered more than once!
LLVM ERROR: inconsistency in registered CommandLine options

seems it because I link the libs to my pass in cmake file, because if I don’t link libs and don’t use JIT like LLVMInitializeNativeTarget(), the pass works without error.

add_subdirectory(fiber)

#target_link_libraries(LLVMInterpreter LLVMExecutionEngine)
llvm_map_components_to_libnames(llvm_libs all)
target_link_libraries(Fiber ${llvm_libs})

But if I don’t use target_link_libraries, I cann’t use JIT Engine in my pass which says

llvm undefined symbol: LLVMLinkInInterpreter

I wonder how to link LLVMInterpreter LLVMExecutionEngine to my pass without conflict.
BTW, I wonder whether it’s suitable to use JIT in LLVM pass.

some reference links
http://llvm.1065342.n5.nabble.com/llvm-config-example-need-update-td23025.html


When I fix the LLVMLinkInInterpreter, It prompt with CommandLine ERROR.

Any possible CmakeLists.txt to compile interpreter successfully for JIT out-of-tree usage?Thanks