Linking errors

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Linking errors

Ilya Mirsky
Hi,

I've posted a similar question a few days ago, but didn't get a satisfying reply (Thanks Jan). Maybe this time...
I'm trying to build a simple program which uses clang libs on linux with g++.
After failing at the linking phase using the llvm-config --ldflags --libs script, I've tried to copy-paste the output of the script directly into the g++ command, but unfortunately I still get an enormous amount of "undefined refernce to..." error messages.
What am I doing wrong? Please see the build output below:


g++ -I/home/mirskyil/src/llvm-svn/tools/clang/include/ -I/home/mirskyil/src/llvm-svn/include/ -D_DEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -g -fno-exceptions -fno-rtti -fPIC -Woverloaded-virtual -Wcast-qual -L/home/mirskyil/src/llvm-svn/Debug+Asserts/lib/ -lpthread -ldl -lm -lLLVMpic16passes -lLLVMMCDisassembler -lLLVMXCoreAsmPrinter -lLLVMXCoreCodeGen -lLLVMXCoreInfo -lLLVMSystemZAsmPrinter -lLLVMSystemZCodeGen -lLLVMSystemZInfo -lLLVMSparcAsmPrinter -lLLVMSparcCodeGen -lLLVMSparcInfo -lLLVMPowerPCAsmPrinter -lLLVMPowerPCCodeGen -lLLVMPowerPCInfo -lLLVMPIC16AsmPrinter -lLLVMPIC16CodeGen -lLLVMPIC16Info -lLLVMMipsAsmPrinter -lLLVMMipsCodeGen -lLLVMMipsInfo -lLLVMMSP430AsmPrinter -lLLVMMSP430CodeGen -lLLVMMSP430Info -lLLVMMBlazeAsmPrinter -lLLVMMBlazeCodeGen -lLLVMMBlazeInfo -lLLVMLinker -lLLVMipo -lLLVMInterpreter -lLLVMInstrumentation -lLLVMJIT -lLLVMExecutionEngine -lLLVMCppBackend -lLLVMCppBackendInfo -lLLVMCellSPUAsmPrinter -lLLVMCellSPUCodeGen -lLLVMCellSPUInfo -lLLVMCBackend -lLLVMCBackendInfo -lLLVMBlackfinAsmPrinter -lLLVMBlackfinCodeGen -lLLVMBlackfinInfo -lLLVMBitWriter -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMX86AsmPrinter -lLLVMX86Info -lLLVMAsmParser -lLLVMARMDisassembler -lLLVMARMAsmParser -lLLVMARMCodeGen -lLLVMARMAsmPrinter -lLLVMARMInfo -lLLVMArchive -lLLVMBitReader -lLLVMAlphaAsmPrinter -lLLVMAsmPrinter -lLLVMMCParser -lLLVMAlphaCodeGen -lLLVMSelectionDAG -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMTarget -lLLVMMC -lLLVMCore -lLLVMAlphaInfo -lLLVMSupport -lLLVMSystem -lclang -lclangAnalysis -lclangAST -lclangBasic -lclangChecker -lclangCodeGen -lclangDriver -lclangFrontend -lclangFrontendTool -lclangIndex -lclangLex -lclangParse -lclangRewrite -lclangSema -lclangSerialization CodeObfuscator.o  PreProcess.o  SrcHandler.o -o CodeObfuscator
SrcHandler.o: In function `SrcHandler':
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:46: undefined reference to `clang::Diagnostic::Diagnostic(clang::DiagnosticClient*)'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:48: undefined reference to `clang::FileManager::FileManager()'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:49: undefined reference to `clang::HeaderSearch::HeaderSearch(clang::FileManager&)'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:58: undefined reference to `clang::TargetInfo::CreateTargetInfo(clang::Diagnostic&, clang::TargetOptions&)'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:61: undefined reference to `clang::Preprocessor::Preprocessor(clang::Diagnostic&, clang::LangOptions const&, clang::TargetInfo const&, clang::SourceManager&, clang::HeaderSearch&, clang::IdentifierInfoLookup*, bool)'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:64: undefined reference to `llvm::raw_fd_ostream::raw_fd_ostream(char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, unsigned int)'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:67: undefined reference to `clang::IdentifierTable::IdentifierTable(clang::LangOptions const&, clang::IdentifierInfoLookup*)'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:68: undefined reference to `clang::SelectorTable::SelectorTable()'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:69: undefined reference to `clang::Builtin::Context::Context(clang::TargetInfo const&)'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:70: undefined reference to `clang::ASTContext::ASTContext(clang::LangOptions const&, clang::SourceManager&, clang::TargetInfo const&, clang::IdentifierTable&, clang::SelectorTable&, clang::Builtin::Context&, unsigned int)'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:72: undefined reference to `clang::ParseAST(clang::Preprocessor&, clang::ASTConsumer*, clang::ASTContext&, bool, bool, clang::CodeCompleteConsumer*)'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:72: undefined reference to `clang::ASTContext::~ASTContext()'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:72: undefined reference to `clang::SelectorTable::~SelectorTable()'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:72: undefined reference to `llvm::raw_fd_ostream::~raw_fd_ostream()'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:72: undefined reference to `clang::HeaderSearch::~HeaderSearch()'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:72: undefined reference to `clang::FileManager::~FileManager()'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:72: undefined reference to `clang::SourceManager::~SourceManager()'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:72: undefined reference to `clang::Diagnostic::~Diagnostic()'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:46: undefined reference to `clang::Diagnostic::Diagnostic(clang::DiagnosticClient*)'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:48: undefined reference to `clang::FileManager::FileManager()'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:49: undefined reference to `clang::HeaderSearch::HeaderSearch(clang::FileManager&)'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:58: undefined reference to `clang::TargetInfo::CreateTargetInfo(clang::Diagnostic&, clang::TargetOptions&)'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:61: undefined reference to `clang::Preprocessor::Preprocessor(clang::Diagnostic&, clang::LangOptions const&, clang::TargetInfo const&, clang::SourceManager&, clang::HeaderSearch&, clang::IdentifierInfoLookup*, bool)'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:64: undefined reference to `llvm::raw_fd_ostream::raw_fd_ostream(char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, unsigned int)'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:67: undefined reference to `clang::IdentifierTable::IdentifierTable(clang::LangOptions const&, clang::IdentifierInfoLookup*)'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:68: undefined reference to `clang::SelectorTable::SelectorTable()'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:69: undefined reference to `clang::Builtin::Context::Context(clang::TargetInfo const&)'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:70: undefined reference to `clang::ASTContext::ASTContext(clang::LangOptions const&, clang::SourceManager&, clang::TargetInfo const&, clang::IdentifierTable&, clang::SelectorTable&, clang::Builtin::Context&, unsigned int)'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:72: undefined reference to `clang::ParseAST(clang::Preprocessor&, clang::ASTConsumer*, clang::ASTContext&, bool, bool, clang::CodeCompleteConsumer*)'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:72: undefined reference to `clang::ASTContext::~ASTContext()'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:72: undefined reference to `clang::SelectorTable::~SelectorTable()'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:72: undefined reference to `llvm::raw_fd_ostream::~raw_fd_ostream()'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:72: undefined reference to `clang::HeaderSearch::~HeaderSearch()'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:72: undefined reference to `clang::FileManager::~FileManager()'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:72: undefined reference to `clang::SourceManager::~SourceManager()'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:72: undefined reference to `clang::Diagnostic::~Diagnostic()'
SrcHandler.o: In function `~DiagnosticBuilder':
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/Basic/Diagnostic.h:701: undefined reference to `clang::DiagnosticBuilder::Emit()'
SrcHandler.o: In function `clang::RecordType::classof(clang::Type const*)':
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/AST/Type.h:2351: undefined reference to `clang::RecordType::classof(clang::TagType const*)'
SrcHandler.o: In function `clang::EnumType::classof(clang::Type const*)':
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/AST/Type.h:2373: undefined reference to `clang::EnumType::classof(clang::TagType const*)'
SrcHandler.o: In function `clang::NamedDecl::getNameAsString() const':
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/AST/Decl.h:131: undefined reference to `clang::DeclarationName::getAsString() const'
SrcHandler.o: In function `clang::FunctionDecl::getParamDecl(unsigned int)':
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/AST/Decl.h:1333: undefined reference to `clang::FunctionDecl::getNumParams() const'
SrcHandler.o: In function `llvm::raw_ostream::flush()':
/home/mirskyil/src/llvm-svn/include/llvm/Support/raw_ostream.h:130: undefined reference to `llvm::raw_ostream::flush_nonempty()'
SrcHandler.o: In function `llvm::raw_ostream::operator<<(llvm::StringRef)':
/home/mirskyil/src/llvm-svn/include/llvm/Support/raw_ostream.h:160: undefined reference to `llvm::raw_ostream::write(char const*, unsigned int)'
SrcHandler.o: In function `llvm::raw_ostream::operator<<(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
/home/mirskyil/src/llvm-svn/include/llvm/Support/raw_ostream.h:176: undefined reference to `llvm::raw_ostream::write(char const*, unsigned int)'
SrcHandler.o: In function `clang::TypeLoc::getSourceRange() const':
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/AST/TypeLoc.h:96: undefined reference to `clang::TypeLoc::getEndLoc() const'
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/AST/TypeLoc.h:96: undefined reference to `clang::TypeLoc::getBeginLoc() const'
SrcHandler.o: In function `clang::TypeLoc::getNextTypeLoc() const':
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/AST/TypeLoc.h:112: undefined reference to `clang::TypeLoc::getNextTypeLocImpl(clang::TypeLoc)'
SrcHandler.o: In function `ASTConsumer':
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/AST/ASTConsumer.h:38: undefined reference to `vtable for clang::ASTConsumer'
SrcHandler.o: In function `~ASTConsumer':
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/AST/ASTConsumer.h:40: undefined reference to `vtable for clang::ASTConsumer'
SrcHandler.o: In function `SourceManager':
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/Basic/SourceManager.h:432: undefined reference to `llvm::BumpPtrAllocator::DefaultSlabAllocator'
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/Basic/SourceManager.h:432: undefined reference to `llvm::BumpPtrAllocator::BumpPtrAllocator(unsigned int, unsigned int, llvm::SlabAllocator&)'
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/Basic/SourceManager.h:433: undefined reference to `clang::SourceManager::clearIDTables()'
SrcHandler.o: In function `clang::SourceManager::getBuffer(clang::FileID, bool*) const':
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/Basic/SourceManager.h:538: undefined reference to `clang::SrcMgr::ContentCache::getBuffer(clang::Diagnostic&, clang::SourceManager const&, clang::SourceLocation, bool*) const'
SrcHandler.o: In function `clang::SourceManager::getFileID(clang::SourceLocation) const':
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/Basic/SourceManager.h:570: undefined reference to `clang::SourceManager::getFileIDSlow(unsigned int) const'
SrcHandler.o: In function `clang::RopePieceBTreeIterator::operator++()':
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/Rewrite/RewriteRope.h:135: undefined reference to `clang::RopePieceBTreeIterator::MoveToNextPiece()'
SrcHandler.o: In function `clang::RopePieceBTree::begin() const':
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/Rewrite/RewriteRope.h:158: undefined reference to `clang::RopePieceBTreeIterator::RopePieceBTreeIterator(void const*)'
SrcHandler.o: In function `~RewriteRope':
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/Rewrite/RewriteRope.h:195: undefined reference to `clang::RopePieceBTree::~RopePieceBTree()'
SrcHandler.o: In function `SrcRewriter::Initialize(clang::ASTContext&)':
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:118: undefined reference to `clang::Lexer::ComputePreamble(llvm::MemoryBuffer const*, unsigned int)'
SrcHandler.o: In function `SrcRewriter::HandleTopLevelSingleDecl(clang::Decl*)':
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:139: undefined reference to `clang::FunctionDecl::isMain() const'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:149: undefined reference to `clang::QualType::getAsString() const'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:148: undefined reference to `clang::FunctionDecl::getNumParams() const'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:158: undefined reference to `clang::QualType::getAsString() const'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:159: undefined reference to `clang::Type::isVoidType() const'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:174: undefined reference to `clang::Type::isVoidType() const'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:174: undefined reference to `clang::QualType::getAsString() const'
SrcHandler.o: In function `SrcRewriter::NormalizeFuncDecl(clang::FunctionDecl*)':
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:222: undefined reference to `clang::Rewriter::getRangeSize(clang::SourceRange) const'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:222: undefined reference to `clang::TypeLoc::getBeginLoc() const'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:240: undefined reference to `clang::FunctionDecl::getNumParams() const'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:247: undefined reference to `clang::QualType::getAsString() const'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:246: undefined reference to `clang::FunctionDecl::getNumParams() const'
SrcHandler.o: In function `SrcRewriter::HandleTranslationUnit(clang::ASTContext&)':
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:298: undefined reference to `clang::DeclContext::decls_begin() const'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:299: undefined reference to `clang::DeclContext::decls_end() const'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:321: undefined reference to `llvm::outs()'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:324: undefined reference to `llvm::errs()'
SrcHandler.o: In function `SrcRewriter::InsertText(clang::SourceLocation, llvm::StringRef, bool)':
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:378: undefined reference to `clang::Rewriter::InsertText(clang::SourceLocation, llvm::StringRef, bool)'
SrcHandler.o: In function `SrcRewriter::RemoveText(clang::SourceLocation, unsigned int)':
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:390: undefined reference to `clang::Rewriter::RemoveText(clang::SourceLocation, unsigned int)'
SrcHandler.o: In function `SrcRewriter::ReplaceText(clang::SourceLocation, unsigned int, llvm::StringRef)':
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:398: undefined reference to `clang::Rewriter::ReplaceText(clang::SourceLocation, unsigned int, llvm::StringRef)'
SrcHandler.o: In function `SrcRewriter::VisitDeclContext(clang::DeclContext*)':
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:466: undefined reference to `clang::DeclContext::decls_begin() const'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:466: undefined reference to `clang::DeclContext::decls_end() const'
SrcHandler.o: In function `SrcRewriter::VisitStmt(clang::Stmt*)':
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:486: undefined reference to `clang::CallExpr::getDirectCallee()'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:490: undefined reference to `clang::CallExpr::getDirectCallee()'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:496: undefined reference to `clang::Type::isVoidType() const'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:499: undefined reference to `clang::Rewriter::getRangeSize(clang::SourceRange) const'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:503: undefined reference to `clang::QualType::getAsString() const'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:505: undefined reference to `clang::Rewriter::getRangeSize(clang::SourceRange) const'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:513: undefined reference to `clang::QualType::getAsString() const'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:516: undefined reference to `clang::Rewriter::getRangeSize(clang::SourceRange) const'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:516: undefined reference to `clang::SourceManager::getCharacterData(clang::SourceLocation, bool*) const'
SrcHandler.o: In function `SrcRewriter::getCodeString(clang::SourceRange)':
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:538: undefined reference to `clang::SourceManager::getCharacterData(clang::SourceLocation, bool*) const'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:538: undefined reference to `clang::Rewriter::getRangeSize(clang::SourceRange) const'
SrcHandler.o: In function `clang::FunctionType const* clang::Type::getAs<clang::FunctionType>() const':
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/AST/Type.h:3657: undefined reference to `clang::Type::getUnqualifiedDesugaredType() const'
SrcHandler.o: In function `clang::StmtIteratorImpl<clang::StmtIterator, clang::Stmt*&>::operator*() const':
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/AST/StmtIterator.h:119: undefined reference to `clang::StmtIteratorBase::GetDeclExpr() const'
SrcHandler.o: In function `clang::StmtIteratorImpl<clang::StmtIterator, clang::Stmt*&>::operator++()':
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/AST/StmtIterator.h:93: undefined reference to `clang::StmtIteratorBase::NextVA()'
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/AST/StmtIterator.h:94: undefined reference to `clang::StmtIteratorBase::NextDecl(bool)'
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/AST/StmtIterator.h:97: undefined reference to `clang::StmtIteratorBase::NextVA()'
SrcHandler.o: In function `.L1206':
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/AST/TypeLocVisitor.h:36: undefined reference to `llvm::llvm_unreachable_internal(char const*, char const*, unsigned int)'
SrcHandler.o: In function `~StringMap':
/home/mirskyil/src/llvm-svn/include/llvm/ADT/StringMap.h:425: undefined reference to `llvm::BumpPtrAllocator::~BumpPtrAllocator()'
SrcHandler.o: In function `llvm::cast_convert_val<clang::DeclContext, clang::Decl*, clang::Decl*>::doit(clang::Decl const*)':
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/AST/DeclBase.h:1280: undefined reference to `clang::Decl::castToDeclContext(clang::Decl const*)'
SrcHandler.o: In function `~RewriteBuffer':
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/Rewrite/Rewriter.h:41: undefined reference to `clang::DeltaTree::~DeltaTree()'
SrcHandler.o: In function `llvm::isa_impl<clang::DeclContext, clang::Decl>::doit(clang::Decl const&)':
/home/mirskyil/src/llvm-svn/include/llvm/Support/Casting.h:55: undefined reference to `clang::DeclContext::classof(clang::Decl const*)'
SrcHandler.o:(.data.rel.ro._ZTV11SrcRewriter[vtable for SrcRewriter]+0x18): undefined reference to `clang::ASTConsumer::HandleInterestingDecl(clang::DeclGroupRef)'
collect2: ld returned 1 exit status
make: *** [all] Error 1



--
Best Regards,
Ilya Mirsky
www.cs.bgu.ac.il/~mirskyil


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Linking errors

Pedro Ferreira
Try removing the "-fno-rtti" option.


From: [hidden email] [mailto:[hidden email]] On Behalf Of Ilya Mirsky
Sent: 01 September 2010 12:18
To: [hidden email]
Subject: [cfe-dev] Linking errors

Hi,

I've posted a similar question a few days ago, but didn't get a satisfying reply (Thanks Jan). Maybe this time...
I'm trying to build a simple program which uses clang libs on linux with g++.
After failing at the linking phase using the llvm-config --ldflags --libs script, I've tried to copy-paste the output of the script directly into the g++ command, but unfortunately I still get an enormous amount of "undefined refernce to..." error messages.
What am I doing wrong? Please see the build output below:


g++ -I/home/mirskyil/src/llvm-svn/tools/clang/include/ -I/home/mirskyil/src/llvm-svn/include/ -D_DEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -g -fno-exceptions -fno-rtti -fPIC -Woverloaded-virtual -Wcast-qual -L/home/mirskyil/src/llvm-svn/Debug+Asserts/lib/ -lpthread -ldl -lm -lLLVMpic16passes -lLLVMMCDisassembler -lLLVMXCoreAsmPrinter -lLLVMXCoreCodeGen -lLLVMXCoreInfo -lLLVMSystemZAsmPrinter -lLLVMSystemZCodeGen -lLLVMSystemZInfo -lLLVMSparcAsmPrinter -lLLVMSparcCodeGen -lLLVMSparcInfo -lLLVMPowerPCAsmPrinter -lLLVMPowerPCCodeGen -lLLVMPowerPCInfo -lLLVMPIC16AsmPrinter -lLLVMPIC16CodeGen -lLLVMPIC16Info -lLLVMMipsAsmPrinter -lLLVMMipsCodeGen -lLLVMMipsInfo -lLLVMMSP430AsmPrinter -lLLVMMSP430CodeGen -lLLVMMSP430Info -lLLVMMBlazeAsmPrinter -lLLVMMBlazeCodeGen -lLLVMMBlazeInfo -lLLVMLinker -lLLVMipo -lLLVMInterpreter -lLLVMInstrumentation -lLLVMJIT -lLLVMExecutionEngine -lLLVMCppBackend -lLLVMCppBackendInfo -lLLVMCellSPUAsmPrinter -lLLVMCellSPUCodeGen -lLLVMCellSPUInfo -lLLVMCBackend -lLLVMCBackendInfo -lLLVMBlackfinAsmPrinter -lLLVMBlackfinCodeGen -lLLVMBlackfinInfo -lLLVMBitWriter -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMX86AsmPrinter -lLLVMX86Info -lLLVMAsmParser -lLLVMARMDisassembler -lLLVMARMAsmParser -lLLVMARMCodeGen -lLLVMARMAsmPrinter -lLLVMARMInfo -lLLVMArchive -lLLVMBitReader -lLLVMAlphaAsmPrinter -lLLVMAsmPrinter -lLLVMMCParser -lLLVMAlphaCodeGen -lLLVMSelectionDAG -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMTarget -lLLVMMC -lLLVMCore -lLLVMAlphaInfo -lLLVMSupport -lLLVMSystem -lclang -lclangAnalysis -lclangAST -lclangBasic -lclangChecker -lclangCodeGen -lclangDriver -lclangFrontend -lclangFrontendTool -lclangIndex -lclangLex -lclangParse -lclangRewrite -lclangSema -lclangSerialization CodeObfuscator.o  PreProcess.o  SrcHandler.o -o CodeObfuscator
SrcHandler.o: In function `SrcHandler':
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:46: undefined reference to `clang::Diagnostic::Diagnostic(clang::DiagnosticClient*)'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:48: undefined reference to `clang::FileManager::FileManager()'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:49: undefined reference to `clang::HeaderSearch::HeaderSearch(clang::FileManager&)'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:58: undefined reference to `clang::TargetInfo::CreateTargetInfo(clang::Diagnostic&, clang::TargetOptions&)'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:61: undefined reference to `clang::Preprocessor::Preprocessor(clang::Diagnostic&, clang::LangOptions const&, clang::TargetInfo const&, clang::SourceManager&, clang::HeaderSearch&, clang::IdentifierInfoLookup*, bool)'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:64: undefined reference to `llvm::raw_fd_ostream::raw_fd_ostream(char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, unsigned int)'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:67: undefined reference to `clang::IdentifierTable::IdentifierTable(clang::LangOptions const&, clang::IdentifierInfoLookup*)'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:68: undefined reference to `clang::SelectorTable::SelectorTable()'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:69: undefined reference to `clang::Builtin::Context::Context(clang::TargetInfo const&)'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:70: undefined reference to `clang::ASTContext::ASTContext(clang::LangOptions const&, clang::SourceManager&, clang::TargetInfo const&, clang::IdentifierTable&, clang::SelectorTable&, clang::Builtin::Context&, unsigned int)'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:72: undefined reference to `clang::ParseAST(clang::Preprocessor&, clang::ASTConsumer*, clang::ASTContext&, bool, bool, clang::CodeCompleteConsumer*)'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:72: undefined reference to `clang::ASTContext::~ASTContext()'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:72: undefined reference to `clang::SelectorTable::~SelectorTable()'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:72: undefined reference to `llvm::raw_fd_ostream::~raw_fd_ostream()'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:72: undefined reference to `clang::HeaderSearch::~HeaderSearch()'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:72: undefined reference to `clang::FileManager::~FileManager()'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:72: undefined reference to `clang::SourceManager::~SourceManager()'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:72: undefined reference to `clang::Diagnostic::~Diagnostic()'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:46: undefined reference to `clang::Diagnostic::Diagnostic(clang::DiagnosticClient*)'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:48: undefined reference to `clang::FileManager::FileManager()'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:49: undefined reference to `clang::HeaderSearch::HeaderSearch(clang::FileManager&)'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:58: undefined reference to `clang::TargetInfo::CreateTargetInfo(clang::Diagnostic&, clang::TargetOptions&)'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:61: undefined reference to `clang::Preprocessor::Preprocessor(clang::Diagnostic&, clang::LangOptions const&, clang::TargetInfo const&, clang::SourceManager&, clang::HeaderSearch&, clang::IdentifierInfoLookup*, bool)'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:64: undefined reference to `llvm::raw_fd_ostream::raw_fd_ostream(char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&, unsigned int)'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:67: undefined reference to `clang::IdentifierTable::IdentifierTable(clang::LangOptions const&, clang::IdentifierInfoLookup*)'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:68: undefined reference to `clang::SelectorTable::SelectorTable()'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:69: undefined reference to `clang::Builtin::Context::Context(clang::TargetInfo const&)'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:70: undefined reference to `clang::ASTContext::ASTContext(clang::LangOptions const&, clang::SourceManager&, clang::TargetInfo const&, clang::IdentifierTable&, clang::SelectorTable&, clang::Builtin::Context&, unsigned int)'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:72: undefined reference to `clang::ParseAST(clang::Preprocessor&, clang::ASTConsumer*, clang::ASTContext&, bool, bool, clang::CodeCompleteConsumer*)'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:72: undefined reference to `clang::ASTContext::~ASTContext()'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:72: undefined reference to `clang::SelectorTable::~SelectorTable()'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:72: undefined reference to `llvm::raw_fd_ostream::~raw_fd_ostream()'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:72: undefined reference to `clang::HeaderSearch::~HeaderSearch()'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:72: undefined reference to `clang::FileManager::~FileManager()'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:72: undefined reference to `clang::SourceManager::~SourceManager()'
/home/mirskyil/workspace/CodeObfuscator/src/SrcHandler.cpp:72: undefined reference to `clang::Diagnostic::~Diagnostic()'
SrcHandler.o: In function `~DiagnosticBuilder':
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/Basic/Diagnostic.h:701: undefined reference to `clang::DiagnosticBuilder::Emit()'
SrcHandler.o: In function `clang::RecordType::classof(clang::Type const*)':
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/AST/Type.h:2351: undefined reference to `clang::RecordType::classof(clang::TagType const*)'
SrcHandler.o: In function `clang::EnumType::classof(clang::Type const*)':
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/AST/Type.h:2373: undefined reference to `clang::EnumType::classof(clang::TagType const*)'
SrcHandler.o: In function `clang::NamedDecl::getNameAsString() const':
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/AST/Decl.h:131: undefined reference to `clang::DeclarationName::getAsString() const'
SrcHandler.o: In function `clang::FunctionDecl::getParamDecl(unsigned int)':
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/AST/Decl.h:1333: undefined reference to `clang::FunctionDecl::getNumParams() const'
SrcHandler.o: In function `llvm::raw_ostream::flush()':
/home/mirskyil/src/llvm-svn/include/llvm/Support/raw_ostream.h:130: undefined reference to `llvm::raw_ostream::flush_nonempty()'
SrcHandler.o: In function `llvm::raw_ostream::operator<<(llvm::StringRef)':
/home/mirskyil/src/llvm-svn/include/llvm/Support/raw_ostream.h:160: undefined reference to `llvm::raw_ostream::write(char const*, unsigned int)'
SrcHandler.o: In function `llvm::raw_ostream::operator<<(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
/home/mirskyil/src/llvm-svn/include/llvm/Support/raw_ostream.h:176: undefined reference to `llvm::raw_ostream::write(char const*, unsigned int)'
SrcHandler.o: In function `clang::TypeLoc::getSourceRange() const':
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/AST/TypeLoc.h:96: undefined reference to `clang::TypeLoc::getEndLoc() const'
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/AST/TypeLoc.h:96: undefined reference to `clang::TypeLoc::getBeginLoc() const'
SrcHandler.o: In function `clang::TypeLoc::getNextTypeLoc() const':
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/AST/TypeLoc.h:112: undefined reference to `clang::TypeLoc::getNextTypeLocImpl(clang::TypeLoc)'
SrcHandler.o: In function `ASTConsumer':
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/AST/ASTConsumer.h:38: undefined reference to `vtable for clang::ASTConsumer'
SrcHandler.o: In function `~ASTConsumer':
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/AST/ASTConsumer.h:40: undefined reference to `vtable for clang::ASTConsumer'
SrcHandler.o: In function `SourceManager':
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/Basic/SourceManager.h:432: undefined reference to `llvm::BumpPtrAllocator::DefaultSlabAllocator'
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/Basic/SourceManager.h:432: undefined reference to `llvm::BumpPtrAllocator::BumpPtrAllocator(unsigned int, unsigned int, llvm::SlabAllocator&)'
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/Basic/SourceManager.h:433: undefined reference to `clang::SourceManager::clearIDTables()'
SrcHandler.o: In function `clang::SourceManager::getBuffer(clang::FileID, bool*) const':
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/Basic/SourceManager.h:538: undefined reference to `clang::SrcMgr::ContentCache::getBuffer(clang::Diagnostic&, clang::SourceManager const&, clang::SourceLocation, bool*) const'
SrcHandler.o: In function `clang::SourceManager::getFileID(clang::SourceLocation) const':
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/Basic/SourceManager.h:570: undefined reference to `clang::SourceManager::getFileIDSlow(unsigned int) const'
SrcHandler.o: In function `clang::RopePieceBTreeIterator::operator++()':
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/Rewrite/RewriteRope.h:135: undefined reference to `clang::RopePieceBTreeIterator::MoveToNextPiece()'
SrcHandler.o: In function `clang::RopePieceBTree::begin() const':
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/Rewrite/RewriteRope.h:158: undefined reference to `clang::RopePieceBTreeIterator::RopePieceBTreeIterator(void const*)'
SrcHandler.o: In function `~RewriteRope':
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/Rewrite/RewriteRope.h:195: undefined reference to `clang::RopePieceBTree::~RopePieceBTree()'
SrcHandler.o: In function `SrcRewriter::Initialize(clang::ASTContext&)':
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:118: undefined reference to `clang::Lexer::ComputePreamble(llvm::MemoryBuffer const*, unsigned int)'
SrcHandler.o: In function `SrcRewriter::HandleTopLevelSingleDecl(clang::Decl*)':
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:139: undefined reference to `clang::FunctionDecl::isMain() const'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:149: undefined reference to `clang::QualType::getAsString() const'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:148: undefined reference to `clang::FunctionDecl::getNumParams() const'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:158: undefined reference to `clang::QualType::getAsString() const'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:159: undefined reference to `clang::Type::isVoidType() const'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:174: undefined reference to `clang::Type::isVoidType() const'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:174: undefined reference to `clang::QualType::getAsString() const'
SrcHandler.o: In function `SrcRewriter::NormalizeFuncDecl(clang::FunctionDecl*)':
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:222: undefined reference to `clang::Rewriter::getRangeSize(clang::SourceRange) const'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:222: undefined reference to `clang::TypeLoc::getBeginLoc() const'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:240: undefined reference to `clang::FunctionDecl::getNumParams() const'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:247: undefined reference to `clang::QualType::getAsString() const'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:246: undefined reference to `clang::FunctionDecl::getNumParams() const'
SrcHandler.o: In function `SrcRewriter::HandleTranslationUnit(clang::ASTContext&)':
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:298: undefined reference to `clang::DeclContext::decls_begin() const'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:299: undefined reference to `clang::DeclContext::decls_end() const'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:321: undefined reference to `llvm::outs()'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:324: undefined reference to `llvm::errs()'
SrcHandler.o: In function `SrcRewriter::InsertText(clang::SourceLocation, llvm::StringRef, bool)':
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:378: undefined reference to `clang::Rewriter::InsertText(clang::SourceLocation, llvm::StringRef, bool)'
SrcHandler.o: In function `SrcRewriter::RemoveText(clang::SourceLocation, unsigned int)':
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:390: undefined reference to `clang::Rewriter::RemoveText(clang::SourceLocation, unsigned int)'
SrcHandler.o: In function `SrcRewriter::ReplaceText(clang::SourceLocation, unsigned int, llvm::StringRef)':
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:398: undefined reference to `clang::Rewriter::ReplaceText(clang::SourceLocation, unsigned int, llvm::StringRef)'
SrcHandler.o: In function `SrcRewriter::VisitDeclContext(clang::DeclContext*)':
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:466: undefined reference to `clang::DeclContext::decls_begin() const'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:466: undefined reference to `clang::DeclContext::decls_end() const'
SrcHandler.o: In function `SrcRewriter::VisitStmt(clang::Stmt*)':
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:486: undefined reference to `clang::CallExpr::getDirectCallee()'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:490: undefined reference to `clang::CallExpr::getDirectCallee()'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:496: undefined reference to `clang::Type::isVoidType() const'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:499: undefined reference to `clang::Rewriter::getRangeSize(clang::SourceRange) const'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:503: undefined reference to `clang::QualType::getAsString() const'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:505: undefined reference to `clang::Rewriter::getRangeSize(clang::SourceRange) const'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:513: undefined reference to `clang::QualType::getAsString() const'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:516: undefined reference to `clang::Rewriter::getRangeSize(clang::SourceRange) const'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:516: undefined reference to `clang::SourceManager::getCharacterData(clang::SourceLocation, bool*) const'
SrcHandler.o: In function `SrcRewriter::getCodeString(clang::SourceRange)':
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:538: undefined reference to `clang::SourceManager::getCharacterData(clang::SourceLocation, bool*) const'
/home/mirskyil/workspace/CodeObfuscator/h/SrcRewriter.hpp:538: undefined reference to `clang::Rewriter::getRangeSize(clang::SourceRange) const'
SrcHandler.o: In function `clang::FunctionType const* clang::Type::getAs<clang::FunctionType>() const':
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/AST/Type.h:3657: undefined reference to `clang::Type::getUnqualifiedDesugaredType() const'
SrcHandler.o: In function `clang::StmtIteratorImpl<clang::StmtIterator, clang::Stmt*&>::operator*() const':
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/AST/StmtIterator.h:119: undefined reference to `clang::StmtIteratorBase::GetDeclExpr() const'
SrcHandler.o: In function `clang::StmtIteratorImpl<clang::StmtIterator, clang::Stmt*&>::operator++()':
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/AST/StmtIterator.h:93: undefined reference to `clang::StmtIteratorBase::NextVA()'
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/AST/StmtIterator.h:94: undefined reference to `clang::StmtIteratorBase::NextDecl(bool)'
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/AST/StmtIterator.h:97: undefined reference to `clang::StmtIteratorBase::NextVA()'
SrcHandler.o: In function `.L1206':
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/AST/TypeLocVisitor.h:36: undefined reference to `llvm::llvm_unreachable_internal(char const*, char const*, unsigned int)'
SrcHandler.o: In function `~StringMap':
/home/mirskyil/src/llvm-svn/include/llvm/ADT/StringMap.h:425: undefined reference to `llvm::BumpPtrAllocator::~BumpPtrAllocator()'
SrcHandler.o: In function `llvm::cast_convert_val<clang::DeclContext, clang::Decl*, clang::Decl*>::doit(clang::Decl const*)':
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/AST/DeclBase.h:1280: undefined reference to `clang::Decl::castToDeclContext(clang::Decl const*)'
SrcHandler.o: In function `~RewriteBuffer':
/home/mirskyil/src/llvm-svn/tools/clang/include/clang/Rewrite/Rewriter.h:41: undefined reference to `clang::DeltaTree::~DeltaTree()'
SrcHandler.o: In function `llvm::isa_impl<clang::DeclContext, clang::Decl>::doit(clang::Decl const&)':
/home/mirskyil/src/llvm-svn/include/llvm/Support/Casting.h:55: undefined reference to `clang::DeclContext::classof(clang::Decl const*)'
SrcHandler.o:(.data.rel.ro._ZTV11SrcRewriter[vtable for SrcRewriter]+0x18): undefined reference to `clang::ASTConsumer::HandleInterestingDecl(clang::DeclGroupRef)'
collect2: ld returned 1 exit status
make: *** [all] Error 1



--
Best Regards,
Ilya Mirsky
www.cs.bgu.ac.il/~mirskyil


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Linking errors

Douglas Gregor
In reply to this post by Ilya Mirsky

On Sep 1, 2010, at 4:17 AM, Ilya Mirsky wrote:

> Hi,
>
> I've posted a similar question a few days ago, but didn't get a satisfying reply (Thanks Jan). Maybe this time...
> I'm trying to build a simple program which uses clang libs on linux with g++.
> After failing at the linking phase using the llvm-config --ldflags --libs script, I've tried to copy-paste the output of the script directly into the g++ command, but unfortunately I still get an enormous amount of "undefined refernce to..." error messages.
> What am I doing wrong? Please see the build output below:
>
>
>  -lclang -lclangAnalysis -lclangAST -lclangBasic -lclangChecker -lclangCodeGen -lclangDriver -lclangFrontend -lclangFrontendTool -lclangIndex -lclangLex -lclangParse -lclangRewrite -lclangSema -lclangSerialization

Your link line is ordered incorrectly. The makefile for the "clang" executable shows the correct order:

USEDLIBS = clangFrontendTool.a clangFrontend.a clangDriver.a \
           clangSerialization.a clangCodeGen.a clangParse.a clangSema.a \
           clangChecker.a clangAnalysis.a clangIndex.a clangRewrite.a \
           clangAST.a clangLex.a clangBasic.a


        - Doug
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev