Help with libTooling

classic Classic list List threaded Threaded
20 messages Options
Reply | Threaded
Open this post in threaded view
|

Help with libTooling

Renato Golin via cfe-dev
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

Virus-free. www.avast.com

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Help with libTooling

Renato Golin via cfe-dev
I assume you have found:
(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 <[hidden email]> 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

Virus-free. www.avast.com
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Help with libTooling

Renato Golin via cfe-dev
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.


Barbara



I assume you have found:
(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 <[hidden email]> 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

Virus-free. www.avast.com
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


Virus-free. www.avast.com

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Help with libTooling

Renato Golin via cfe-dev
On Thu, Apr 21, 2016 at 9:31 AM barbara <[hidden email]> 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:
should also be still mostly up to date - if it isn't, patches are welcome :D

Cheers,
/Manuel
 


Barbara



I assume you have found:
(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 <[hidden email]> 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

Virus-free. www.avast.com
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


Virus-free. www.avast.com

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Help with libTooling

Renato Golin via cfe-dev
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 <[hidden email]> 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:
should also be still mostly up to date - if it isn't, patches are welcome :D

Cheers,
/Manuel
 


Barbara



I assume you have found:
(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 <[hidden email]> 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
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev



Virus-free. www.avast.com

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Help with libTooling

Renato Golin via cfe-dev
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 <[hidden email]> 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 <[hidden email][hidden email]> 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:
should also be still mostly up to date - if it isn't, patches are welcome :D

Cheers,
/Manuel
 


Barbara



I assume you have found:
(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 <[hidden email]> 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
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev



Virus-free. www.avast.com

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Help with libTooling

Renato Golin via cfe-dev
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 <[hidden email]> 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 <[hidden email]> 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:
should also be still mostly up to date - if it isn't, patches are welcome :D

Cheers,
/Manuel
 


Barbara



I assume you have found:
(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 <[hidden email]> 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
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev




Virus-free. www.avast.com

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Help with libTooling

Renato Golin via cfe-dev
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 <[hidden email]> 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 <[hidden email][hidden email]> 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 <[hidden email]> 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:
should also be still mostly up to date - if it isn't, patches are welcome :D

Cheers,
/Manuel
 


Barbara



I assume you have found:
(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 <[hidden email][hidden email]> 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
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev




Virus-free. www.avast.com


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Help with libTooling

Renato Golin via cfe-dev
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 <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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:
should also be still mostly up to date - if it isn't, patches are welcome :D

Cheers,
/Manuel
 


Barbara



I assume you have found:
(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 <[hidden email]> 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
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev









Virus-free. www.avast.com

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Help with libTooling

Renato Golin via cfe-dev
Okay, so that rules out one explanation. I don't have a MinGW build of LLVM to try right now; will have a go at getting one up and running over the weekend. I do have a Linux one to experiment with. Tentative conclusions so far:

llvm-config doesn't work once you need clang as well as LLVM; we're basically on our own as far as that goes - even the include file directories will need to be specified by hand, so we can resign themselves to doing the rest by hand as well.

The libTooling tutorial suggests building a custom version of cmake and then using a GUI program to configure the build on the current machine, which obviously isn't a winning strategy for distributable software.

As for actually trying to build clang-using stuff Linux, haven't yet got past the include stage. Here's where I am currently at:

a@a-VirtualBox:~$ gcc -I/llvm/include -I~/build/include -I~/llvm/tools/clang/include -I~/build/tools/clang/include ~/ayane/compiler/*.cpp
/home/a/ayane/compiler/main.cpp:9:47: fatal error: clang/Tooling/CommonOptionsParser.h: No such file or directory
 #include <clang/Tooling/CommonOptionsParser.h>
                                               ^
compilation terminated.
a@a-VirtualBox:~$ find . -name CommonOptionsParser.h
./llvm/tools/clang/include/clang/Tooling/CommonOptionsParser.h

so as far as I can see, I'm specifying the necessary directory but it's still not working, but I'm not very familiar with Linux so I could just be overlooking the obvious - can you see what I'm missing?


On Sat, Apr 23, 2016 at 8:31 AM, barbara <[hidden email]> 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 <[hidden email]> 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 <[hidden email][hidden email]> 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 <[hidden email][hidden email]> 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:
should also be still mostly up to date - if it isn't, patches are welcome :D

Cheers,
/Manuel
 


Barbara



I assume you have found:
(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 <[hidden email][hidden email]> 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
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev









Virus-free. www.avast.com


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Help with libTooling

Renato Golin via cfe-dev
In reply to this post by Renato Golin via cfe-dev
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 <[hidden email]> 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 <[hidden email]> 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 <[hidden email][hidden email]> 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 <[hidden email][hidden email]> 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:
should also be still mostly up to date - if it isn't, patches are welcome :D

Cheers,
/Manuel
 


Barbara



I assume you have found:
(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 <[hidden email][hidden email]> 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
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev









Virus-free. www.avast.com


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Help with libTooling

Renato Golin via cfe-dev

You have to use Ninja by specifying:   cmake -G "Ninja"

Since building on Windows is a bit trickier I wrote up some documentation. If you find anything unclear please let me know as we want this page to stay current and accurate. If anyone wants to reference this page or incorporate the text in any other documentation, feel free.

http://www.copperspice.com/documentation-clang.html


Barbara


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 <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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:
should also be still mostly up to date - if it isn't, patches are welcome :D

Cheers,
/Manuel
 


Barbara



I assume you have found:
(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 <[hidden email]> 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
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev










Virus-free. www.avast.com

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Help with libTooling

Renato Golin via cfe-dev
In reply to this post by Renato Golin via cfe-dev
On Sun, Apr 24, 2016 at 3:10 PM, Russell Wallace via cfe-dev
<[hidden email]> wrote:
>
> How did you get LLVM to build with MinGW? I get an error message when I try cmake -G "MinGW Makefiles"
>

"cmake --help" will list all available generators. You might need to use

cmake -G "Unix Makefiles"

even on MinGW


Csaba
--
GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++
The Tao of math: The numbers you can count are not the real numbers.
Life is complex, with real and imaginary parts.
"Ok, it boots. Which means it must be bug-free and perfect. " -- Linus Torvalds
"People disagree with me. I just ignore them." -- Linus Torvalds
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Help with libTooling

Renato Golin via cfe-dev
Hi Barbara,

We're using libTooling in a project and, after a few tries, the minimum libs required that we found was:

-lclangTooling -lclangDriver -lclangFrontend -lclangParse -lclangSerialization -lclangSema -lclangAnalysis -lclangEdit -lclangLex -lclangAST -lclangBasic -lLLVMBitReader -lLLVMOption -lLLVMMC -lLLVMMCParser -lLLVMSupport

The bold part you can get from `llvm-config --libs mcparser option bitreader` (it will actually return them + -lLLVMCore, which increases our static binary by ~9MB). We also append `llvm-config --system-libs`, for llvm's dependencies.

For clang libs, you'll have to write them by yourself as there is no way to request them from the system/pkgconfig (please, someone correct me if I'm wrong).

If you use autotools in your project, I can provide the m4 scripts to find those libraries.

Thank you,


2016-04-26 8:57 GMT+01:00 Csaba Raduly via cfe-dev <[hidden email]>:
On Sun, Apr 24, 2016 at 3:10 PM, Russell Wallace via cfe-dev
<[hidden email]> wrote:
>
> How did you get LLVM to build with MinGW? I get an error message when I try cmake -G "MinGW Makefiles"
>

"cmake --help" will list all available generators. You might need to use

cmake -G "Unix Makefiles"

even on MinGW


Csaba
--
GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++
The Tao of math: The numbers you can count are not the real numbers.
Life is complex, with real and imaginary parts.
"Ok, it boots. Which means it must be bug-free and perfect. " -- Linus Torvalds
"People disagree with me. I just ignore them." -- Linus Torvalds
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev



--

Mikhail Ramalho.

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Help with libTooling

Renato Golin via cfe-dev
In reply to this post by Renato Golin via cfe-dev
Okay, that looks good, thanks. A small point:

Extract the MSYS zip file. Add /c/MSys to your bash profile or path.

Add /c/MinGW to your bash profile or path.

did you mean /c/msys/bin and /c/mingw/bin?

I ran the process overnight, and got this error

C:\llvm-mingw>\ninja\ninja
[1495/2504] Linking CXX static library lib\libLLVMSystemZAsmPrinter.a
FAILED: cmd.exe /C "cd . && C:\CMake\bin\cmake.exe -E remove lib\libLLVMSystemZAsmPrinter.a && c:\mingw64\bin\ar.exe cq lib\libLLVMSystemZAsmPrinter.a  lib/Target/SystemZ/InstPrinter/CMakeFiles/LLVMSy
stemZAsmPrinter.dir/SystemZInstPrinter.cpp.obj && c:\mingw64\bin\ranlib.exe lib\libLLVMSystemZAsmPrinter.a && cd ."
c:\mingw64\bin\ranlib.exe: unable to rename 'lib\libLLVMSystemZAsmPrinter.a'; reason: Permission denied
[1495/2504] Linking CXX static library lib\libLLVMSystemZCodeGen.a
ninja: build stopped: subcommand failed.

it doesn't seem to be a deterministic error - restarted ninja just now and it seems to have picked up where it left off. I wonder if that's correlated with the surprising slowness and system impact of mingw (compared to either Microsoft C++ on Windows or GCC on Linux)? I remember it being said that fork is slow on Windows, maybe ninja or GCC make heavy use of fork somehow, or something like that?


On Mon, Apr 25, 2016 at 5:48 AM, barbara via cfe-dev <[hidden email]> wrote:

You have to use Ninja by specifying:   cmake -G "Ninja"

Since building on Windows is a bit trickier I wrote up some documentation. If you find anything unclear please let me know as we want this page to stay current and accurate. If anyone wants to reference this page or incorporate the text in any other documentation, feel free.

http://www.copperspice.com/documentation-clang.html


Barbara


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 <[hidden email]> 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 <[hidden email][hidden email]> 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 <[hidden email][hidden email]> 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 <[hidden email][hidden email]> 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:
should also be still mostly up to date - if it isn't, patches are welcome :D

Cheers,
/Manuel
 


Barbara



I assume you have found:
(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 <[hidden email][hidden email]> 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
[hidden email][hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev










Virus-free. www.avast.com

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Help with libTooling

Renato Golin via cfe-dev
In reply to this post by Renato Golin via cfe-dev
Csaba,

On Windows the Unix generator will not work.  You must use the "Ninja"
generator.

Barbara


> On Sun, Apr 24, 2016 at 3:10 PM, Russell Wallace via cfe-dev
> <[hidden email]> wrote:
>> How did you get LLVM to build with MinGW? I get an error message when I try cmake -G "MinGW Makefiles"
>>
> "cmake --help" will list all available generators. You might need to use
>
> cmake -G "Unix Makefiles"
>
> even on MinGW
>
>
> Csaba


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Help with libTooling

Renato Golin via cfe-dev
In reply to this post by Renato Golin via cfe-dev
Mikhail,

It sounds like you have been through this, which is really helpful for everyone.  Yes, we are using autotools (we will add CMake in a few months) and would really like any scripts you are willing to share.

I have been running the test on Windows while Ansel has been testing on Debian. He was not aware of all the flags you can pass to 'llvm-config', this was great information. Right now he has link issues but not the same ones as I have on Windows. 

Thanks,

Barbara


Hi Barbara,

We're using libTooling in a project and, after a few tries, the minimum libs required that we found was:

-lclangTooling -lclangDriver -lclangFrontend -lclangParse -lclangSerialization -lclangSema -lclangAnalysis -lclangEdit -lclangLex -lclangAST -lclangBasic -lLLVMBitReader -lLLVMOption -lLLVMMC -lLLVMMCParser -lLLVMSupport

The bold part you can get from `llvm-config --libs mcparser option bitreader` (it will actually return them + -lLLVMCore, which increases our static binary by ~9MB). We also append `llvm-config --system-libs`, for llvm's dependencies.

For clang libs, you'll have to write them by yourself as there is no way to request them from the system/pkgconfig (please, someone correct me if I'm wrong).

If you use autotools in your project, I can provide the m4 scripts to find those libraries.

Thank you,


--

Mikhail Ramalho.


Virus-free. www.avast.com

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Help with libTooling

Renato Golin via cfe-dev
Him

2016-04-26 19:14 GMT+01:00 barbara <[hidden email]>:
Mikhail,

It sounds like you have been through this, which is really helpful for everyone.  Yes, we are using autotools (we will add CMake in a few months) and would really like any scripts you are willing to share.


Good for you! I'm trying to convince the team to move to cmake, without success. Anyway, the scripts are:


They might not work well on 32-bit systems.
 
I have been running the test on Windows while Ansel has been testing on Debian. He was not aware of all the flags you can pass to 'llvm-config', this was great information. Right now he has link issues but not the same ones as I have on Windows. 


Cool. If you feel specially curious about how we use libTooling, you can check:


In this class we generate the AST and include builtin headers (mandatory if you want to ship just the binary, e.g., static binaries).


How we traverse the AST and convert it to our internal AST.

If you have any question, feel free to contact us. I didn't find any other (open) tool using the C++ API the way I'm using.

Thank you,

--

Mikhail Ramalho.

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Parsing with libTooling

Renato Golin via cfe-dev
In reply to this post by Renato Golin via cfe-dev

Our many thanks to Chandler, Daniel, Mikhail, Russell, and a few others at CppNow. It was suggested we look at clangTidy which helped us figure out what libraries we needed. The second part was adding --start-group in the makefile, which came from an example Jeff Trull presented at CppNow.

We are now about to successfully link DoxyPress with the libTooling libraries in Autotools!  Of course the same technique will work in our pending CMake build files.

We are able to utilize all of the lib clang code we developed for parsing C++ in the new code using libTooling. Actually the new code is shorter, more efficient, more readable, and requires less contortions.  

At the current time we have two items we have not been able to figure out how to detect in a FunctionDecl.

1    explicit
2    noexcept


Any ideas would be very helpful. 


Thanks,

Barbara
Co-Founder of DoxyPress


Virus-free. www.avast.com

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Parsing with libTooling

Renato Golin via cfe-dev
On Wed, May 25, 2016 at 12:24 PM, barbara via cfe-dev <[hidden email]> wrote:

Our many thanks to Chandler, Daniel, Mikhail, Russell, and a few others at CppNow. It was suggested we look at clangTidy which helped us figure out what libraries we needed. The second part was adding --start-group in the makefile, which came from an example Jeff Trull presented at CppNow.

We are now about to successfully link DoxyPress with the libTooling libraries in Autotools!  Of course the same technique will work in our pending CMake build files.

We are able to utilize all of the lib clang code we developed for parsing C++ in the new code using libTooling. Actually the new code is shorter, more efficient, more readable, and requires less contortions.  

At the current time we have two items we have not been able to figure out how to detect in a FunctionDecl.

1    explicit

Maybe CXXConstructorDecl::isExplicit() works for you there.
 
2    noexcept 

Take a look at FunctionProtoType::getNoexceptSpec/getNoexceptExpr etc.

-- James


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev