[LLVMdev] undefined reference when using llvm-config

Duncan Sands baldrick at free.fr
Sat Jun 5 01:18:43 PDT 2010


Hi Tom,

> I'm trying to start a project based on llvm, but am running into some
> difficulties.  I started with the 'LLVM Project Guide', but got hung
> up in the complexities of configure.ac.  I'm now using llvm-config to
> provide the linker directives, but this results in undefined
> references:
>
> $ llvm-g++ `$HOME/local/bin/llvm-config --cppflags --ldflags --libs
> bitwriter` ModuleMaker.cpp
>
> Yields:
>
> /tmp/ccjh9OY1.o: In function `main':
> ModuleMaker.cpp:(.text+0x13): undefined reference to
> `llvm::LLVMContext::LLVMContext()'
> ModuleMaker.cpp:(.text+0x66): undefined reference to
> `llvm::Module::Module(llvm::StringRef, llvm::LLVMContext&)'
> ModuleMaker.cpp:(.text+0x7a): undefined reference to
> `llvm::Type::getInt32Ty(llvm::LLVMContext&)'

I'm pretty sure that the LLVMContext constructor is defined in libLLVMCore.a
What is the output of `llvm-config --libs bitwriter`?  Does it include
-lLLVMCore?

Ciao,

Duncan.

PS: There should be no need to use llvm-g++ rather than g++.  If it makes a
difference, then that is a bug.



More information about the llvm-dev mailing list