Author Topic: Unable to compile ClangCompletion cbplugin  (Read 13697 times)

Offline astrapi

  • Multiple posting newcomer
  • *
  • Posts: 31
Re: Unable to compile ClangCompletion cbplugin
« Reply #30 on: March 21, 2016, 06:30:36 pm »
I've juste some little problem, I've tried and successfully build :
https://github.com/yvesdm3000/ClangLib
https://github.com/alpha0010/ClangLib/tree/threads (the thread branch ... even if I don't understand what that mean)
These 2 built and I've got my .so and .zip, codeblocks reconize them but they don't auto complete auto and shared_ptr better than the auto completion plugin basic

With the one of tim_s it's an other story. It works ! I've try with nopch and usepch (I don't know what that mean ever), the result is the same :
He complete auto and shared_ptr (YAHOUU !!) BUT, I've note access to (doxy)documentation anymore
And if I tick parse documentation of the code assistance plugin, he didn't save it...
Same for disaling diagnostic he don't listen to me, maybe there is something to do the other file compiled : .xrc .xrc and .xml ?
And I can't see (sometime) the bar completion with the name of fonctions and class... And sometimes he didn't complete... Why why why ?  :o

I surely did something wrong but what ?
« Last Edit: March 21, 2016, 06:49:01 pm by astrapi »

Offline yvesdm3000

  • Almost regular
  • **
  • Posts: 226
Re: Unable to compile ClangCompletion cbplugin
« Reply #31 on: March 21, 2016, 08:27:11 pm »
Don't forget to disable the builtin code-completion. Sometimes you don't know which one the main C::B app will choose to make the code-completion.

No problem here with std::shared_ptr<>. The only thing is that you have to make sure you have the correct headers included and a drawback of any clang-based code-completion is that the code up to your std::shared_ptr use should have code that can be compiled without errors. That's a reason why we also have the inline diagnostics to make that possible.

For configuring the diagnostics, there are some fixes ready in the 'staging' branch and that branch is almost ready to be merged into master. It should be good enough right now for you to test. I just happen to commit a fix for the semantic occurrences highlight an hour ago.

Yves
Clang based code completion for Code::Blocks:   http://github.com/yvesdm3000/ClangLib

Offline astrapi

  • Multiple posting newcomer
  • *
  • Posts: 31
Re: Unable to compile ClangCompletion cbplugin
« Reply #32 on: March 21, 2016, 09:09:59 pm »
I've download the staging brank there : https://github.com/yvesdm3000/ClangLib/tree/staging
And I got these errors :

translationunit.h:54         assert( first.m_id == second.m_Id ); //I suppose

Code: [Select]
[color=green]ClangLib-staging/clangproxy.cpp||In function ‘wxString HTML_Writer::Escape(const wxString&)’:|
/home/astrapi/.lib/codeBlocks/ClangLib-staging/clangproxy.cpp|276|error: ambiguous default type conversion from ‘wxString::const_iterator::reference {aka wxUniChar}’|[/color]
/home/astrapi/.lib/codeBlocks/ClangLib-staging/clangproxy.cpp|276|note:   candidate conversions include ‘wxUniChar::operator char() const’ and ‘wxUniChar::operator unsigned char() const’|
/home/astrapi/.lib/codeBlocks/ClangLib-staging/clangproxy.cpp||In function ‘wxString HTML_Writer::SyntaxHl(const wxString&, const std::vector<wxString>&)’:|
/home/astrapi/.lib/codeBlocks/ClangLib-staging/clangproxy.cpp|318|error: operands to ?: have different types ‘wxUniChar’ and ‘wchar_t’|
/home/astrapi/.lib/codeBlocks/ClangLib-staging/clangproxy.cpp|318|note:   and each type can be converted to the other|
/home/astrapi/.lib/codeBlocks/ClangLib-staging/clangproxy.cpp|319|error: operands to ?: have different types ‘wxUniChar’ and ‘wchar_t’|
/home/astrapi/.lib/codeBlocks/ClangLib-staging/clangproxy.cpp|319|note:   and each type can be converted to the other|
/home/astrapi/.lib/codeBlocks/ClangLib-staging/clangproxy.cpp||In member function ‘void ClangProxy::RemoveTranslationUnit(ClTranslUnitId)’:|
/home/astrapi/.lib/codeBlocks/ClangLib-staging/clangproxy.cpp|760|error: use of deleted function ‘ClTranslationUnit& ClTranslationUnit::operator=(const ClTranslationUnit&)’|
/home/astrapi/.lib/codeBlocks/ClangLib-staging/translationunit.h|30|note: ‘ClTranslationUnit& ClTranslationUnit::operator=(const ClTranslationUnit&)’ is implicitly declared as deleted because ‘ClTranslationUnit’ declares a move constructor or move assignment operator|
/home/astrapi/.lib/codeBlocks/ClangLib-staging/clangproxy.cpp||In member function ‘void ClangProxy::GetFunctionScopes(ClTranslUnitId, const wxString&, std::vector<std::pair<wxString, wxString> >&)’:|
/home/astrapi/.lib/codeBlocks/ClangLib-staging/clangproxy.cpp|1762|error: no matching function for call to ‘make_pair(const wxString&, const wxString&)’|
/usr/include/c++/5/bits/stl_pair.h|276|note: candidate: template<class _T1, class _T2> constexpr std::pair<typename std::__decay_and_strip<_Tp>::__type, typename std::__decay_and_strip<_T2>::__type> std::make_pair(_T1&&, _T2&&)|
/usr/include/c++/5/bits/stl_pair.h|276|note:   template argument deduction/substitution failed:|
/home/astrapi/.lib/codeBlocks/ClangLib-staging/clangproxy.cpp|1762|note:   cannot convert ‘it.__gnu_cxx::__normal_iterator<_Iterator, _Container>::operator-><const ClFunctionScope*, std::vector<ClFunctionScope> >()->ClFunctionScope::scopeName’ (type ‘const wxString’) to type ‘wxString&&’|
||=== Build failed: 5 error(s), 21 warning(s) (0 minute(s), 55 second(s)) ===|



(Thanks to help !)
« Last Edit: March 21, 2016, 09:46:50 pm by astrapi »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6661
    • My Best Post
Re: Unable to compile ClangCompletion cbplugin
« Reply #33 on: March 21, 2016, 11:08:43 pm »
Here is how I got past the wxWidgets 3.0 errors; Note, I thought you needed to use wxWidgets 2.8.

NOTE: I am NOT sure [if] this is the correct or even valid runtime fix for the compiler error!!

Tim S.

Code: [Select]
diff --git a/clangproxy.cpp b/clangproxy.cpp
index e6d840b..ff14c0b 100644
--- a/clangproxy.cpp
+++ b/clangproxy.cpp
@@ -273,7 +274,7 @@ static wxString Escape(const wxString& text)
     for (wxString::const_iterator itr = text.begin();
             itr != text.end(); ++itr)
     {
-        switch (*itr)
+        switch (wxChar(*itr))
         {
         case wxT('&'):
             html += wxT("&amp;");
@@ -315,8 +316,8 @@ static wxString SyntaxHl(const wxString& code, const std::vector<wxString>& cppK
     const int codeLen = code.Length();
     for (int enRg = 0; enRg <= codeLen; ++enRg)
     {
-        wxChar ch = (enRg < codeLen ? code[enRg] : wxT('\0'));
-        wxChar nextCh = (enRg < codeLen - 1 ? code[enRg + 1] : wxT('\0'));
+        wxChar ch = (enRg < codeLen ? wxChar(code[enRg]) : wxT('\0'));
+        wxChar nextCh = (enRg < codeLen - 1 ? wxChar(code[enRg + 1]) : wxT('\0'));
         switch (style)
         {
         default:
« Last Edit: March 21, 2016, 11:10:39 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline astrapi

  • Multiple posting newcomer
  • *
  • Posts: 31
Re: Unable to compile ClangCompletion cbplugin
« Reply #34 on: March 21, 2016, 11:38:22 pm »
Oups... You're right....

But how can I knew that it was for wx-3.0 and not 2.8 ?

It helps at least ? (a bit)

If I put wx-config --version=2.8 it will not work ? (no it doesn't...)

But you are (Yves and Tim S, the best version of clanglib that I can found isn't it ?)
« Last Edit: March 21, 2016, 11:56:28 pm by astrapi »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6661
    • My Best Post
Re: Unable to compile ClangCompletion cbplugin
« Reply #35 on: March 21, 2016, 11:55:55 pm »
Look at the build logs and you can see which wxWidgets is being used in the Compiler and Linking steps.

If you do NOT know how to understand the "build logs" then please give up or learn to understand them!

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline astrapi

  • Multiple posting newcomer
  • *
  • Posts: 31
Re: Unable to compile ClangCompletion cbplugin
« Reply #36 on: March 22, 2016, 12:19:04 am »
The build log is the input where g++ is shown isn't it ?

Code: [Select]
-------------- Build: ClangLib in clanglib (Unix) (compiler: GNU GCC Compiler)---------------

g++-5 /home/astrapi/.lib/codeBlocks -I/usr/lib/x86_64-linux-gnu/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread -I/usr/lib/llvm-3.6/include -fmessage-length=0 -fexceptions -Winvalid-pch -fPIC -pthread -DBUILDING_PLUGIN -O3 -Wextra -Wall -std=c++0x -ansi /home/astrapi/.lib/codeBlocks -I/usr/lib/x86_64-linux-gnu/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread -I/usr/lib/llvm-3.6/include -fmessage-length=0 -fexceptions -Winvalid-pch -fPIC -pthread -DcbDEBUG -DCB_PRECOMP -DWX_PRECOMP -Wall -std=c++11 -std=c++14 -D__GXX_EXPERIMENTAL_CXX0X__ -I/usr/include/codeblocks -I/usr/include/codeblocks/wxscintilla/include -I. -c /home/astrapi/.lib/codeBlocks/ClangLib-staging/clangproxy.cpp -o .objs/plugins/clanglib/clangproxy.o

If not I will pass my way and took off my hat no problem, and take a litte tour on openclassroom or something :)

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6661
    • My Best Post
Re: Unable to compile ClangCompletion cbplugin
« Reply #37 on: March 22, 2016, 01:42:02 am »
It is one line of the build log; but, it shows many possible problems!
You are likely using a different C++ Compiler then was used to build Code::Blocks; on Windows this will fail to work; not sure on Linux.
I have no idea what GCC C++ version was used to build Code::Blocks on your OS. ( I just realized this might be my issue on Linux.)
You have both "-std=c++11" and "-std=c++14" in it.
I question this "-D__GXX_EXPERIMENTAL_CXX0X__"; it could be valid or it might not be valid.
You do appear to be using wxWidgets 2.8; from "-I/usr/lib/x86_64-linux-gnu/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8"

Tim S.

The build log is the input where g++ is shown isn't it ?

Code: [Select]
-------------- Build: ClangLib in clanglib (Unix) (compiler: GNU GCC Compiler)---------------

g++-5 /home/astrapi/.lib/codeBlocks -I/usr/lib/x86_64-linux-gnu/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread -I/usr/lib/llvm-3.6/include -fmessage-length=0 -fexceptions -Winvalid-pch -fPIC -pthread -DBUILDING_PLUGIN -O3 -Wextra -Wall -std=c++0x -ansi /home/astrapi/.lib/codeBlocks -I/usr/lib/x86_64-linux-gnu/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread -I/usr/lib/llvm-3.6/include -fmessage-length=0 -fexceptions -Winvalid-pch -fPIC -pthread -DcbDEBUG -DCB_PRECOMP -DWX_PRECOMP -Wall -std=c++11 -std=c++14 -D__GXX_EXPERIMENTAL_CXX0X__ -I/usr/include/codeblocks -I/usr/include/codeblocks/wxscintilla/include -I. -c /home/astrapi/.lib/codeBlocks/ClangLib-staging/clangproxy.cpp -o .objs/plugins/clanglib/clangproxy.o

If not I will pass my way and took off my hat no problem, and take a litte tour on openclassroom or something :)
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline astrapi

  • Multiple posting newcomer
  • *
  • Posts: 31
Re: Unable to compile ClangCompletion cbplugin
« Reply #38 on: March 22, 2016, 10:59:27 am »
I install codeblocks from ppa:damien-moore/codeblocks-stable with apt-get, apt-get use g++
and I use in my program g++-5 (I should make a symbolic link to g++-5 to g++ maybe if it can make problem
to use different compiler).
I thought that it was normal to have -std=c++11 AND -std=c++14, so -std=c++14 is enough.
For "-D__GXX_EXPERIMENTAL_CXX0X__" it's something I found on internet, it is suppose to tell at he precompiler
how understand shared_ptr in purpose to have completion for it (for what I understand)
In your project I've replace "wx-config --libs/--cflags" by "wx-config --version=2.8 --libs/--cflags" for built it with the
same wxWidgets than my codeblocks but maybe if you are builting it for codeblocks with wxWidgets3.0 there are
some functions or differences that make some errors...

I don't know what I have to do, do I continue to try to built Yves or Tim S libclang ? (I'm sorry all this is new for me :compling myself, so I understand little step by little step)

I've tried to built https://github.com/yvesdm3000/ClangLib/tree/staging plugin without c++14 (I think it just need c++11) without g++-5 but g++, and without
-D__GXX_EXPREIMENTAL_CXX0X__ but I come the same errors :

Code: [Select]
||=== Build: ClangLib in clanglib (Unix) (compiler: GNU GCC Compiler) ===|
||warning: /home/astrapi/Bureau: linker input file unused because linking not done| /// Because of my local variable the thing that I don't undersant what is for
/home/astrapi/.lib/codeBlocks/ClangLib-staging/clangproxy.cpp||In member function ‘void ClangProxy::RemoveTranslationUnit(ClTranslUnitId)’:|
/home/astrapi/.lib/codeBlocks/ClangLib-staging/clangproxy.cpp|760|error: use of deleted function ‘ClTranslationUnit& ClTranslationUnit::operator=(const ClTranslationUnit&)’|
/home/astrapi/.lib/codeBlocks/ClangLib-staging/translationunit.h|30|note: ‘ClTranslationUnit& ClTranslationUnit::operator=(const ClTranslationUnit&)’ is implicitly declared as deleted because ‘ClTranslationUnit’ declares a move constructor or move assignment operator|
/home/astrapi/.lib/codeBlocks/ClangLib-staging/clangproxy.cpp||In member function ‘void ClangProxy::GetFunctionScopes(ClTranslUnitId, const wxString&, std::vector<std::pair<wxString, wxString> >&)’:|
/home/astrapi/.lib/codeBlocks/ClangLib-staging/clangproxy.cpp|1762|error: no matching function for call to ‘make_pair(const wxString&, const wxString&)’|
/home/astrapi/.lib/codeBlocks/ClangLib-staging/clangproxy.cpp|1762|note: candidate is:|
/usr/include/c++/4.8/bits/stl_pair.h|276|note: template<class _T1, class _T2> constexpr std::pair<typename std::__decay_and_strip<_Tp>::__type, typename std::__decay_and_strip<_T2>::__type> std::make_pair(_T1&&, _T2&&)|
/usr/include/c++/4.8/bits/stl_pair.h|276|note:   template argument deduction/substitution failed:|
/home/astrapi/.lib/codeBlocks/ClangLib-staging/clangproxy.cpp|1762|note:   cannot convert ‘it.__gnu_cxx::__normal_iterator<_Iterator, _Container>::operator-><const ClFunctionScope*, std::vector<ClFunctionScope> >()->ClFunctionScope::scopeName’ (type ‘const wxString’) to type ‘wxString&&’|
||=== Build failed: 2 error(s), 10 warning(s) (0 minute(s), 32 second(s)) ===|

Questions :
1) I've seen this include in your project : ../codeblocks-1510/src/include
 and this one : ../codeblocks_src/src/include.
Me I just put /usr/include/codeblocks/ AND /usr/include/codeblocks/wxscintilla/include (because I don't understand
what else to put)
Did I again miss something ?
2) $(#CB_RELEASE_TYPE) is the global variable, I've see that it's in setting global variables cb-release-type that I
configure it, but I've always this linking undone.
What do I have to put in base ?
In include ? (/usr/include/codeblocks no ?)
In lib ? the place where is libcodeblocks.so no ?
3) maybe it will be easier if I built codeblocks (with wxWidgets3.0) myself with the same version as you've got ? (now I understand a bit more compilng stuff) ?
« Last Edit: March 22, 2016, 11:03:19 am by astrapi »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6661
    • My Best Post
Re: Unable to compile ClangCompletion cbplugin
« Reply #39 on: March 22, 2016, 05:47:22 pm »
I would suggest self building Code::Blocks using wxWidgets 2.8 version already on your computer.
I would NOT install it; in other words skip the step "make install".
I will try to self build wxWidgets 2.8 and Code::Blocks; since I have failed to get the Plugin to work with wxWidgets 3.0 (It causes runtime crashes on CB startup.)
This will eliminate wxWidgets 3.0 as a possible cause.

3) maybe it will be easier if I built codeblocks (with wxWidgets3.0) myself with the same version as you've got ? (now I understand a bit more compilng stuff) ?
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline astrapi

  • Multiple posting newcomer
  • *
  • Posts: 31
Re: Unable to compile ClangCompletion cbplugin
« Reply #40 on: March 22, 2016, 06:05:40 pm »
Ok so I find the last version of codeblocks  using wxWidgets 2.8 I built it but not install it , and wait for further
instructions.

Thanks guys !

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6661
    • My Best Post
Re: Unable to compile ClangCompletion cbplugin
« Reply #41 on: March 22, 2016, 07:16:04 pm »
I just realized that you can use Code::Blocks to build Code::Blocks instead of the normal configure/make method.

Tim S.

Ok so I find the last version of codeblocks  using wxWidgets 2.8 I built it but not install it , and wait for further
instructions.

Thanks guys !
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline astrapi

  • Multiple posting newcomer
  • *
  • Posts: 31
Re: Unable to compile ClangCompletion cbplugin
« Reply #42 on: March 22, 2016, 09:19:15 pm »
Cool that what I tought but what version did I take ?
source code or source code from svn ?
http://www.codeblocks.org/downloads/25   http://www.codeblocks.org/downloads/7 ?
     (I suppose source code normal)

codeblocks-16.01-1.el7.src.rpm or codeblocks_16.01.tar.gz ?
     (I suppose .tar.gz )

In what it will be useful ? Isn't the same codeblocks than mine ?

(Don't answere the suppose if they are right (save ink) )

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6661
    • My Best Post
Re: Unable to compile ClangCompletion cbplugin
« Reply #43 on: March 22, 2016, 11:22:06 pm »
If you want to fix bugs and/or add features I would use SVN or Git to checkout a repo.
If you know neither Git or SVN, I would suggest SVN aka subversion.
If you have no plans to fix bugs or add features to Code::Blocks, I will see that download is best and add it to this post by editing.

This file looks best codeblocks_16.01.tar.gz if you have no plans to fix bugs or add features.
I used to use this URL to get version control repos. http://wiki.codeblocks.org/index.php/Developer_documentation
But, I would suggest using my Git repo if you wish to use Git. I have too much trouble using the CB Devs git repos.
But, I am a Windows Git user and I think the CB Dev Team are non-windows people.
https://github.com/stahta01/codeblocks_svn2git_https_metadata.git
Do NOT try to push to this repo; for two reasons.
1. I only copy stuff to this repo from CB SVN repo.
2. I have no idea how to handle pull request, because I have no write permissions to the CB SVN repo.

NOTE: You need to follow these steps to get "git svn info" to work after doing an git clone. https://github.com/stahta01/cb_misc/blob/master/Notes/Fix%20Git%20SVN%20information%20steps.txt
Edit: I have used these steps under Debian Linux without any issues.

Tim S.

Cool that what I tought but what version did I take ?
source code or source code from svn ?
http://www.codeblocks.org/downloads/25   http://www.codeblocks.org/downloads/7 ?
     (I suppose source code normal)

codeblocks-16.01-1.el7.src.rpm or codeblocks_16.01.tar.gz ?
     (I suppose .tar.gz )

In what it will be useful ? Isn't the same codeblocks than mine ?

(Don't answere the suppose if they are right (save ink) )
« Last Edit: March 22, 2016, 11:33:04 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline astrapi

  • Multiple posting newcomer
  • *
  • Posts: 31
Re: Unable to compile ClangCompletion cbplugin
« Reply #44 on: March 22, 2016, 11:56:43 pm »
Thanks ! I will I think get the codeblocks_16.01.tar.gz, because I don't know how contribute for codeblocks... (Haven't got the skills anyway for now.) And it looks easier too.

I up for new arrival or new features for ClangLib, thank you again (I say a lot thank you but it's really nice to take time for other people indeed )

Pierre