<div dir="ltr">Hi.<div><br></div><div>I'm trying to compile reduced clang "driver.cpp" - added printf for arguments - and i'm getting linking with libLLVMSupport.a error - no StringSaver class found.</div><div><br></div><div><div># lib</div><div>echo "compiling cmd builder (x86_64) ..."</div><div>clang++ `../llvm_34_local_installed2/bin/llvm-config --cxxflags` -I ../llvm_34/tools/clang/include -I ../llvm_34_build_local2/tools/clang/include -c ./lib_cmd_builder.cpp -o ./lib_cmd_builder_x86_64.o</div><div><br></div><div>echo "linking cmd builder (x86_64) ..."</div><div>CMD="clang++ `../llvm_34_local_installed2/bin/llvm-config --ldflags` ./lib_cmd_builder_x86_64.o -o exe_cmd_builder_x86_64 `../llvm_34_local_installed2/bin/llvm-config --libs` -lclangARCMigrate -lclangAST -lclangASTMatchers -lclangAnalysis -lclangApplyReplacements -lclangBasic -lclangCodeGen -lclangDriver -lclangDynamicASTMatchers -lclangEdit -lclangFormat -lclangFrontend -lclangFrontendTool -lclangIndex -lclangLex -lclangParse -lclangQuery -lclangRewriteCore -lclangRewriteFrontend -lclangSema -lclangSerialization -lclangStaticAnalyzerCheckers -lclangStaticAnalyzerCore -lclangStaticAnalyzerFrontend -lclangTidy -lclangTidyGoogleModule -lclangTidyLLVMModule"</div></div><div><br></div><div>Error message:</div><div>
<p class="">Undefined symbols for architecture x86_64:</p>
<p class=""> "typeinfo for llvm::cl::StringSaver", referenced from:</p>
<p class=""> typeinfo for (anonymous namespace)::StringSetSaver in lib_cmd_builder_x86_64.o</p>
<p class="">ld: symbol(s) not found for architecture x86_64</p>
<p class="">clang: error: linker command failed with exit code 1 (use -v to see invocation)</p><p class=""><br></p><p class="">Checking libLLVM is found and contains CommandLine object data:</p><p class="">(found on -L path):</p><p class="">find ../llvm_34_local_installed2/lib/ -name "*upport*"</p><p class="">
</p><p class="">../llvm_34_local_installed2/lib//libLLVMSupport.a</p><p class=""><br></p><p class="">(contains CommandLine.cpp object data):</p><p class="">ar -t ../llvm_34_local_installed2/lib//libLLVMSupport.a | grep CommandLine</p><p class="">
</p><p class="">CommandLine.cpp.o</p><p class=""><br></p><p class="">The class StringSaver is declared in CommandLine.cpp:</p><p class=""><br></p><p class="">/Users/asmirnov/Documents/dev/src/llvm_34/include/llvm/Support/CommandLine.h<br></p><p class="">class StringSaver {</p><p class=""> virtual void anchor();</p><p class="">public:</p><p class=""> virtual const char *SaveString(const char *Str) = 0;</p><p class=""> virtual ~StringSaver() {}; // Pacify -Wnon-virtual-dtor.</p><p class="">};</p><p class=""><br></p><p class="">StringSaver inheritor is declared and implemented in self file (lib_cmd_builder.cpp):</p><p class="">namespace {</p><p class=""> class StringSetSaver : public llvm::cl::StringSaver {</p><p class=""> public:</p><p class=""> StringSetSaver(std::set<std::string> &Storage) : Storage(Storage) {}</p><p class=""> const char *SaveString(const char *Str) LLVM_OVERRIDE {</p><p class=""> return SaveStringInSet(Storage, Str);</p><p class=""> }</p><p class=""> private:</p><p class=""> std::set<std::string> &Storage;</p><p class=""> };</p><p class="">}</p><p class=""><br></p><p class="">So i can't understand why i'm having this error.</p><p class="">Any thoughts?</p></div></div>