[LLVMdev] undefined reference when using llvm-config
Tom Hawkins
tomahawkins at gmail.com
Fri Jun 4 11:31:35 PDT 2010
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&)'
...
For reference:
$ $HOME/local/bin/llvm-config --cppflags --ldflags --libs bitwriter
-I/home/e0082888/local/include -D_DEBUG -D_GNU_SOURCE
-D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS
-L/home/e0082888/local/lib -lpthread -ldl -lm
-lLLVMBitWriter -lLLVMCore -lLLVMSupport -lLLVMSystem
I also get the same result if I remove 'bitwriter' from the
llvm-config argument list so as to link with all libraries.
Any suggestions? BTW, my llvm-g++ is from a ubuntu package, whereas
as the libraries I'm attempting to link against (2.7) were compiled
and installed locally. I've also tried g++ in place of llvm-g++, but
the results are the same.
Thanks for any help.
-Tom
More information about the llvm-dev
mailing list