Reputation: 101
I have some problems following the Kaleidoscope JIT chapter tutorial.
I compile with: (just like the tutorial page advises)
clang++ -g toy.cpp `llvm-config --cxxflags --ldflags --system-libs --libs core mcjit native` -rdynamic -O3 -o toy
/tmp/toy-ce525d.o: In function `llvm::orc::LegacyIRCompileLayer<llvm::orc::LegacyRTDyldObjectLinkingLayer, llvm::orc::SimpleCompiler>::addModule(unsigned long, std::unique_ptr<llvm::Module, std::default_delete<llvm::Module> >)':
/llvm-project/llvm/include/llvm/ExecutionEngine/Orc/IRCompileLayer.h:93: undefined reference to `llvm::orc::SimpleCompiler::operator()(llvm::Module&)'
/tmp/toy-ce525d.o: In function `llvm::orc::LegacyRTDyldObjectLinkingLayer::ConcreteLinkedObject<std::shared_ptr<llvm::RuntimeDyld::MemoryManager> >::finalize()':
/llvm-project/llvm/include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h:237: undefined reference to `llvm::orc::JITSymbolResolverAdapter::JITSymbolResolverAdapter(llvm::orc::ExecutionSession&, llvm::orc::SymbolResolver&, llvm::orc::MaterializationResponsibility*)'
/tmp/toy-ce525d.o: In function `llvm::orc::JITSymbolResolverAdapter::~JITSymbolResolverAdapter()':
/llvm-project/llvm/include/llvm/ExecutionEngine/Orc/Legacy.h:93: undefined reference to `vtable for llvm::orc::JITSymbolResolverAdapter'
/tmp/toy-ce525d.o: In function `KaleidoscopeJIT':
/home/user/Desktop/llvm/kaleidoscope/other/././KaleidoscopeJIT.h:45: undefined reference to `llvm::orc::ExecutionSession::ExecutionSession(std::shared_ptr<llvm::orc::SymbolStringPool>)'
/tmp/toy-ce525d.o: In function `llvm::DenseSet<llvm::orc::SymbolStringPtr, llvm::DenseMapInfo<llvm::DenseSet> > llvm::orc::lookupWithLegacyFn<llvm::orc::KaleidoscopeJIT::KaleidoscopeJIT()::{lambda(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)#1}>(llvm::orc::ExecutionSession&, llvm::orc::AsynchronousSymbolQuery&, llvm::DenseMapInfo<llvm::DenseSet> const&, llvm::orc::KaleidoscopeJIT::KaleidoscopeJIT()::{lambda(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)#1})':
/llvm-project/llvm/include/llvm/ExecutionEngine/Orc/Legacy.h:159: undefined reference to `llvm::orc::ExecutionSession::legacyFailQuery(llvm::orc::AsynchronousSymbolQuery&, llvm::Error)'
/llvm-project/llvm/include/llvm/ExecutionEngine/Orc/Legacy.h:151: undefined reference to `llvm::orc::AsynchronousSymbolQuery::notifySymbolMetRequiredState(llvm::orc::SymbolStringPtr const&, llvm::JITEvaluatedSymbol)'
/llvm-project/llvm/include/llvm/ExecutionEngine/Orc/Legacy.h:155: undefined reference to `llvm::orc::ExecutionSession::legacyFailQuery(llvm::orc::AsynchronousSymbolQuery&, llvm::Error)'
/llvm-project/llvm/include/llvm/ExecutionEngine/Orc/Legacy.h:166: undefined reference to `llvm::orc::AsynchronousSymbolQuery::handleComplete()'
/tmp/toy-ce525d.o:(.rodata._ZTVN4llvm3orc22LegacyLookupFnResolverIZNS0_15KaleidoscopeJITC1EvEUlRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE_EE[_ZTVN4llvm3orc22LegacyLookupFnResolverIZNS0_15KaleidoscopeJITC1EvEUlRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEE_EE]+0x30): undefined reference to `llvm::orc::SymbolResolver::anchor()'
LLVM project in version 10, clang++ in version 6.
$ uname -srmpo
Linux 4.15.0-72-generic x86_64 x86_64 GNU/Linux
$ clang++ --version
clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
$ llvm-config --version
10.0.0git
Upvotes: 5
Views: 950
Reputation: 20796
For those who are using the cmake build instructions I just had to add orcjit
to llvm_map_components_to_libnames
:
llvm_map_components_to_libnames(llvm_libs orcjit support core irreader)
Upvotes: 0
Reputation: 101
PradeepKumar fixed the issue in the comment.
This command compiles the code:
clang++ -g toy.cpp `llvm-config --cxxflags --ldflags --system-libs --libs core mcjit native orcjit` -rdynamic -O3 -o toy
Upvotes: 5