I rebuilt the llvm libraries with REQUIRES_RTTI=1 option in the command line, and it worked like a charm.<br><br>Thanks a lot Ted.<br><br>Munawar<br><br><br><div class="gmail_quote">On Mon, Dec 13, 2010 at 1:39 AM, Ted Kremenek <span dir="ltr"><<a href="mailto:kremenek@apple.com">kremenek@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Did you compile your entire project with -fno-rtti? It smells like the linker is trying to find RTII information for BugReporterData, but it wasn't compiled in. The LLVM libraries by default don't have RTTI information compiled in.<br>
<div><div></div><div class="h5"><br>
On Dec 12, 2010, at 7:21 PM, Munawar Hafiz wrote:<br>
<br>
> Hi,<br>
> I am new to clang. I was trying to invoke the AnalysisManager object and use it in a program. I am quoting relevant parts of the code.<br>
><br>
><br>
> CXIndex index = clang_createIndex(1, 0);<br>
> CXTranslationUnit tu = clang_createTranslationUnitFromSourceFile(index,<br>
> "simple.c", 0, 0x0, 0, 0x0);<br>
> ASTUnit *astUnit = static_cast<ASTUnit *> (tu);<br>
> Preprocessor &pe = astUnit->getPreprocessor();<br>
> AnalysisManager AMgr(astUnit->getASTContext(), pe.getDiagnostics(),<br>
> pe.getLangOptions(), 0,<br>
> 0,<br>
> 0, &Idxer,<br>
> /* MaxNodes */ 300, /* MaxVisit */ 3,<br>
> /* VisualizeEG */ false, /* VisualizeEGUbi */ false,<br>
> /* PurgeDead */ true, /* EagerlyAssume */ false,<br>
> /* TrimGraph */ false, /* InlineCall */ true,<br>
> /* UseUnoptimizedCFG */ false, false, false);<br>
><br>
><br>
><br>
> Now, I am compiling the program with the following command.<br>
><br>
> g++ -O2 -g -Wall -fmessage-length=0 -D __STDC_LIMIT_MACROS=1 -D __STDC_CONSTANT_MACROS=1 -I/home/munawar/install/llvm/tools/clang/tools/libclang -o llvmTest llvmTest.o /home/munawar/install/llvm_build/tools/clang/tools/libclang/Release+Asserts/CIndex.o /home/munawar/install/llvm_build/tools/clang/tools/libclang/Release+Asserts/CXCursor.o /home/munawar/install/llvm_build/tools/clang/tools/libclang/Release+Asserts/CXType.o /home/munawar/install/llvm_build/tools/clang/tools/libclang/Release+Asserts/CIndexer.o /home/munawar/install/llvm_build/tools/clang/tools/libclang/Release+Asserts/CIndexDiagnostic.o /home/munawar/install/llvm_build/tools/clang/tools/libclang/Release+Asserts/CIndexUSRs.o -lclangIndex -lclangChecker -lclangFrontend -lclangSema -lclangLex -lclangParse -lclangDriver -lclangAnalysis -lclangSerialization -lclangAST -lclangBasic -lLLVMMC -lLLVMCore -lLLVMSupport -lLLVMSystem -lpthread -ldl<br>
><br>
> The interesting and probably relevant part is the library sequence.<br>
><br>
> -lclangIndex -lclangChecker -lclangFrontend -lclangSema -lclangLex -lclangParse -lclangDriver -lclangAnalysis -lclangSerialization -lclangAST -lclangBasic -lLLVMMC -lLLVMCore -lLLVMSupport -lLLVMSystem -lpthread -ldl<br>
><br>
> But I am getting this error,<br>
><br>
> llvmTest.o:(.rodata._ZTIN5clang15AnalysisManagerE[typeinfo for clang::AnalysisManager]+0x8): undefined reference to `typeinfo for clang::BugReporterData'<br>
> collect2: ld returned 1 exit status<br>
><br>
> Can you please point out where I am making a mistake ? Thanks.<br>
><br>
><br>
> Munawar<br>
</div></div>> _______________________________________________<br>
> cfe-dev mailing list<br>
> <a href="mailto:cfe-dev@cs.uiuc.edu">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>