[cfe-dev] Problems with tutorial

Pedro Delgado Perez pedro.delgadoperez at mail.uca.es
Fri Apr 19 03:04:22 PDT 2013


 
Thank you very much David,

> 
> http://clang.llvm.org/docs/JSONCompilationDatabase.html [ http://clang.llvm.org/docs/JSONCompilationDatabase.html ] might provide some help.
> 
 This really worked.

>> After this, I tried to follow this other tutorial:
>> ttp://clang.llvm.org/docs/RAVFrontendAction.html
>> 
>> As in Step1, I put FindClassDecls.cpp in a directory called find-class-decls
>> in ~/clang-llvm/llvm/tools/clang/tools andc hanged the CMakeLists.txt in
>> tools. Then, I run ninja in ~/clang-llvm/build and I get the next error:
>> 
>> /home/pedro/clang-llvm/llvm/tools/clang/tools/find-class-decls/FindClassDecls.cpp:17:43:
>> error: member access into incomplete type 'clang::ASTContext'
>> 
> Looks like it needs "ASTContext.h" included.
> 
I included clang/AST/ASTContext.h and i have now another kind of probem, as it can't find anything:

tools/clang/tools/find-class-decls/CMakeFiles/find-class-decls.dir/FindClassDecls.cpp.o:(.data.rel.ro._ZTV20FindNamedClassAction[_ZTV20FindNamedClassAction]+0x14): undefined reference to `clang::ASTFrontendAction::ExecuteAction()'

... ...

tools/clang/tools/find-class-decls/CMakeFiles/find-class-decls.dir/FindClassDecls.cpp.o:(.data.rel.ro._ZTV22FindNamedClassConsumer[_ZTV22FindNamedClassConsumer]+0x28): undefined reference to `clang::ASTConsumer::HandleTopLevelDeclInObjCContainer(clang::DeclGroupRef)'

... ...

clang-3.3: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.



What can I do? I'm not able to understand this error.

Thanks again,

Pedro



El dia 15 abr 2013 07:53, David Blaikie <dblaikie at gmail.com> escribió:
> On Fri, Apr 12, 2013 at 4:18 AM, Pedro Delgado Perez
> <pedro.delgadoperez at mail.uca.es> wrote:
> 
>> Hello everyone,
>> 
>> To get started with Clang, I'm trying to reproduce the examles in tutorial.
>> I began with:
>> 
>> http://clang.llvm.org/docs/LibASTMatchersTutorial.html [ http://clang.llvm.org/docs/LibASTMatchersTutorial.html ]
>> 
>> I accomplished Step 0 and 1 without any problems, but I had trouble with
>> Step 2.
>> 1. The directory ~/clang-llvm/llvm/llvm_build doesn't exist. So, I tried to
>> rerun ninja in ~/clang-llvm/build as I did in Step 1, but it says: "ninja:
>> no work to do"
>> How can I recompile LoopConvert?
>> 
> I assume "llvm_build" is a mistype and it should be
> ~/clang-llvm/build. Are you sure you followed the steps in (1) to
> change the CMakeLists.txt file, for example?
> 
> If you're not sure how to /rebuild/ - that should happen
> automatically, if you make any changes. If it's not rebuilding, try
> editing the source files and running the ninja command again.
> 
>> 2. If I run now bin/loop-convert test.cpp as in Step1, it says:
>> LLVM ERROR: Could not auto-detect compilation database for file "test.cpp"
>> No compilation database found in /home/pedro/clang-llvm/build or any parent
>> directory
>> json-compilation-database: Error while opening JSON database: No such file
>> or directory
>> 
>> What's the problem now? What have changed?
>> 
> http://clang.llvm.org/docs/JSONCompilationDatabase.html [ http://clang.llvm.org/docs/JSONCompilationDatabase.html ] might provide some help.
> 
>> After this, I tried to follow this other tutorial:
>> ttp://clang.llvm.org/docs/RAVFrontendAction.html
>> 
>> As in Step1, I put FindClassDecls.cpp in a directory called find-class-decls
>> in ~/clang-llvm/llvm/tools/clang/tools andc hanged the CMakeLists.txt in
>> tools. Then, I run ninja in ~/clang-llvm/build and I get the next error:
>> 
>> /home/pedro/clang-llvm/llvm/tools/clang/tools/find-class-decls/FindClassDecls.cpp:17:43:
>> error: member access into incomplete type 'clang::ASTContext'
>> 
> Looks like it needs "ASTContext.h" included.
> 
>> FullSourceLoc FullLocation =
>> Context->getFullLoc(Declaration->getLocStart());
>> ^
>> /home/pedro/clang-llvm/llvm/tools/clang/include/clang/AST/ASTConsumer.h:18:9:
>> note: forward declaration of 'clang::ASTContext'
>> class ASTContext;
>> ^
>> /home/pedro/clang-llvm/llvm/tools/clang/tools/find-class-decls/FindClassDecls.cpp:36:33:
>> error: member access into incomplete type 'clang::ASTContext'
>> Visitor.TraverseDecl(Context.getTranslationUnitDecl());
>> ^
>> /home/pedro/clang-llvm/llvm/tools/clang/include/clang/AST/ASTConsumer.h:18:9:
>> note: forward declaration of 'clang::ASTContext'
>> class ASTContext;
>> ^
>> 2 errors generated.
>> 
>> 
>> 
>> What's happening here?
>> 
>> 
>> Thanks in advance.
>> 
>> Pedro.
>> 
>> PD; By the way, LoopPrinter class in
>> http://clang.llvm.org/docs/LibASTMatchersTutorial.html [ http://clang.llvm.org/docs/LibASTMatchersTutorial.html ] lacks a '}' before
>> '};'
>> 
>> 
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev [ 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/20130419/9c68005a/attachment.html>


More information about the cfe-dev mailing list