<div dir="ltr">Right, it needed to be in LDADD instead of LDFLAGS. The combination of that and -fno-rtti did the trick. Thanks!</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 25, 2016 at 7:47 AM, Mehdi Amini <span dir="ltr"><<a href="mailto:mehdi.amini@apple.com" target="_blank">mehdi.amini@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Looking again at your link line, I think static library has to appear after their uses. So try to put the .o before the list of library.<span class="HOEnZb"><font color="#888888"><div><br></div><div>-- </div><div>Mehdi</div></font></span><div><div class="h5"><div><br><div><blockquote type="cite"><div>On Mar 25, 2016, at 12:41 AM, Russell Wallace <<a href="mailto:russell.wallace@gmail.com" target="_blank">russell.wallace@gmail.com</a>> wrote:</div><br><div><div dir="ltr">Yeah, seems to.<div><br></div><div><div>a@a-VirtualBox:~$ nm /home/a/build//lib/libLLVMSupport.a | grep ZN4llvm4outsEv</div><div> U _ZN4llvm4outsEv</div><div> U _ZN4llvm4outsEv</div><div>0000000000000000 b _ZGVZN4llvm4outsEvE1S</div><div>0000000000000000 T _ZN4llvm4outsEv</div><div>0000000000000000 r _ZZN4llvm4outsEvE19__PRETTY_FUNCTION__</div><div>0000000000000000 b _ZZN4llvm4outsEvE1S</div><div> U _ZN4llvm4outsEv</div></div><div><br></div><div>I can try building with RTTI, it'll just take a few hours to run the build.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 25, 2016 at 7:38 AM, Mehdi Amini <span dir="ltr"><<a href="mailto:mehdi.amini@apple.com" target="_blank">mehdi.amini@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">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:<div><br></div><div>$ nm /home/a/build//lib/libLLVMSupport.a | grep ZN4llvm4outsEv</div><div>...</div><div>0000000000002070 T __ZN4llvm4outsEv<br>...</div><div><br></div><div><br></div><div>The output should have the symbol defined.</div><span><font color="#888888"><div><br></div><div>-- </div><div>Mehdi</div></font></span><div><div><div><br></div><div><br></div><div><br><div><blockquote type="cite"><div>On Mar 25, 2016, at 12:18 AM, Russell Wallace via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:</div><br><div><div dir="ltr">Tried that just now, same result.</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 25, 2016 at 6:58 AM, Snehasish Kumar <span dir="ltr"><<a href="mailto:kumar.snehasish@gmail.com" target="_blank">kumar.snehasish@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Russel,<br>
<br>
Can you try compiling aklo.o using -fno-rtti prior to linking?<br>
<div><div><br>
On Thu, Mar 24, 2016 at 11:44 PM, Russell Wallace via llvm-dev<br>
<<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br>
> I'm trying to link a program with LLVM on Linux. I've managed to take out<br>
> the test files from 'llvm-config --libs' but now it's getting errors with<br>
> missing symbols. The same program successfully links with the same version<br>
> of LLVM (3.8) on Windows, so it's not a problem with the code per se, it's<br>
> some kind of configuration issue. Any ideas?<br>
><br>
> g++ -std=c++11 -I/home/a/llvm/include -I/home/a/build/include<br>
> -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS<br>
> -D__STDC_LIMIT_MACROS -g -O2 -L/home/a/build//lib<br>
> -lLLVMLTO -lLLVMObjCARCOpts -lLLVMSymbolize -lLLVMDebugInfoPDB<br>
> -lLLVMDebugInfoDWARF -lLLVMXCoreDisassembler -lLLVMXCoreCodeGen<br>
> -lLLVMXCoreDesc -lLLVMXCoreInfo -lLLVMXCoreAsmPrinter<br>
> -lLLVMSystemZDisassembler -lLLVMSystemZCodeGen -lLLVMSystemZAsmParser<br>
> -lLLVMSystemZDesc -lLLVMSystemZInfo -lLLVMSystemZAsmPrinter<br>
> -lLLVMSparcDisassembler -lLLVMSparcCodeGen -lLLVMSparcAsmParser<br>
> -lLLVMSparcDesc -lLLVMSparcInfo -lLLVMSparcAsmPrinter<br>
> -lLLVMPowerPCDisassembler -lLLVMPowerPCCodeGen -lLLVMPowerPCAsmParser<br>
> -lLLVMPowerPCDesc -lLLVMPowerPCInfo -lLLVMPowerPCAsmPrinter<br>
> -lLLVMNVPTXCodeGen -lLLVMNVPTXDesc -lLLVMNVPTXInfo -lLLVMNVPTXAsmPrinter<br>
> -lLLVMMSP430CodeGen -lLLVMMSP430Desc -lLLVMMSP430Info -lLLVMMSP430AsmPrinter<br>
> -lLLVMMipsDisassembler -lLLVMMipsCodeGen -lLLVMMipsAsmParser -lLLVMMipsDesc<br>
> -lLLVMMipsInfo -lLLVMMipsAsmPrinter -lLLVMHexagonDisassembler<br>
> -lLLVMHexagonCodeGen -lLLVMHexagonAsmParser -lLLVMHexagonDesc<br>
> -lLLVMHexagonInfo -lLLVMCppBackendCodeGen -lLLVMCppBackendInfo<br>
> -lLLVMBPFCodeGen -lLLVMBPFDesc -lLLVMBPFInfo -lLLVMBPFAsmPrinter<br>
> -lLLVMARMDisassembler -lLLVMARMCodeGen -lLLVMARMAsmParser -lLLVMARMDesc<br>
> -lLLVMARMInfo -lLLVMARMAsmPrinter -lLLVMAMDGPUCodeGen -lLLVMAMDGPUAsmParser<br>
> -lLLVMAMDGPUDesc -lLLVMAMDGPUUtils -lLLVMAMDGPUInfo -lLLVMAMDGPUAsmPrinter<br>
> -lLLVMAArch64Disassembler -lLLVMAArch64CodeGen -lLLVMAArch64AsmParser<br>
> -lLLVMAArch64Desc -lLLVMAArch64Info -lLLVMAArch64AsmPrinter<br>
> -lLLVMAArch64Utils -lLLVMMIRParser -lLLVMLibDriver -lLLVMOption<br>
> -lLLVMTableGen -lLLVMLineEditor -lLLVMX86Disassembler -lLLVMX86AsmParser<br>
> -lLLVMX86CodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMX86Desc<br>
> -lLLVMMCDisassembler -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils<br>
> -lLLVMMCJIT -lLLVMPasses -lLLVMipo -lLLVMVectorize -lLLVMLinker<br>
> -lLLVMIRReader -lLLVMAsmParser -lLLVMDebugInfoCodeView -lLLVMInterpreter<br>
> -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMInstrumentation<br>
> -lLLVMProfileData -lLLVMBitWriter -lLLVMOrcJIT -lLLVMTransformUtils<br>
> -lLLVMExecutionEngine -lLLVMTarget -lLLVMAnalysis -lLLVMRuntimeDyld<br>
> -lLLVMObject -lLLVMMCParser -lLLVMBitReader -lLLVMMC -lLLVMCore<br>
> -lLLVMSupport -ldl -lpthread -ltinfo -o aklo<br>
> aklo-aklo.o<br>
> aklo-aklo.o: In function `operator()':<br>
> /mnt/a2/aklo.cpp:442: undefined reference to `llvm::outs()'<br>
> aklo-aklo.o: In function `llvm::raw_ostream::operator<<(llvm::StringRef)':<br>
> /home/a/llvm/include/llvm/Support/raw_ostream.h:166: undefined reference to<br>
> `llvm::raw_ostream::write(char const*, unsigned long)'<br>
> aklo-aklo.o: In function `operator()':<br>
> /mnt/a2/aklo.cpp:443: undefined reference to `llvm::outs()'<br>
> /mnt/a2/aklo.cpp:447: undefined reference to `llvm::outs()'<br>
> /mnt/a2/aklo.cpp:450: undefined reference to `llvm::outs()'<br>
> /mnt/a2/aklo.cpp:452: undefined reference to `llvm::outs()'<br>
> aklo-aklo.o: In function `llvm::raw_ostream::operator<<(char const*)':<br>
> /home/a/llvm/include/llvm/Support/raw_ostream.h:166: undefined reference to<br>
> `llvm::raw_ostream::write(char const*, unsigned long)'<br>
> aklo-aklo.o: In function `llvm::raw_ostream::operator<<(llvm::StringRef)':<br>
> /home/a/llvm/include/llvm/Support/raw_ostream.h:166: undefined reference to<br>
> `llvm::raw_ostream::write(char const*, unsigned long)'<br>
> /home/a/llvm/include/llvm/Support/raw_ostream.h:166: undefined reference to<br>
> `llvm::raw_ostream::write(char const*, unsigned long)'<br>
> aklo-aklo.o: In function `operator()':<br>
> /mnt/a2/aklo.cpp:430: undefined reference to `llvm::errs()'<br>
> aklo-aklo.o: In function `llvm::raw_ostream::operator<<(char)':<br>
> /home/a/llvm/include/llvm/Support/raw_ostream.h:141: undefined reference to<br>
> `llvm::raw_ostream::write(unsigned char)'<br>
> aklo-aklo.o: In function `error(std::string)':<br>
> /mnt/a2/aklo.cpp:172: undefined reference to<br>
> `llvm::SourceMgr::PrintMessage(llvm::SMLoc, llvm::SourceMgr::DiagKind,<br>
> llvm::Twine const&, llvm::ArrayRef<llvm::SMRange>,<br>
> llvm::ArrayRef<llvm::SMFixIt>, bool) const'<br>
> aklo-aklo.o: In function `print(long)':<br>
> /mnt/a2/aklo.cpp:388: undefined reference to `llvm::outs()'<br>
> /mnt/a2/aklo.cpp:393: undefined reference to `llvm::outs()'<br>
> aklo-aklo.o: In function `llvm::raw_ostream::operator<<(char)':<br>
> /home/a/llvm/include/llvm/Support/raw_ostream.h:141: undefined reference to<br>
> `llvm::raw_ostream::write(unsigned char)'<br>
> aklo-aklo.o: In function `print(long)':<br>
> /mnt/a2/aklo.cpp:395: undefined reference to `llvm::outs()'<br>
> /mnt/a2/aklo.cpp:401: undefined reference to `llvm::outs()'<br>
> /mnt/a2/aklo.cpp:398: undefined reference to `llvm::outs()'<br>
> aklo-aklo.o: In function `llvm::raw_ostream::operator<<(char)':<br>
> /home/a/llvm/include/llvm/Support/raw_ostream.h:141: undefined reference to<br>
> `llvm::raw_ostream::write(unsigned char)'<br>
> aklo-aklo.o: In function `llvm::StringMap<long,<br>
> llvm::MallocAllocator>::find(llvm::StringRef) const':<br>
> /home/a/llvm/include/llvm/ADT/StringMap.h:284: undefined reference to<br>
> `llvm::StringMapImpl::FindKey(llvm::StringRef) const'<br>
> aklo-aklo.o: In function `llvm::StringMap<long,<br>
> llvm::MallocAllocator>::insert(std::pair<llvm::StringRef, long>)':<br>
> /home/a/llvm/include/llvm/ADT/StringMap.h:331: undefined reference to<br>
> `llvm::StringMapImpl::LookupBucketFor(llvm::StringRef)'<br>
> /home/a/llvm/include/llvm/ADT/StringMap.h:344: undefined reference to<br>
> `llvm::StringMapImpl::RehashTable(unsigned int)'<br>
> aklo-aklo.o: In function `llvm::raw_ostream::operator<<(char const*)':<br>
> /home/a/llvm/include/llvm/Support/raw_ostream.h:166: undefined reference to<br>
> `llvm::raw_ostream::write(char const*, unsigned long)'<br>
> aklo-aklo.o: In function `llvm::raw_ostream::operator<<(std::string<br>
> const&)':<br>
> /home/a/llvm/include/llvm/Support/raw_ostream.h:184: undefined reference to<br>
> `llvm::raw_ostream::write(char const*, unsigned long)'<br>
> aklo-aklo.o: In function `print(long)':<br>
> /mnt/a2/aklo.cpp:398: undefined reference to<br>
> `llvm::raw_ostream::operator<<(long)'<br>
> aklo-aklo.o: In function `llvm::raw_ostream::operator<<(char)':<br>
> /home/a/llvm/include/llvm/Support/raw_ostream.h:141: undefined reference to<br>
> `llvm::raw_ostream::write(unsigned char)'<br>
> aklo-aklo.o: In function `llvm::cl::list<std::string, bool,<br>
> llvm::cl::parser<std::string> >::getOptionWidth() const':<br>
> /home/a/llvm/include/llvm/Support/CommandLine.h:1387: undefined reference to<br>
> `llvm::cl::basic_parser_impl::getOptionWidth(llvm::cl::Option const&) const'<br>
> aklo-aklo.o: In function `llvm::cl::list<std::string, bool,<br>
> llvm::cl::parser<std::string> >::printOptionInfo(unsigned long) const':<br>
> /home/a/llvm/include/llvm/Support/CommandLine.h:1390: undefined reference to<br>
> `llvm::cl::basic_parser_impl::printOptionInfo(llvm::cl::Option const&,<br>
> unsigned long) const'<br>
> aklo-aklo.o: In function `~basic_parser':<br>
> /home/a/llvm/include/llvm/Support/CommandLine.h:763: undefined reference to<br>
> `vtable for llvm::cl::basic_parser<std::string>'<br>
> aklo-aklo.o: In function `~Option':<br>
> /home/a/llvm/include/llvm/Support/CommandLine.h:290: undefined reference to<br>
> `vtable for llvm::cl::Option'<br>
> aklo-aklo.o: In function `~basic_parser':<br>
> /home/a/llvm/include/llvm/Support/CommandLine.h:763: undefined reference to<br>
> `vtable for llvm::cl::basic_parser<std::string>'<br>
> aklo-aklo.o: In function `~Option':<br>
> /home/a/llvm/include/llvm/Support/CommandLine.h:290: undefined reference to<br>
> `vtable for llvm::cl::Option'<br>
> aklo-aklo.o: In function `llvm::raw_ostream::operator<<(llvm::StringRef)':<br>
> /home/a/llvm/include/llvm/Support/raw_ostream.h:166: undefined reference to<br>
> `llvm::raw_ostream::write(char const*, unsigned long)'<br>
> aklo-aklo.o: In function `main':<br>
> /mnt/a2/aklo.cpp:434: undefined reference to<br>
> `llvm::sys::PrintStackTraceOnErrorSignal(bool)'<br>
> aklo-aklo.o: In function `PrettyStackTraceProgram':<br>
> /home/a/llvm/include/llvm/Support/PrettyStackTrace.h:63: undefined reference<br>
> to `llvm::PrettyStackTraceEntry::PrettyStackTraceEntry()'<br>
> /home/a/llvm/include/llvm/Support/PrettyStackTrace.h:63: undefined reference<br>
> to `vtable for llvm::PrettyStackTraceProgram'<br>
> /home/a/llvm/include/llvm/Support/PrettyStackTrace.h:64: undefined reference<br>
> to `llvm::EnablePrettyStackTrace()'<br>
> aklo-aklo.o: In function `main':<br>
> /mnt/a2/aklo.cpp:456: undefined reference to<br>
> `llvm::cl::AddExtraVersionPrinter(void (*)())'<br>
> /mnt/a2/aklo.cpp:457: undefined reference to<br>
> `llvm::cl::ParseCommandLineOptions(int, char const* const*, char const*)'<br>
> /mnt/a2/aklo.cpp:460: undefined reference to<br>
> `llvm::MemoryBuffer::getFileOrSTDIN(llvm::Twine const&, long, bool)'<br>
> /mnt/a2/aklo.cpp:469: undefined reference to `llvm::outs()'<br>
> aklo-aklo.o: In function `~PrettyStackTraceProgram':<br>
> /home/a/llvm/include/llvm/Support/PrettyStackTrace.h:58: undefined reference<br>
> to `vtable for llvm::PrettyStackTraceProgram'<br>
> /home/a/llvm/include/llvm/Support/PrettyStackTrace.h:58: undefined reference<br>
> to `llvm::PrettyStackTraceEntry::~PrettyStackTraceEntry()'<br>
> aklo-aklo.o: In function `llvm::raw_ostream::operator<<(char)':<br>
> /home/a/llvm/include/llvm/Support/raw_ostream.h:141: undefined reference to<br>
> `llvm::raw_ostream::write(unsigned char)'<br>
> aklo-aklo.o: In function `main':<br>
> /mnt/a2/aklo.cpp:463: undefined reference to `llvm::errs()'<br>
> /mnt/a2/aklo.cpp:463: undefined reference to `llvm::SMDiagnostic::print(char<br>
> const*, llvm::raw_ostream&, bool, bool) const'<br>
> aklo-aklo.o: In function `PrettyStackTraceProgram':<br>
> /home/a/llvm/include/llvm/Support/PrettyStackTrace.h:63: undefined reference<br>
> to `llvm::PrettyStackTraceEntry::~PrettyStackTraceEntry()'<br>
> aklo-aklo.o: In function `~PrettyStackTraceProgram':<br>
> /home/a/llvm/include/llvm/Support/PrettyStackTrace.h:58: undefined reference<br>
> to `vtable for llvm::PrettyStackTraceProgram'<br>
> /home/a/llvm/include/llvm/Support/PrettyStackTrace.h:58: undefined reference<br>
> to `llvm::PrettyStackTraceEntry::~PrettyStackTraceEntry()'<br>
> aklo-aklo.o: In function `__static_initialization_and_destruction_0':<br>
> /mnt/a2/aklo.cpp:164: undefined reference to `llvm::SourceMgr::~SourceMgr()'<br>
> aklo-aklo.o: In function `Option':<br>
> /home/a/llvm/include/llvm/Support/CommandLine.h:253: undefined reference to<br>
> `vtable for llvm::cl::Option'<br>
> /home/a/llvm/include/llvm/Support/CommandLine.h:253: undefined reference to<br>
> `llvm::cl::GeneralCategory'<br>
> aklo-aklo.o: In function `parser':<br>
> /home/a/llvm/include/llvm/Support/CommandLine.h:938: undefined reference to<br>
> `vtable for llvm::cl::parser<std::string>'<br>
> aklo-aklo.o: In function `llvm::cl::list<std::string, bool,<br>
> llvm::cl::parser<std::string> >::done()':<br>
> /home/a/llvm/include/llvm/Support/CommandLine.h:1398: undefined reference to<br>
> `llvm::cl::Option::addArgument()'<br>
> aklo-aklo.o: In function `~basic_parser':<br>
> /home/a/llvm/include/llvm/Support/CommandLine.h:763: undefined reference to<br>
> `vtable for llvm::cl::basic_parser<std::string>'<br>
> aklo-aklo.o: In function `~Option':<br>
> /home/a/llvm/include/llvm/Support/CommandLine.h:290: undefined reference to<br>
> `vtable for llvm::cl::Option'<br>
> aklo-aklo.o:(.rodata._ZTIN4llvm2cl4listISsbNS0_6parserISsEEEE[_ZTIN4llvm2cl4listISsbNS0_6parserISsEEEE]+0x18):<br>
> undefined reference to `typeinfo for llvm::cl::Option'<br>
> aklo-aklo.o:(.rodata._ZTVN4llvm2cl4listISsbNS0_6parserISsEEEE[_ZTVN4llvm2cl4listISsbNS0_6parserISsEEEE]+0x20):<br>
> undefined reference to `llvm::cl::Option::anchor()'<br>
> aklo-aklo.o:(.rodata._ZTVN4llvm2cl4listISsbNS0_6parserISsEEEE[_ZTVN4llvm2cl4listISsbNS0_6parserISsEEEE]+0x48):<br>
> undefined reference to `llvm::cl::Option::addOccurrence(unsigned int,<br>
> llvm::StringRef, llvm::StringRef, bool)'<br>
> collect2: error: ld returned 1 exit status<br>
><br>
><br>
</div></div>> _______________________________________________<br>
> LLVM Developers mailing list<br>
> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
><br>
<span><font color="#888888"><br>
<br>
<br>
--<br>
Snehasish Kumar<br>
School of Computing Science<br>
Simon Fraser University<br>
</font></span></blockquote></div><br></div>
_______________________________________________<br>LLVM Developers mailing list<br><a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br><a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br></div></blockquote></div><br></div></div></div></div></blockquote></div><br></div>
</div></blockquote></div><br></div></div></div></div></blockquote></div><br></div>