<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Jan 20, 2015 at 4:32 PM, Nico Weber <span dir="ltr"><<a href="mailto:thakis@chromium.org" target="_blank">thakis@chromium.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="">On Tue, Jan 20, 2015 at 11:07 AM, Reid Kleckner <span dir="ltr"><<a href="mailto:rnk@google.com" target="_blank">rnk@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I think Nico tweaked the dead strip settings last?</div></blockquote><div><br></div></span><div>I tested things in a static library build. Since you say something about libLLVMSupport.dylib, you're probably doing a shared build. From how I remember things looking, I don't think shared builds supported plugins ever in the make build – it's probably you'll have to tweak the build description to get this configuration to work. (Chromium only uses compiler plugins in static builds too.)</div></div></div></div></blockquote><div><br></div><div>How should I get a non-shared build?  That may be the source of this problem...<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="HOEnZb"><font color="#888888"><div>Nico</div></font></span><div><div class="h5"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_extra"><br><div class="gmail_quote"><div><div>On Wed, Dec 31, 2014 at 9:02 AM, Ehsan Akhgari <span dir="ltr"><<a href="mailto:ehsan.akhgari@gmail.com" target="_blank">ehsan.akhgari@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr"><div><div><div>Hi all,<br><br></div>I'm trying to compile a clang plugin against a local ToT build of clang on OSX 10.10.  The link command fails like this:<br><br>$ /Users/ehsan/src/llvm-objdir/bin/clang++ -Qunused-arguments  -I/Users/ehsan/src/llvm/include -I/Users/ehsan/src/llvm-objdir/include  -fPIC -fvisibility-inlines-hidden -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -std=c++11 -fcolor-diagnostics -O2 -g -DNDEBUG  -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fno-rtti -fno-exceptions -fno-omit-frame-pointer  -fPIC -shared -o libclang-plugin.dylib  clang-plugin.o   -L/Users/ehsan/src/llvm-objdir/lib -Wl,-search_paths_first -Wl,-headerpad_max_install_names -lcurses -lpthread -lz -lm -L/Users/ehsan/src/llvm-objdir/lib -Wl,-search_paths_first -Wl,-headerpad_max_install_names -lLLVMOption -lLLVMBitReader -lLLVMMCParser -lLLVMAsmParser -lLLVMAnalysis -lLLVMTarget -lLLVMMC -lLLVMCore -lLLVMSupport -lclangFrontend -lclangDriver -lclangSerialization -lclangParse -lclangSema -lclangAnalysis -lclangEdit -lclangAST -lclangLex -lclangBasic -lclangASTMatchers  -Wl,-executable_path,/Users/ehsan/moz/src/obj-ff-clang-plugin.noindex/dist/bin    -dynamiclib -install_name @executable_path/libclang-plugin.dylib -compatibility_version 1 -current_version 1 -single_module<br>Undefined symbols for architecture x86_64:<br>  "llvm::MemoryBuffer::getOpenFile(int, llvm::Twine const&, unsigned long long, bool, bool)", referenced from:<br>      (anonymous namespace)::RealFile::getBuffer(llvm::Twine const&, long long, bool, bool) in libclangBasic.a(VirtualFileSystem.cpp.o)<br>  "llvm::MemoryBuffer::getMemBufferCopy(llvm::StringRef, llvm::Twine const&)", referenced from:<br>      clang::Preprocessor::EnterMainSourceFile() in libclangLex.a(Preprocessor.cpp.o)<br>      clang::createChainedIncludesSource(clang::CompilerInstance&, llvm::IntrusiveRefCntPtr<clang::ExternalSemaSource>&) in libclangFrontend.a(ChainedIncludesSource.cpp.o)<br>      clang::ASTUnit::getMainBufferWithPrecompiledPreamble(clang::CompilerInvocation const&, bool, unsigned int) in libclangFrontend.a(ASTUnit.cpp.o)<br>      clang::GenerateModuleAction::BeginSourceFileAction(clang::CompilerInstance&, llvm::StringRef) in libclangFrontend.a(FrontendActions.cpp.o)<br>  "llvm::MemoryBuffer::getNewUninitMemBuffer(unsigned long, llvm::Twine const&)", referenced from:<br>      clang::Preprocessor::SetCodeCompletionPoint(clang::FileEntry const*, unsigned int, unsigned int) in libclangLex.a(Preprocessor.cpp.o)<br>  "llvm::MemoryBuffer::getFile(llvm::Twine const&, long long, bool, bool)", referenced from:<br>      clang::CompilerInvocation::getModuleHash() const in libclangFrontend.a(CompilerInvocation.cpp.o)<br>      clang::createVFSFromCompilerInvocation(clang::CompilerInvocation const&, clang::DiagnosticsEngine&) in libclangFrontend.a(CompilerInvocation.cpp.o)<br>      clang::GlobalModuleIndex::readIndex(llvm::StringRef) in libclangSerialization.a(GlobalModuleIndex.cpp.o)<br>      clang::PTHManager::Create(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, clang::DiagnosticsEngine&) in libclangLex.a(PTHLexer.cpp.o)<br>      clang::driver::toolchains::Linux::Linux(clang::driver::Driver const&, llvm::Triple const&, llvm::opt::ArgList const&) in libclangDriver.a(ToolChains.cpp.o)<br>  "llvm::sys::findProgramByName(llvm::StringRef, llvm::ArrayRef<llvm::StringRef>)", referenced from:<br>      clang::driver::Driver::GetProgramPath(char const*, clang::driver::ToolChain const&) const in libclangDriver.a(Driver.cpp.o)<br>  "llvm::scalbn(llvm::APFloat, int)", referenced from:<br>      (anonymous namespace)::ComplexExprEvaluator::VisitBinaryOperator(clang::BinaryOperator const*) in libclangAST.a(ExprConstant.cpp.o)<br>  "llvm::APInt::sshl_ov(llvm::APInt const&, bool&) const", referenced from:<br>      EvaluateDirectiveSubExpr((anonymous namespace)::PPValue&, unsigned int, clang::Token&, bool, clang::Preprocessor&) in libclangLex.a(PPExpressions.cpp.o)<br>  "llvm::APInt::ushl_ov(llvm::APInt const&, bool&) const", referenced from:<br>      EvaluateDirectiveSubExpr((anonymous namespace)::PPValue&, unsigned int, clang::Token&, bool, clang::Preprocessor&) in libclangLex.a(PPExpressions.cpp.o)<br>ld: symbol(s) not found for architecture x86_64<br>clang-3.5: error: linker command failed with exit code 1 (use -v to see invocation)<br><br></div>The missing symbols are all in libLLVMSupport.a, but libLLVMSupport.dylib (which is the library that ld tries to link against) misses all of these symbols because they are not referenced by anything and were eliminated during linking.<br><br>tools/driver/CMakeLists.txt in the clang repository sets LLVM_NO_DEAD_STRIP to 1 if CLANG_PLUGIN_SUPPORT is turned on, which it is in my build, but it seems like that setting does not affect libLLVMSupport, so we end up passing -dead_strip to the linker.  I'm not sure if this is the intended behavior, or a bug.<br><br></div>Do I understand the setup as intended correctly?  Can someone please suggest a way to bypass this issue?<br clear="all"><div><div><div><div><br></div><div>Thanks!<span><font color="#888888"><br></font></span></div><span><font color="#888888"><div>-- <br><div><div dir="ltr">Ehsan<br></div></div>
</div></font></span></div></div></div></div>
<br></div></div>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div>
<br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div></div></div><br></div></div>
</blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr">Ehsan<br></div></div>
</div></div>