[cfe-dev] undefined reference to `vtable for clang::ASTConsumer' LLVM 3.4.2 Release+Asserts build

Bogdan Tabacaru bogdan.tabacaru88 at yahoo.com
Wed Jul 23 05:27:55 PDT 2014


Hi everyone,

I am using CygWin 1.7.31 32-bit. 

I have downloaded llvm 3.4.2 with clang, compiler-rt and extra clang tools.

I configured llvm and clang in a "build"-directory with the default options (i.e., ../configure).
I built everything with the default configuration options and using REQUIRES_RTTI=1 (i.e., make REQUIRES_RTTI=1).
Afterwards, I tried to build the PrintFunctionNames example from ~/llvm/build/tools/clang/examples/PrintFunctionNames. (i.e., make REQUIRES_RTTI=1 BUILD_EXAMPLES=1).

It compiles successfully, but the linking fails.

$ cd ~/llvm-3.4.2.src/build/tools/clang/examples/PrintFunctionNames
$ make REQUIRES_RTTI=1 BUILD_EXAMPLES=1

llvm[0]: Linking Release+Asserts Shared Library cygPrintFunctionNames.dll
~/llvm-3.4.2.src/build/tools/clang/examples/PrintFunctionNames/Release+Asserts/PrintFunctionNames.o:PrintFunctionNames.cpp:(.text+0x6): undefined reference to `vtable for clang::ASTConsumer'
~/llvm-3.4.2.src/build/tools/clang/examples/PrintFunctionNames/Release+Asserts/PrintFunctionNames.o:PrintFunctionNames.cpp:(.text+0x16): undefined reference to `vtable for clang::ASTConsumer'
~/llvm-3.4.2.src/build/tools/clang/examples/PrintFunctionNames/Release+Asserts/PrintFunctionNames.o:PrintFunctionNames.cpp:(.text+0x26): undefined reference to `vtable for clang::ASTFrontendAction'
~/llvm-3.4.2.src/build/tools/clang/examples/PrintFunctionNames/Release+Asserts/PrintFunctionNames.o:PrintFunctionNames.cpp:(.text+0x3a): undefined reference to `vtable for clang::ASTFrontendAction'
~/llvm-3.4.2.src/build/tools/clang/examples/PrintFunctionNames/Release+Asserts/PrintFunctionNames.o:PrintFunctionNames.cpp:(.text+0x42): undefined reference to `clang::FrontendAction::~FrontendAction()'
~/llvm-3.4.2.src/build/tools/clang/examples/PrintFunctionNames/Release+Asserts/PrintFunctionNames.o:PrintFunctionNames.cpp:(.text+0xa8): undefined reference to `clang::FrontendAction::FrontendAction()'
~/llvm-3.4.2.src/build/tools/clang/examples/PrintFunctionNames/Release+Asserts/PrintFunctionNames.o:PrintFunctionNames.cpp:(.text+0x126): undefined reference to `llvm::raw_ostream::write(char const*, unsigned int)'
~/llvm-3.4.2.src/build/tools/clang/examples/PrintFunctionNames/Release+Asserts/PrintFunctionNames.o:PrintFunctionNames.cpp:(.text+0x17f): undefined reference to `clang::DeclarationName::getAsString() const'
~/llvm-3.4.2.src/build/tools/clang/examples/PrintFunctionNames/Release+Asserts/PrintFunctionNames.o:PrintFunctionNames.cpp:(.text+0x187): undefined reference to `llvm::errs()'
~/llvm-3.4.2.src/build/tools/clang/examples/PrintFunctionNames/Release+Asserts/PrintFunctionNames.o:PrintFunctionNames.cpp:(.text+0x1ae): undefined reference to `llvm::raw_ostream::write(char const*, unsigned int)'
~/llvm-3.4.2.src/build/tools/clang/examples/PrintFunctionNames/Release+Asserts/PrintFunctionNames.o:PrintFunctionNames.cpp:(.text+0x1f4): undefined reference to `llvm::raw_ostream::write(char const*, unsigned int)'
~/llvm-3.4.2.src/build/tools/clang/examples/PrintFunctionNames/Release+Asserts/PrintFunctionNames.o:PrintFunctionNames.cpp:(.text+0x2c3): undefined reference to `llvm::raw_ostream::write(char const*, unsigned int)'
~/llvm-3.4.2.src/build/tools/clang/examples/PrintFunctionNames/Release+Asserts/PrintFunctionNames.o:PrintFunctionNames.cpp:(.text+0x301): undefined reference to `llvm::errs()'
~/llvm-3.4.2.src/build/tools/clang/examples/PrintFunctionNames/Release+Asserts/PrintFunctionNames.o:PrintFunctionNames.cpp:(.text+0x331): undefined reference to `llvm::raw_ostream::write(char const*, unsigned int)'
~/llvm-3.4.2.src/build/tools/clang/examples/PrintFunctionNames/Release+Asserts/PrintFunctionNames.o:PrintFunctionNames.cpp:(.text+0x354): undefined reference to `llvm::raw_ostream::write(char const*, unsigned int)'
~/llvm-3.4.2.src/build/tools/clang/examples/PrintFunctionNames/Release+Asserts/PrintFunctionNames.o:PrintFunctionNames.cpp:(.text+0x387): undefined reference to `llvm::errs()'
~/llvm-3.4.2.src/build/tools/clang/examples/PrintFunctionNames/Release+Asserts/PrintFunctionNames.o:PrintFunctionNames.cpp:(.text+0x49b): undefined reference to `clang::DiagnosticIDs::getCustomDiagID(clang::DiagnosticIDs::Level, llvm::StringRef)'
~/llvm-3.4.2.src/build/tools/clang/examples/PrintFunctionNames/Release+Asserts/PrintFunctionNames.o:PrintFunctionNames.cpp:(.text+0x503): undefined reference to `clang::DiagnosticsEngine::EmitCurrentDiagnostic(bool)'
~/llvm-3.4.2.src/build/tools/clang/examples/PrintFunctionNames/Release+Asserts/PrintFunctionNames.o:PrintFunctionNames.cpp:(.text+0x525): undefined reference to `llvm::raw_ostream::write(char const*, unsigned int)'
~/llvm-3.4.2.src/build/tools/clang/examples/PrintFunctionNames/Release+Asserts/PrintFunctionNames.o:PrintFunctionNames.cpp:(.text+0x2b): undefined reference to `clang::FrontendAction::~FrontendAction()'
~/llvm-3.4.2.src/build/tools/clang/examples/PrintFunctionNames/Release+Asserts/PrintFunctionNames.o:PrintFunctionNames.cpp:(.rdata+0x658): undefined reference to `clang::ASTConsumer::HandleInterestingDecl(clang::DeclGroupRef)'
~/llvm-3.4.2.src/build/tools/clang/examples/PrintFunctionNames/Release+Asserts/PrintFunctionNames.o:PrintFunctionNames.cpp:(.rdata+0x66c): undefined reference to `clang::ASTConsumer::HandleTopLevelDeclInObjCContainer(clang::DeclGroupRef)'
~/llvm-3.4.2.src/build/tools/clang/examples/PrintFunctionNames/Release+Asserts/PrintFunctionNames.o:PrintFunctionNames.cpp:(.rdata+0x670): undefined reference to `clang::ASTConsumer::HandleImplicitImportDecl(clang::ImportDecl*)'
~/llvm-3.4.2.src/build/tools/clang/examples/PrintFunctionNames/Release+Asserts/PrintFunctionNames.o:PrintFunctionNames.cpp:(.rdata+0x6b4): undefined reference to `clang::ASTFrontendAction::ExecuteAction()'
~/llvm-3.4.2.src/build/tools/clang/examples/PrintFunctionNames/Release+Asserts/PrintFunctionNames.o:PrintFunctionNames.cpp:(.rdata+0x6bc): undefined reference to `clang::FrontendAction::shouldEraseOutputFiles()'
~/llvm-3.4.2.src/build/tools/clang/examples/PrintFunctionNames/Release+Asserts/PrintFunctionNames.o:PrintFunctionNames.cpp:(.rdata+0x6e0): undefined reference to `clang::PluginASTAction::anchor()'
collect2: error: ld returned 1 exit status
~/llvm-3.4.2.src/Makefile.rules:1167: recipe for target '~/llvm-3.4.2.src/build/Release+Asserts/bin/cygPrintFunctionNames.dll' failed
make: *** [~/llvm-3.4.2.src/build/Release+Asserts/bin/cygPrintFunctionNames.dll] Error 1



I have even tried this with the -fno-rtti flag set. And I received the same error message.
I also tried it with the ENABLE_CXX11=1. It still does not work.

Thanks a lot for your help.

Kind Regards,
Bogdan

P.S. I am experiencing the same problem with llvm 3.5.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140723/35cf23ae/attachment.html>


More information about the cfe-dev mailing list