[cfe-dev] build issues with c++ code on OpenBSD
Vladimir Kirillov
proger at uaoug.org.ua
Mon Jul 26 15:11:14 PDT 2010
Hello, cfe-dev!
I've been playing around with clang apis for some time lately
both on Mac OS X (built with usual ./configure && make) and OpenBSD
(built system g++ (4.2.1) with linker version scripts turned off
(binutils 2.15) and --enable-targets=host,cbe,cpp).
While clang++ builds example C++ code (using some stl) just fine
(using includes and libstdc++ from gcc 4.2.4), it bails out with a
bunch of 'undefined references' at link time on OpenBSD (OS X is just
fine with same flags)
Compiler output is included at the bottom.
I would be really glad if you take a look at it and tell me where to
look at to have linkage completed.
Thank you.
----
/home/proger/dev/llvm/Debug+Asserts/bin/clang++ -Xlinker -t -v -g -Wall -Werror -fno-rtti -DCLANG_RESOURCE_PATH=\"/home/proger/dev/llvm/Debug+Asserts/lib/clang/2.8\" -I/usr/local/include/c++/4.2.4 -I/usr/local/include/c++/4.2.4/i386-unknown-openbsd4.7 -I/usr/local/include/c++/4.2.4/backward -I/home/proger/dev/llvm/tools/clang/include `/home/proger/dev/llvm/Debug+Asserts/bin/llvm-config --cxxflags` -L/usr/local/lib `/home/proger/dev/llvm/Debug+Asserts/bin/llvm-config --ldflags` -lestdc++ -lclangFrontend -lclangDriver -lclangCodeGen -lclangSema -lclangChecker -lclangAnalysis -lclangIndex -lclangRewrite -lclangAST -lclangParse -lclangLex -lclangBasic -lLLVMMCDisassembler -lLLVMLinker -lLLVMipo -lLLVMInterpreter -lLLVMInstrumentation -lLLVMJIT -lLLVMExecutionEngine -lLLVMCppBackend -lLLVMCppBackendInfo -lLLVMCBackend -lLLVMCBackendInfo -lLLVMBitWriter -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMX86AsmPrinter -lLLVMX86Info -lLLVMAsmParser -lLLVMArchive -lLLVMBitReader -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMMCParser -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMTarget -lLLVMMC -lLLVMCore -lLLVMSupport -lLLVMSystem -o analyzer analyzer.cc
clang version 2.8 (trunk 109393)
Target: i386-unknown-openbsd4.7
Thread model: posix
"/home/proger/dev/llvm/Debug+Asserts/bin/clang" -cc1 -triple i386-unknown-openbsd4.7 -S -disable-free -main-file-name analyzer.cc -pic-level 2 -mdisable-fp-elim -mconstructor-aliases -target-cpu pentium4 -v -g -resource-dir /home/proger/dev/llvm/Debug+Asserts/lib/clang/2.8 -D CLANG_RESOURCE_PATH="/home/proger/dev/llvm/Debug+Asserts/lib/clang/2.8" -D _DEBUG -D _GNU_SOURCE -D __STDC_LIMIT_MACROS -D __STDC_CONSTANT_MACROS -I /usr/local/include/c++/4.2.4 -I /usr/local/include/c++/4.2.4/i386-unknown-openbsd4.7 -I /usr/local/include/c++/4.2.4/backward -I /home/proger/dev/llvm/tools/clang/include -I /home/proger/dev/llvm/include -I /home/proger/dev/llvm/include -Wall -Werror -Woverloaded-virtual -Wcast-qual -ferror-limit 19 -fmessage-length 0 -fno-rtti -fgnu-runtime -fdiagnostics-show-option -o /tmp/cc-KHDCXI.s -x c++ analyzer.cc
clang -cc1 version 2.8 based upon llvm 2.8svn hosted on i386-unknown-openbsd4.7
ignoring duplicate directory "/home/proger/dev/llvm/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include/c++/4.2.4
/usr/local/include/c++/4.2.4/i386-unknown-openbsd4.7
/usr/local/include/c++/4.2.4/backward
/home/proger/dev/llvm/tools/clang/include
/home/proger/dev/llvm/include
/usr/local/include
/home/proger/dev/llvm/Debug+Asserts/lib/clang/2.8/include
/usr/include
End of search list.
"/usr/bin/as" -o /tmp/cc-uT3dOU.o /tmp/cc-KHDCXI.s
"/usr/bin/ld" -e __start --eh-frame-hdr -Bdynamic -dynamic-linker /usr/libexec/ld.so -o analyzer /usr/lib/crt0.o /usr/lib/crtbegin.o -L/usr/lib/gcc-lib/i386-unknown-openbsd4.7/3.3.5 -L/usr/local/lib -L/home/proger/dev/llvm/Debug+Asserts/lib -t -lpthread -lm -lestdc++ -lclangFrontend -lclangDriver -lclangCodeGen -lclangSema -lclangChecker -lclangAnalysis -lclangIndex -lclangRewrite -lclangAST -lclangParse -lclangLex -lclangBasic -lLLVMMCDisassembler -lLLVMLinker -lLLVMipo -lLLVMInterpreter -lLLVMInstrumentation -lLLVMJIT -lLLVMExecutionEngine -lLLVMCppBackend -lLLVMCppBackendInfo -lLLVMCBackend -lLLVMCBackendInfo -lLLVMBitWriter -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMX86AsmPrinter -lLLVMX86Info -lLLVMAsmParser -lLLVMArchive -lLLVMBitReader -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMMCParser -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMTarget -lLLVMMC -lLLVMCore -lLLVMSupport -lLLVMSystem /tmp/cc-uT3dOU.o -lgcc -lc -lgcc /usr/lib/crtend.o
/usr/local/lib/libestdc++.so.11.0: warning: vsprintf() is often misused, please use vsnprintf()
/usr/local/lib/libestdc++.so.11.0: warning: strcpy() is almost always misused, please use strlcpy()
/usr/local/lib/libestdc++.so.11.0: warning: strcat() is almost always misused, please use strlcat()
/usr/local/lib/libestdc++.so.11.0: warning: sprintf() is often misused, please use snprintf()
/usr/bin/ld: warning: libc.so.55.0, needed by /usr/local/lib/libestdc++.so.11.0, may conflict with libc.so.56.0
/usr/lib/libc.so.55.0: warning: gets() is very unsafe; consider using fgets()
/usr/lib/libc.so.55.0: warning: mktemp() possibly used unsafely; consider using mkstemp()
/usr/lib/libc.so.55.0: warning: wcscpy() is almost always misused, please use wcslcpy()
/usr/lib/libc.so.55.0: warning: tmpnam() possibly used unsafely; consider using mkstemp()
/usr/lib/libc.so.55.0: warning: wcscat() is almost always misused, please use wcslcat()
/usr/lib/libc.so.55.0: warning: tempnam() possibly used unsafely; consider using mkstemp()
/usr/lib/libc.so.55.0: warning: getwd() possibly used unsafely; consider using getcwd()
/tmp/cc-uT3dOU.o(.text+0xf6): In function `clang::TextDiagnosticBuffer::TextDiagnosticBuffer()':
/home/proger/dev/sysrev/analyzer.cc:84: undefined reference to `clang::CompilerInstance::CompilerInstance()'
/tmp/cc-uT3dOU.o(.text+0x154): In function `ASTCRefConsumer::HandleTopLevelDecl(clang::DeclGroupRef)':
/home/proger/dev/sysrev/analyzer.cc:109: undefined reference to `llvm::LLVMContext::LLVMContext()'
/tmp/cc-uT3dOU.o(.text+0x172):/home/proger/dev/sysrev/analyzer.cc:55: undefined reference to `clang::CompilerInstance::setLLVMContext(llvm::LLVMContext*)'
/tmp/cc-uT3dOU.o(.text+0x1a4): In function `main':
/home/proger/dev/sysrev/analyzer.cc:116: undefined reference to `clang::Diagnostic::Diagnostic(clang::DiagnosticClient*)'
/tmp/cc-uT3dOU.o(.text+0x1f7):/home/proger/dev/sysrev/analyzer.cc:117: undefined reference to `clang::CompilerInvocation::CreateFromArgs(clang::CompilerInvocation&, char const**, char const**, clang::Diagnostic&)'
/tmp/cc-uT3dOU.o(.text+0x2de):/home/proger/dev/sysrev/analyzer.cc:148: undefined reference to `clang::CompilerInstance::createDiagnostics(int, char**)'
/tmp/cc-uT3dOU.o(.text+0x35b):/home/proger/dev/sysrev/analyzer.cc:156: undefined reference to `llvm::install_fatal_error_handler(void (*)(void*, std::string const&), void*)'
/tmp/cc-uT3dOU.o(.text+0x394):/home/proger/dev/sysrev/analyzer.cc:159: undefined reference to `clang::TextDiagnosticBuffer::FlushDiagnostics(clang::Diagnostic&) const'
/tmp/cc-uT3dOU.o(.text+0x4bb):/home/proger/dev/sysrev/analyzer.cc:168: undefined reference to `clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)'
/tmp/cc-uT3dOU.o(.text+0x4cc):/home/proger/dev/sysrev/analyzer.cc:182: undefined reference to `llvm::llvm_shutdown()'
/tmp/cc-uT3dOU.o(.text+0x511):/home/proger/dev/sysrev/analyzer.cc:185: undefined reference to `clang::Diagnostic::~Diagnostic()'
/tmp/cc-uT3dOU.o(.gnu.linkonce.t._ZN4llvm9OwningPtrIN5clang16CompilerInstanceEED2Ev+0x32): In function `std::_Vector_base<std::pair<clang::SourceLocation, std::string>, std::allocator<std::pair<clang::SourceLocation, std::string> > >::_Vector_impl::_Vector_impl(std::allocator<std::pair<clang::SourceLocation, std::string> > const&)':
/usr/local/include/c++/4.2.4/bits/stl_vector.h:89: undefined reference to `clang::CompilerInstance::~CompilerInstance()'
/tmp/cc-uT3dOU.o(.gnu.linkonce.t._ZN5clang20TextDiagnosticBufferD2Ev+0x17): In function `std::_Vector_base<std::pair<clang::SourceLocation, std::string>, std::allocator<std::pair<clang::SourceLocation, std::string> > >::_Vector_impl::_Vector_impl(std::allocator<std::pair<clang::SourceLocation, std::string> > const&)':
/usr/local/include/c++/4.2.4/ext/new_allocator.h:68: undefined reference to `vtable for clang::TextDiagnosticBuffer'
/tmp/cc-uT3dOU.o(.gnu.linkonce.t._ZN5clang20TextDiagnosticBufferD2Ev+0x67): In function `clang::TextDiagnosticBuffer::TextDiagnosticBuffer()':
/home/proger/dev/llvm/tools/clang/include/clang/AST/DeclBase.h:283: undefined reference to `clang::DiagnosticClient::~DiagnosticClient()'
/tmp/cc-uT3dOU.o(.gnu.linkonce.t._ZN5clang17ASTFrontendActionC2Ev+0x17): In function `std::_Vector_base<std::pair<clang::SourceLocation, std::string>, std::allocator<std::pair<clang::SourceLocation, std::string> > >::_Vector_impl::_Vector_impl(std::allocator<std::pair<clang::SourceLocation, std::string> > const&)':
/usr/local/include/c++/4.2.4/ext/new_allocator.h:68: undefined reference to `vtable for clang::ASTFrontendAction'
/tmp/cc-uT3dOU.o(.gnu.linkonce.t._ZN5clang17ASTFrontendActionC2Ev+0x32): In function `std::_Vector_base<std::pair<clang::SourceLocation, std::string>, std::allocator<std::pair<clang::SourceLocation, std::string> > >::_Vector_impl::_Vector_impl(std::allocator<std::pair<clang::SourceLocation, std::string> > const&)':
/usr/local/include/c++/4.2.4/bits/stl_vector.h:89: undefined reference to `clang::FrontendAction::FrontendAction()'
/tmp/cc-uT3dOU.o(.gnu.linkonce.t._ZN31ASTCrossReferenceAnalysisAction13ExecuteActionEv+0xd8): In function `clang::TextDiagnosticBuffer::TextDiagnosticBuffer()':
/home/proger/dev/llvm/tools/clang/include/clang/AST/Decl.h:745: undefined reference to `clang::ParseAST(clang::Preprocessor&, clang::ASTConsumer*, clang::ASTContext&, bool, bool, clang::CodeCompleteConsumer*)'
/tmp/cc-uT3dOU.o(.gnu.linkonce.t._ZN5clang17ASTFrontendActionD2Ev+0x17): In function `std::_Vector_base<std::pair<clang::SourceLocation, std::string>, std::allocator<std::pair<clang::SourceLocation, std::string> > >::_Vector_impl::_Vector_impl(std::allocator<std::pair<clang::SourceLocation, std::string> > const&)':
/usr/local/include/c++/4.2.4/ext/new_allocator.h:68: undefined reference to `vtable for clang::ASTFrontendAction'
/tmp/cc-uT3dOU.o(.gnu.linkonce.t._ZN5clang17ASTFrontendActionD2Ev+0x2e): In function `std::_Vector_base<std::pair<clang::SourceLocation, std::string>, std::allocator<std::pair<clang::SourceLocation, std::string> > >::_Vector_impl::_Vector_impl(std::allocator<std::pair<clang::SourceLocation, std::string> > const&)':
/home/proger/dev/llvm/tools/clang/include/clang/AST/DeclBase.h:273: undefined reference to `clang::FrontendAction::~FrontendAction()'
/tmp/cc-uT3dOU.o(.gnu.linkonce.t._ZN5clang11ASTConsumerC2Ev+0x16): In function `clang::ASTConsumer::ASTConsumer()':
: undefined reference to `vtable for clang::ASTConsumer'
/tmp/cc-uT3dOU.o(.gnu.linkonce.t._ZN15ASTCRefConsumer18HandleTopLevelDeclEN5clang12DeclGroupRefE+0x131): In function `ASTCRefConsumer::HandleTopLevelDecl(clang::DeclGroupRef)':
/home/proger/dev/sysrev/analyzer.cc:109: undefined reference to `clang::DeclarationName::getAsString() const'
/tmp/cc-uT3dOU.o(.gnu.linkonce.t._ZNK5clang11DeclContext16getLookupContextEv+0x21): In function `std::_Vector_base<std::pair<clang::SourceLocation, std::string>, std::allocator<std::pair<clang::SourceLocation, std::string> > >::_Vector_impl::_Vector_impl(std::allocator<std::pair<clang::SourceLocation, std::string> > const&)':
/home/proger/dev/llvm/tools/clang/include/clang/Frontend/FrontendAction.h:154: undefined reference to `clang::DeclContext::getLookupContext()'
/tmp/cc-uT3dOU.o(.gnu.linkonce.t._ZN5clang11ASTConsumerD2Ev+0x16): In function `clang::ASTConsumer::~ASTConsumer()':
: undefined reference to `vtable for clang::ASTConsumer'
/tmp/cc-uT3dOU.o(.gnu.linkonce.t._ZN5clang17DiagnosticBuilderD2Ev+0x21): In function `std::_Vector_base<std::pair<clang::SourceLocation, std::string>, std::allocator<std::pair<clang::SourceLocation, std::string> > >::_Vector_impl::_Vector_impl(std::allocator<std::pair<clang::SourceLocation, std::string> > const&)':
/home/proger/dev/llvm/tools/clang/include/clang/Frontend/FrontendAction.h:154: undefined reference to `clang::DiagnosticBuilder::Emit()'
/tmp/cc-uT3dOU.o(.gnu.linkonce.t._ZN5clang20TextDiagnosticBufferC2Ev+0x22): In function `std::_Vector_base<std::pair<clang::SourceLocation, std::string>, std::allocator<std::pair<clang::SourceLocation, std::string> > >::_Vector_impl::_Vector_impl(std::allocator<std::pair<clang::SourceLocation, std::string> > const&)':
/home/proger/dev/llvm/include/llvm/ADT/PointerUnion.h:90: undefined reference to `vtable for clang::TextDiagnosticBuffer'
/tmp/cc-uT3dOU.o(.gnu.linkonce.t._ZN5clang16DiagnosticClientC2Ev+0x16): In function `clang::DiagnosticClient::DiagnosticClient()':
: undefined reference to `vtable for clang::DiagnosticClient'
/usr/bin/ld: link errors found, deleting executable `analyzer'
/usr/bin/ld: mode elf_i386_obsd
/usr/lib/crt0.o
/usr/lib/crtbegin.o
-lpthread (/usr/lib/libpthread.so.12.1)
-lm (/usr/lib/libm.so.5.2)
-lestdc++ (/usr/local/lib/libestdc++.so.11.0)
/tmp/cc-uT3dOU.o
-lc (/usr/lib/libc.so.56.0)
/usr/lib/crtend.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error code 1
More information about the cfe-dev
mailing list