[cfe-dev] Help with libTooling

Russell Wallace via cfe-dev cfe-dev at lists.llvm.org
Sun Apr 24 06:10:54 PDT 2016


How did you get LLVM to build with MinGW? I get an error message when I
try cmake -G "MinGW Makefiles"

On Sat, Apr 23, 2016 at 8:31 AM, barbara <barbara at copperspice.com> wrote:

> Russell,
>
> We commented out code so the only lines we have right now are the
> following:
>
> llvm::cl::OptionCategory category("");
> clang::tooling::CommonOptionsParser options(argc, argv, category);
>
> Due to other library dependencies in our application we can not compile
> with MSVC.
>
> Barbara
>
>
> Okay so it's working for me but not for you, and the two obvious possible
> candidates for reasons why are that you're using MinGW or that your program
> does more than mine currently does, and therefore requires more of the
> functionality of libTooling. To distinguish between those, can you try
> compiling your program in the way I've been compiling mine, with Microsoft
> C++ driven by a Windows batch file, and see if that makes any difference?
>
> On Fri, Apr 22, 2016 at 8:05 PM, barbara <barbara at copperspice.com> wrote:
>
>> Russell,
>>
>> Our initial testing right now is on Windows however we are not using VS
>> but rather MinGW. Our application will need to support libTooling on
>> multiple flavors of Linux and OS X.
>>
>> What we have tested seems to imply there is an ordering issue. I tried
>> the following in our Makefile and there are still unresolved symbols.
>>
>> clang_link=-L$(clang_path)/lib  -llibclang  $(clang_path)/lib/*.a
>>
>> Any ideas or suggestions?
>>
>> Barbara
>>
>>
>> I solved the problem of which libraries by not solving it; on Windows, my
>> compile command looks like
>>
>> cl /I\llvm\build\include /I\llvm\build\tools\clang\include
>> /I\llvm\include /I\llvm\tools\clang\include /MTd /Zi compile.cpp
>> \llvm\build\Debug\lib\*.lib setargv.obj
>>
>> I.e. just link all the libraries. Is there an equivalent of that on Unix?
>>
>> On Fri, Apr 22, 2016 at 5:15 AM, barbara via cfe-dev <
>> <cfe-dev at lists.llvm.org>cfe-dev at lists.llvm.org> wrote:
>>
>>> Manuel,
>>>
>>> Yes, we have looked at this page and it does talk about building clang
>>> which we have done successfully.  We have figured out the required headers
>>> by simply compiling.  Our issue is linking.
>>>
>>> Submitting a documentation patch would be a great idea and we are happy
>>> to do this, once we know how it works.
>>>
>>> Just to be clear, we are not putting our code in the clang source tree.
>>> We are integrating clang parsing as part of another open source project.
>>> We need to modify our build files to link with libTooling.
>>>
>>> We have not been able to decipher which libraries are required.  The
>>> following is part of a makefile we randomly found on GitHub. Is it really
>>> this hard?  Sadly this Makefile did not work for us, we still have link
>>> issues.
>>>
>>>
>>> LIB = -lclangFrontend -lclangDriver -lclangTooling \
>>>
>>>   -lclangDriver -lclangTooling -lclangFrontendTool \
>>>
>>>  -lclangFrontend -lclangDriver -lclangSerialization \
>>>
>>>  -lclangCodeGen -lclangParse -lclangSema \
>>>
>>>  -lclangStaticAnalyzerFrontend -lclangStaticAnalyzerCheckers \
>>>
>>>  -lclangStaticAnalyzerCore -lclangAnalysis \
>>>
>>>  -lclangARCMigrate -lclangRewriteFrontend \
>>>
>>>  -lclangRewriteCore -lclangEdit -lclangAST \
>>>
>>>  -lclangLex -lclangBasic -lclangCodeGen -lclangSema \
>>>
>>>  -lclangAnalysis -lclangAST -lclangParse -lclangLex \
>>>
>>>  -lclangASTMatchers \
>>>
>>>  -lclangBasic -lLLVMSupport
>>>
>>>
>>>
>>> Barbara
>>>
>>>
>>>
>>>
>>> On Thu, Apr 21, 2016 at 9:31 AM barbara < <barbara at copperspice.com>
>>> barbara at copperspice.com> wrote:
>>>
>>>> Manuel,
>>>>
>>>> Yes, we have read all of the links on clang.llvm for LibTooling.  Most
>>>> simply mention how to use the existing tools.  There is simply nothing we
>>>> can find which shows which clang libraries are required for libTooling.
>>>>
>>>> The page you listed shows how to run ClangCheck, not how to link an
>>>> third party application with libTooling. We are developing a new tool and
>>>> libTooling seems to be our best shot.
>>>>
>>>
>>> The page I linked shows how to write the code. The libraries you need
>>> follow from the headers / classes you use.
>>>
>>> This:
>>> http://clang.llvm.org/docs/LibASTMatchersTutorial.html
>>> should also be still mostly up to date - if it isn't, patches are
>>> welcome :D
>>>
>>> Cheers,
>>> /Manuel
>>>
>>>
>>>>
>>>>
>>>> Barbara
>>>>
>>>>
>>>>
>>>> I assume you have found:
>>>> <http://clang.llvm.org/docs/LibTooling.html>
>>>> http://clang.llvm.org/docs/LibTooling.html
>>>> (which is the first hit for me when searching for "libtooling clang")
>>>>
>>>> On Wed, Apr 20, 2016 at 9:56 PM barbara via cfe-dev <
>>>> <cfe-dev at lists.llvm.org>cfe-dev at lists.llvm.org> wrote:
>>>>
>>>>> We have found AST limitations with libClang and understand few
>>>>> developers are using this approach for parsing C++.  We have been advised
>>>>> to switch to using libTooling, which now makes sense.
>>>>>
>>>>> We have found limited documentation and are working our why though
>>>>> what it take to set up a project which uses libTooling. The only tutorials
>>>>> we have found are from several years ago. If newer ones exist it would be
>>>>> great to know about them. Searching for "libTooling" yields too many hits
>>>>> on "libtool", which is obviously not what we are looking for.
>>>>>
>>>>> I believe we have figured out the appropriate include files. Our
>>>>> current obstacle is figuring out what clang libraries we need. This seems
>>>>> to be order dependent, but I could be incorrect. We have link errors and
>>>>> trying to look up undefined symbols in nearly impossible.
>>>>>
>>>>> We look forward to someone who can point us in the right direction as
>>>>> it seems we are missing a few basics.
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Barbara
>>>>> Co-Founder of DoxyPress
>>>>>
>>>>> _______________________________________________
>>>>> cfe-dev mailing list
>>>>> cfe-dev at lists.llvm.org
>>>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>>>>
>>>>
>>>>
>>> <http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev>
>>>
>>>
>>
>>
>
>
>
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient&utm_term=icon> Virus-free.
> www.avast.com
> <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient&utm_term=link>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160424/2842a091/attachment.html>


More information about the cfe-dev mailing list