[llvm-dev] Link error on Linux
Mehdi Amini via llvm-dev
llvm-dev at lists.llvm.org
Fri Mar 25 00:38:27 PDT 2016
Since the log tells you that llvm::outs() is not found, and since it is supposed to be found in libLLVMSupport.a, you can try:
$ nm /home/a/build//lib/libLLVMSupport.a | grep ZN4llvm4outsEv
...
0000000000002070 T __ZN4llvm4outsEv
...
The output should have the symbol defined.
--
Mehdi
> On Mar 25, 2016, at 12:18 AM, Russell Wallace via llvm-dev <llvm-dev at lists.llvm.org> wrote:
>
> Tried that just now, same result.
>
> On Fri, Mar 25, 2016 at 6:58 AM, Snehasish Kumar <kumar.snehasish at gmail.com <mailto:kumar.snehasish at gmail.com>> wrote:
> Hi Russel,
>
> Can you try compiling aklo.o using -fno-rtti prior to linking?
>
> On Thu, Mar 24, 2016 at 11:44 PM, Russell Wallace via llvm-dev
> <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote:
> > I'm trying to link a program with LLVM on Linux. I've managed to take out
> > the test files from 'llvm-config --libs' but now it's getting errors with
> > missing symbols. The same program successfully links with the same version
> > of LLVM (3.8) on Windows, so it's not a problem with the code per se, it's
> > some kind of configuration issue. Any ideas?
> >
> > g++ -std=c++11 -I/home/a/llvm/include -I/home/a/build/include
> > -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS
> > -D__STDC_LIMIT_MACROS -g -O2 -L/home/a/build//lib
> > -lLLVMLTO -lLLVMObjCARCOpts -lLLVMSymbolize -lLLVMDebugInfoPDB
> > -lLLVMDebugInfoDWARF -lLLVMXCoreDisassembler -lLLVMXCoreCodeGen
> > -lLLVMXCoreDesc -lLLVMXCoreInfo -lLLVMXCoreAsmPrinter
> > -lLLVMSystemZDisassembler -lLLVMSystemZCodeGen -lLLVMSystemZAsmParser
> > -lLLVMSystemZDesc -lLLVMSystemZInfo -lLLVMSystemZAsmPrinter
> > -lLLVMSparcDisassembler -lLLVMSparcCodeGen -lLLVMSparcAsmParser
> > -lLLVMSparcDesc -lLLVMSparcInfo -lLLVMSparcAsmPrinter
> > -lLLVMPowerPCDisassembler -lLLVMPowerPCCodeGen -lLLVMPowerPCAsmParser
> > -lLLVMPowerPCDesc -lLLVMPowerPCInfo -lLLVMPowerPCAsmPrinter
> > -lLLVMNVPTXCodeGen -lLLVMNVPTXDesc -lLLVMNVPTXInfo -lLLVMNVPTXAsmPrinter
> > -lLLVMMSP430CodeGen -lLLVMMSP430Desc -lLLVMMSP430Info -lLLVMMSP430AsmPrinter
> > -lLLVMMipsDisassembler -lLLVMMipsCodeGen -lLLVMMipsAsmParser -lLLVMMipsDesc
> > -lLLVMMipsInfo -lLLVMMipsAsmPrinter -lLLVMHexagonDisassembler
> > -lLLVMHexagonCodeGen -lLLVMHexagonAsmParser -lLLVMHexagonDesc
> > -lLLVMHexagonInfo -lLLVMCppBackendCodeGen -lLLVMCppBackendInfo
> > -lLLVMBPFCodeGen -lLLVMBPFDesc -lLLVMBPFInfo -lLLVMBPFAsmPrinter
> > -lLLVMARMDisassembler -lLLVMARMCodeGen -lLLVMARMAsmParser -lLLVMARMDesc
> > -lLLVMARMInfo -lLLVMARMAsmPrinter -lLLVMAMDGPUCodeGen -lLLVMAMDGPUAsmParser
> > -lLLVMAMDGPUDesc -lLLVMAMDGPUUtils -lLLVMAMDGPUInfo -lLLVMAMDGPUAsmPrinter
> > -lLLVMAArch64Disassembler -lLLVMAArch64CodeGen -lLLVMAArch64AsmParser
> > -lLLVMAArch64Desc -lLLVMAArch64Info -lLLVMAArch64AsmPrinter
> > -lLLVMAArch64Utils -lLLVMMIRParser -lLLVMLibDriver -lLLVMOption
> > -lLLVMTableGen -lLLVMLineEditor -lLLVMX86Disassembler -lLLVMX86AsmParser
> > -lLLVMX86CodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMX86Desc
> > -lLLVMMCDisassembler -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils
> > -lLLVMMCJIT -lLLVMPasses -lLLVMipo -lLLVMVectorize -lLLVMLinker
> > -lLLVMIRReader -lLLVMAsmParser -lLLVMDebugInfoCodeView -lLLVMInterpreter
> > -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMInstrumentation
> > -lLLVMProfileData -lLLVMBitWriter -lLLVMOrcJIT -lLLVMTransformUtils
> > -lLLVMExecutionEngine -lLLVMTarget -lLLVMAnalysis -lLLVMRuntimeDyld
> > -lLLVMObject -lLLVMMCParser -lLLVMBitReader -lLLVMMC -lLLVMCore
> > -lLLVMSupport -ldl -lpthread -ltinfo -o aklo
> > aklo-aklo.o
> > aklo-aklo.o: In function `operator()':
> > /mnt/a2/aklo.cpp:442: undefined reference to `llvm::outs()'
> > aklo-aklo.o: In function `llvm::raw_ostream::operator<<(llvm::StringRef)':
> > /home/a/llvm/include/llvm/Support/raw_ostream.h:166: undefined reference to
> > `llvm::raw_ostream::write(char const*, unsigned long)'
> > aklo-aklo.o: In function `operator()':
> > /mnt/a2/aklo.cpp:443: undefined reference to `llvm::outs()'
> > /mnt/a2/aklo.cpp:447: undefined reference to `llvm::outs()'
> > /mnt/a2/aklo.cpp:450: undefined reference to `llvm::outs()'
> > /mnt/a2/aklo.cpp:452: undefined reference to `llvm::outs()'
> > aklo-aklo.o: In function `llvm::raw_ostream::operator<<(char const*)':
> > /home/a/llvm/include/llvm/Support/raw_ostream.h:166: undefined reference to
> > `llvm::raw_ostream::write(char const*, unsigned long)'
> > aklo-aklo.o: In function `llvm::raw_ostream::operator<<(llvm::StringRef)':
> > /home/a/llvm/include/llvm/Support/raw_ostream.h:166: undefined reference to
> > `llvm::raw_ostream::write(char const*, unsigned long)'
> > /home/a/llvm/include/llvm/Support/raw_ostream.h:166: undefined reference to
> > `llvm::raw_ostream::write(char const*, unsigned long)'
> > aklo-aklo.o: In function `operator()':
> > /mnt/a2/aklo.cpp:430: undefined reference to `llvm::errs()'
> > aklo-aklo.o: In function `llvm::raw_ostream::operator<<(char)':
> > /home/a/llvm/include/llvm/Support/raw_ostream.h:141: undefined reference to
> > `llvm::raw_ostream::write(unsigned char)'
> > aklo-aklo.o: In function `error(std::string)':
> > /mnt/a2/aklo.cpp:172: undefined reference to
> > `llvm::SourceMgr::PrintMessage(llvm::SMLoc, llvm::SourceMgr::DiagKind,
> > llvm::Twine const&, llvm::ArrayRef<llvm::SMRange>,
> > llvm::ArrayRef<llvm::SMFixIt>, bool) const'
> > aklo-aklo.o: In function `print(long)':
> > /mnt/a2/aklo.cpp:388: undefined reference to `llvm::outs()'
> > /mnt/a2/aklo.cpp:393: undefined reference to `llvm::outs()'
> > aklo-aklo.o: In function `llvm::raw_ostream::operator<<(char)':
> > /home/a/llvm/include/llvm/Support/raw_ostream.h:141: undefined reference to
> > `llvm::raw_ostream::write(unsigned char)'
> > aklo-aklo.o: In function `print(long)':
> > /mnt/a2/aklo.cpp:395: undefined reference to `llvm::outs()'
> > /mnt/a2/aklo.cpp:401: undefined reference to `llvm::outs()'
> > /mnt/a2/aklo.cpp:398: undefined reference to `llvm::outs()'
> > aklo-aklo.o: In function `llvm::raw_ostream::operator<<(char)':
> > /home/a/llvm/include/llvm/Support/raw_ostream.h:141: undefined reference to
> > `llvm::raw_ostream::write(unsigned char)'
> > aklo-aklo.o: In function `llvm::StringMap<long,
> > llvm::MallocAllocator>::find(llvm::StringRef) const':
> > /home/a/llvm/include/llvm/ADT/StringMap.h:284: undefined reference to
> > `llvm::StringMapImpl::FindKey(llvm::StringRef) const'
> > aklo-aklo.o: In function `llvm::StringMap<long,
> > llvm::MallocAllocator>::insert(std::pair<llvm::StringRef, long>)':
> > /home/a/llvm/include/llvm/ADT/StringMap.h:331: undefined reference to
> > `llvm::StringMapImpl::LookupBucketFor(llvm::StringRef)'
> > /home/a/llvm/include/llvm/ADT/StringMap.h:344: undefined reference to
> > `llvm::StringMapImpl::RehashTable(unsigned int)'
> > aklo-aklo.o: In function `llvm::raw_ostream::operator<<(char const*)':
> > /home/a/llvm/include/llvm/Support/raw_ostream.h:166: undefined reference to
> > `llvm::raw_ostream::write(char const*, unsigned long)'
> > aklo-aklo.o: In function `llvm::raw_ostream::operator<<(std::string
> > const&)':
> > /home/a/llvm/include/llvm/Support/raw_ostream.h:184: undefined reference to
> > `llvm::raw_ostream::write(char const*, unsigned long)'
> > aklo-aklo.o: In function `print(long)':
> > /mnt/a2/aklo.cpp:398: undefined reference to
> > `llvm::raw_ostream::operator<<(long)'
> > aklo-aklo.o: In function `llvm::raw_ostream::operator<<(char)':
> > /home/a/llvm/include/llvm/Support/raw_ostream.h:141: undefined reference to
> > `llvm::raw_ostream::write(unsigned char)'
> > aklo-aklo.o: In function `llvm::cl::list<std::string, bool,
> > llvm::cl::parser<std::string> >::getOptionWidth() const':
> > /home/a/llvm/include/llvm/Support/CommandLine.h:1387: undefined reference to
> > `llvm::cl::basic_parser_impl::getOptionWidth(llvm::cl::Option const&) const'
> > aklo-aklo.o: In function `llvm::cl::list<std::string, bool,
> > llvm::cl::parser<std::string> >::printOptionInfo(unsigned long) const':
> > /home/a/llvm/include/llvm/Support/CommandLine.h:1390: undefined reference to
> > `llvm::cl::basic_parser_impl::printOptionInfo(llvm::cl::Option const&,
> > unsigned long) const'
> > aklo-aklo.o: In function `~basic_parser':
> > /home/a/llvm/include/llvm/Support/CommandLine.h:763: undefined reference to
> > `vtable for llvm::cl::basic_parser<std::string>'
> > aklo-aklo.o: In function `~Option':
> > /home/a/llvm/include/llvm/Support/CommandLine.h:290: undefined reference to
> > `vtable for llvm::cl::Option'
> > aklo-aklo.o: In function `~basic_parser':
> > /home/a/llvm/include/llvm/Support/CommandLine.h:763: undefined reference to
> > `vtable for llvm::cl::basic_parser<std::string>'
> > aklo-aklo.o: In function `~Option':
> > /home/a/llvm/include/llvm/Support/CommandLine.h:290: undefined reference to
> > `vtable for llvm::cl::Option'
> > aklo-aklo.o: In function `llvm::raw_ostream::operator<<(llvm::StringRef)':
> > /home/a/llvm/include/llvm/Support/raw_ostream.h:166: undefined reference to
> > `llvm::raw_ostream::write(char const*, unsigned long)'
> > aklo-aklo.o: In function `main':
> > /mnt/a2/aklo.cpp:434: undefined reference to
> > `llvm::sys::PrintStackTraceOnErrorSignal(bool)'
> > aklo-aklo.o: In function `PrettyStackTraceProgram':
> > /home/a/llvm/include/llvm/Support/PrettyStackTrace.h:63: undefined reference
> > to `llvm::PrettyStackTraceEntry::PrettyStackTraceEntry()'
> > /home/a/llvm/include/llvm/Support/PrettyStackTrace.h:63: undefined reference
> > to `vtable for llvm::PrettyStackTraceProgram'
> > /home/a/llvm/include/llvm/Support/PrettyStackTrace.h:64: undefined reference
> > to `llvm::EnablePrettyStackTrace()'
> > aklo-aklo.o: In function `main':
> > /mnt/a2/aklo.cpp:456: undefined reference to
> > `llvm::cl::AddExtraVersionPrinter(void (*)())'
> > /mnt/a2/aklo.cpp:457: undefined reference to
> > `llvm::cl::ParseCommandLineOptions(int, char const* const*, char const*)'
> > /mnt/a2/aklo.cpp:460: undefined reference to
> > `llvm::MemoryBuffer::getFileOrSTDIN(llvm::Twine const&, long, bool)'
> > /mnt/a2/aklo.cpp:469: undefined reference to `llvm::outs()'
> > aklo-aklo.o: In function `~PrettyStackTraceProgram':
> > /home/a/llvm/include/llvm/Support/PrettyStackTrace.h:58: undefined reference
> > to `vtable for llvm::PrettyStackTraceProgram'
> > /home/a/llvm/include/llvm/Support/PrettyStackTrace.h:58: undefined reference
> > to `llvm::PrettyStackTraceEntry::~PrettyStackTraceEntry()'
> > aklo-aklo.o: In function `llvm::raw_ostream::operator<<(char)':
> > /home/a/llvm/include/llvm/Support/raw_ostream.h:141: undefined reference to
> > `llvm::raw_ostream::write(unsigned char)'
> > aklo-aklo.o: In function `main':
> > /mnt/a2/aklo.cpp:463: undefined reference to `llvm::errs()'
> > /mnt/a2/aklo.cpp:463: undefined reference to `llvm::SMDiagnostic::print(char
> > const*, llvm::raw_ostream&, bool, bool) const'
> > aklo-aklo.o: In function `PrettyStackTraceProgram':
> > /home/a/llvm/include/llvm/Support/PrettyStackTrace.h:63: undefined reference
> > to `llvm::PrettyStackTraceEntry::~PrettyStackTraceEntry()'
> > aklo-aklo.o: In function `~PrettyStackTraceProgram':
> > /home/a/llvm/include/llvm/Support/PrettyStackTrace.h:58: undefined reference
> > to `vtable for llvm::PrettyStackTraceProgram'
> > /home/a/llvm/include/llvm/Support/PrettyStackTrace.h:58: undefined reference
> > to `llvm::PrettyStackTraceEntry::~PrettyStackTraceEntry()'
> > aklo-aklo.o: In function `__static_initialization_and_destruction_0':
> > /mnt/a2/aklo.cpp:164: undefined reference to `llvm::SourceMgr::~SourceMgr()'
> > aklo-aklo.o: In function `Option':
> > /home/a/llvm/include/llvm/Support/CommandLine.h:253: undefined reference to
> > `vtable for llvm::cl::Option'
> > /home/a/llvm/include/llvm/Support/CommandLine.h:253: undefined reference to
> > `llvm::cl::GeneralCategory'
> > aklo-aklo.o: In function `parser':
> > /home/a/llvm/include/llvm/Support/CommandLine.h:938: undefined reference to
> > `vtable for llvm::cl::parser<std::string>'
> > aklo-aklo.o: In function `llvm::cl::list<std::string, bool,
> > llvm::cl::parser<std::string> >::done()':
> > /home/a/llvm/include/llvm/Support/CommandLine.h:1398: undefined reference to
> > `llvm::cl::Option::addArgument()'
> > aklo-aklo.o: In function `~basic_parser':
> > /home/a/llvm/include/llvm/Support/CommandLine.h:763: undefined reference to
> > `vtable for llvm::cl::basic_parser<std::string>'
> > aklo-aklo.o: In function `~Option':
> > /home/a/llvm/include/llvm/Support/CommandLine.h:290: undefined reference to
> > `vtable for llvm::cl::Option'
> > aklo-aklo.o:(.rodata._ZTIN4llvm2cl4listISsbNS0_6parserISsEEEE[_ZTIN4llvm2cl4listISsbNS0_6parserISsEEEE]+0x18):
> > undefined reference to `typeinfo for llvm::cl::Option'
> > aklo-aklo.o:(.rodata._ZTVN4llvm2cl4listISsbNS0_6parserISsEEEE[_ZTVN4llvm2cl4listISsbNS0_6parserISsEEEE]+0x20):
> > undefined reference to `llvm::cl::Option::anchor()'
> > aklo-aklo.o:(.rodata._ZTVN4llvm2cl4listISsbNS0_6parserISsEEEE[_ZTVN4llvm2cl4listISsbNS0_6parserISsEEEE]+0x48):
> > undefined reference to `llvm::cl::Option::addOccurrence(unsigned int,
> > llvm::StringRef, llvm::StringRef, bool)'
> > collect2: error: ld returned 1 exit status
> >
> >
> > _______________________________________________
> > LLVM Developers mailing list
> > llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev <http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev>
> >
>
>
>
> --
> Snehasish Kumar
> School of Computing Science
> Simon Fraser University
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160325/0020ef2c/attachment.html>
More information about the llvm-dev
mailing list