<div dir="ltr">Oops. i've tried again and it helps!<div><br></div><div>Actually i can't understand why -fno-rtti is not appended by `../llvm_34_local_installed2/bin/llvm-config --cxxflags` but it's needed in my case.</div><div>Thanks, James.</div></div><div class="gmail_extra"><br><div class="gmail_quote">2014-09-15 11:37 GMT+06:00 Anton Smirnov <span dir="ltr"><<a href="mailto:dev@antonsmirnov.name" target="_blank">dev@antonsmirnov.name</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi, James.<div><br></div><div>Thanks for suggestion.</div><div><br></div><div>I've modified compile/link cmd and added -fno-rtti (clang++ -c ./exe_interpreter.cpp -o ./exe_interpreter2.o -fno-rtti) but no luck.</div><div>How can i analyze produced object file to make sure it contains all necessary information (rtti)?</div><div><br></div><div>Let me explain everything in brief.</div><div>I've copied lli tool source code and modified it a bit (renamed main()) to produce static library instead of executable. I'm able to compile it and link it so lib..a file. Then i'm trying to link it with LLVM libs and unfortunately StringSaver class code is not found in libLLVMSupport.a though i can see it contains according object file.</div><div><br></div><div>I can modify my lib and executable compile/link arguments as needed, so please suggest me what can be done as i'm in stuck.</div><div><br></div><div>Regards, Anton.</div><div><br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">2014-09-15 7:14 GMT+06:00 James Dennett <span dir="ltr"><<a href="mailto:james.dennett@gmail.com" target="_blank">james.dennett@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">You might try building your library with -fno-rtti, or clang without it.</p>
<p dir="ltr">-- James</p>
<div class="gmail_quote"><div><div>On Sep 14, 2014 9:29 AM, "Anton Smirnov" <<a href="mailto:dev@antonsmirnov.name" target="_blank">dev@antonsmirnov.name</a>> wrote:<br type="attribution"></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">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>Undefined symbols for architecture x86_64:</p>
<p> "typeinfo for llvm::cl::StringSaver", referenced from:</p>
<p> typeinfo for (anonymous namespace)::StringSetSaver in lib_cmd_builder_x86_64.o</p>
<p>ld: symbol(s) not found for architecture x86_64</p>
<p>clang: error: linker command failed with exit code 1 (use -v to see invocation)</p><p><br></p><p>Checking libLLVM is found and contains CommandLine object data:</p><p>(found on -L path):</p><p>find ../llvm_34_local_installed2/lib/ -name "*upport*"</p><p>
</p><p>../llvm_34_local_installed2/lib//libLLVMSupport.a</p><p><br></p><p>(contains CommandLine.cpp object data):</p><p>ar -t ../llvm_34_local_installed2/lib//libLLVMSupport.a | grep CommandLine</p><p>
</p><p>CommandLine.cpp.o</p><p><br></p><p>The class StringSaver is declared in CommandLine.cpp:</p><p><br></p><p>/Users/asmirnov/Documents/dev/src/llvm_34/include/llvm/Support/CommandLine.h<br></p><p>class StringSaver {</p><p> virtual void anchor();</p><p>public:</p><p> virtual const char *SaveString(const char *Str) = 0;</p><p> virtual ~StringSaver() {}; // Pacify -Wnon-virtual-dtor.</p><p>};</p><p><br></p><p>StringSaver inheritor is declared and implemented in self file (lib_cmd_builder.cpp):</p><p>namespace {</p><p> class StringSetSaver : public llvm::cl::StringSaver {</p><p> public:</p><p> StringSetSaver(std::set<std::string> &Storage) : Storage(Storage) {}</p><p> const char *SaveString(const char *Str) LLVM_OVERRIDE {</p><p> return SaveStringInSet(Storage, Str);</p><p> }</p><p> private:</p><p> std::set<std::string> &Storage;</p><p> };</p><p>}</p><p><br></p><p>So i can't understand why i'm having this error.</p><p>Any thoughts?</p></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>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>