2
votes

I'm following along with the tutorial LLVM provides to get familiar with its IR that can be found here.

Unfortunately, it seems that when I add in the JIT support, the linker has some difficulty following along. Namely, I get a number of undefined symbols,

Undefined symbols for architecture x86_64: "_LLVMInitializeX86AsmParser", referenced from: llvm::InitializeNativeTargetAsmParser() in lexer.cc.o "_LLVMInitializeX86AsmPrinter", referenced from: llvm::InitializeNativeTargetAsmPrinter() in lexer.cc.o etc.

I'm building using CMAKE using the LLVM config and can find the headers in my include directories, so I'm unsure why the symbols can't be fine. My code is here, but isn't too specific to the problem. I'm on MacOS.

How can I make the linker find the header files or why is it not working?

1

1 Answers

0
votes

If you are using CMake, you need to add some LLVM components. Here is an excerpt from my CMakeLists.txt for the same chapter.

llvm_map_components_to_libnames(llvm_libs analysis core executionengine instcombine object orcjit runtimedyld scalaropts support native)

Relevant links: