[cfe-dev] Cannot compile program when using the AnalysisManager
Munawar Hafiz
munawar.hafiz at gmail.com
Mon Dec 13 05:13:10 PST 2010
I rebuilt the llvm libraries with REQUIRES_RTTI=1 option in the command
line, and it worked like a charm.
Thanks a lot Ted.
Munawar
On Mon, Dec 13, 2010 at 1:39 AM, Ted Kremenek <kremenek at apple.com> wrote:
> 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.
>
> On Dec 12, 2010, at 7:21 PM, Munawar Hafiz wrote:
>
> > Hi,
> > 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.
> >
> >
> > CXIndex index = clang_createIndex(1, 0);
> > CXTranslationUnit tu = clang_createTranslationUnitFromSourceFile(index,
> > "simple.c", 0, 0x0, 0, 0x0);
> > ASTUnit *astUnit = static_cast<ASTUnit *> (tu);
> > Preprocessor &pe = astUnit->getPreprocessor();
> > AnalysisManager AMgr(astUnit->getASTContext(), pe.getDiagnostics(),
> > pe.getLangOptions(), 0,
> > 0,
> > 0, &Idxer,
> > /* MaxNodes */ 300, /* MaxVisit */ 3,
> > /* VisualizeEG */ false, /* VisualizeEGUbi */
> false,
> > /* PurgeDead */ true, /* EagerlyAssume */
> false,
> > /* TrimGraph */ false, /* InlineCall */ true,
> > /* UseUnoptimizedCFG */ false, false, false);
> >
> >
> >
> > Now, I am compiling the program with the following command.
> >
> > 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
> >
> > The interesting and probably relevant part is the library sequence.
> >
> > -lclangIndex -lclangChecker -lclangFrontend -lclangSema -lclangLex
> -lclangParse -lclangDriver -lclangAnalysis -lclangSerialization
> -lclangAST -lclangBasic -lLLVMMC -lLLVMCore -lLLVMSupport -lLLVMSystem
> -lpthread -ldl
> >
> > But I am getting this error,
> >
> > llvmTest.o:(.rodata._ZTIN5clang15AnalysisManagerE[typeinfo for
> clang::AnalysisManager]+0x8): undefined reference to `typeinfo for
> clang::BugReporterData'
> > collect2: ld returned 1 exit status
> >
> > Can you please point out where I am making a mistake ? Thanks.
> >
> >
> > Munawar
> > _______________________________________________
> > cfe-dev mailing list
> > cfe-dev at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20101213/337e505c/attachment.html>
More information about the cfe-dev
mailing list