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

Offline astrapi

  • Multiple posting newcomer
  • *
  • Posts: 31
Unable to compile ClangCompletion cbplugin
« on: March 19, 2016, 01:34:36 am »
Hello everybody !

I've found greatfull healp here, so I tried again !

I'm trying to built the clangcompletion plugin for codeblocks.
I've download this --> https://github.com/Lalaland/ClangComplete

I open it with my newlly installed codeblocks ( ;) ) , but I've got this error :

||=== Build: default in ClangComplete (compiler: GNU GCC Compiler) ===|
/home/astrapi/.lib/codeBlocks/ClangComplete-master/ClangComplete.h||In member function ‘wxArrayString ClangComplete::GetCallTips()’:|
/home/astrapi/.lib/codeBlocks/ClangComplete-master/ClangComplete.h|71|warning: no return statement in function returning non-void [-Wreturn-type]|
/home/astrapi/.lib/codeBlocks/ClangComplete-master/ClangComplete.cpp||In function ‘wxString generateCommandString(ProjectFile*)’:|
/home/astrapi/.lib/codeBlocks/ClangComplete-master/ClangComplete.cpp|130|error: invalid initialization of reference of type ‘const CompilerTool&’ from expression of type ‘const CompilerTool*’|
/home/astrapi/.lib/codeBlocks/ClangComplete-master/ClangComplete.cpp|132|error: ‘class Compiler’ has no member named ‘GenerateCommandLine’|
/home/astrapi/.lib/codeBlocks/ClangComplete-master/ClangComplete.cpp|130|warning: unused variable ‘tool’ [-Wunused-variable]|
/home/astrapi/.lib/codeBlocks/ClangComplete-master/ClangComplete.cpp||In member function ‘CXCodeCompleteResults* ClangComplete::getResults(cbEditor*, cbStyledTextCtrl*)’:|
/home/astrapi/.lib/codeBlocks/ClangComplete-master/ClangComplete.cpp|308|warning: narrowing conversion of ‘length’ from ‘int’ to ‘long unsigned int’ inside { } [-Wnarrowing]|
/home/astrapi/.lib/codeBlocks/ClangComplete-master/ClangComplete.cpp|317|warning: unused variable ‘status’ [-Wunused-variable]|
/usr/include/codeblocks/cbplugin.h||In instantiation of ‘static cbPlugin* PluginRegistrant<T>::CreatePlugin() [with T = ClangComplete]’:|
/usr/include/codeblocks/cbplugin.h|1109|required from ‘PluginRegistrant<T>::PluginRegistrant(const wxString&) [with T = ClangComplete]’|
/home/astrapi/.lib/codeBlocks/ClangComplete-master/ClangComplete.cpp|70|required from here|
/usr/include/codeblocks/cbplugin.h|1116|error: invalid new-expression of abstract class type ‘ClangComplete’|
/home/astrapi/.lib/codeBlocks/ClangComplete-master/ClangComplete.h|28|note:   because the following virtual functions are pure within ‘ClangComplete’:|
/usr/include/codeblocks/cbplugin.h|822|note:     virtual cbCodeCompletionPlugin::CCProviderStatus cbCodeCompletionPlugin::GetProviderStatusFor(cbEditor*)|
/usr/include/codeblocks/cbplugin.h|869|note:     virtual std::vector<cbCodeCompletionPlugin::CCToken> cbCodeCompletionPlugin::GetAutocompList(bool, cbEditor*, int&, int&)|
/usr/include/codeblocks/cbplugin.h|881|note:     virtual wxString cbCodeCompletionPlugin::GetDocumentation(const cbCodeCompletionPlugin::CCToken&)|
/usr/include/codeblocks/cbplugin.h|902|note:     virtual std::vector<cbCodeCompletionPlugin::CCCallTip> cbCodeCompletionPlugin::GetCallTips(int, int, cbEditor*, int&)|
/usr/include/codeblocks/cbplugin.h|914|note:     virtual std::vector<cbCodeCompletionPlugin::CCToken> cbCodeCompletionPlugin::GetTokenAt(int, cbEditor*, bool&)|
/usr/include/codeblocks/cbplugin.h|925|note:     virtual wxString cbCodeCompletionPlugin::OnDocumentationLink(wxHtmlLinkEvent&, bool&)|
||=== Build failed: 3 error(s), 7 warning(s) (0 minute(s), 5 second(s)) ===|



reference to this part of code :
Code: [Select]
const CompilerTool &tool = comp->GetCompilerTool(ctCompileObjectCmd,_(".cpp"));
    wxString tempCommand = _("$options $includes");
    comp->GenerateCommandLine(tempCommand,target,file,UnixFilename(pfd.source_file_absolute_native),Object,pfd.object_file_flat,
                              pfd.dep_file);
    return tempCommand;


If someone see the problem...

I'm with Starting Code::Blocks Release 16.01  rev 10760 Feb  2 2016, 03:11:29 - wx2.8.12 (Linux, unicode) - 64 bit
On ubuntu



Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: Unable to compile ClangCompletion cbplugin
« Reply #1 on: March 19, 2016, 02:28:49 am »
You may want to try https://github.com/yvesdm3000/ClangLib.  That is where active development is.  The project file probably needs to be tweaked to remove absolute paths first though.

If you run into problems with it, you could alternatively try https://github.com/alpha0010/ClangLib/tree/threads (threads branch).

Offline astrapi

  • Multiple posting newcomer
  • *
  • Posts: 31
Re: Unable to compile ClangCompletion cbplugin
« Reply #2 on: March 19, 2016, 08:50:51 am »
Wonderful I try all this as soon as possible, thanks !

Offline astrapi

  • Multiple posting newcomer
  • *
  • Posts: 31
Re: Unable to compile ClangCompletion cbplugin
« Reply #3 on: March 19, 2016, 09:59:29 am »
Sorry sorry, surely that's look better, but I load the clanlib.cdb (unix)
and I have this error

Scanned 0 files for #includes, cache used 0, cache updated 0
g++-5 -DBUILDING_PLUGIN -O3 -Wextra -Wall -std=c++0x -ansi (invalid) -I/usr/lib/llvm-3.4/include -fmessage-length=0 -fexceptions -Winvalid-pch -fPIC -pthread -DcbDEBUG -DCB_PRECOMP -DWX_PRECOMP -Wall -std=c++0x -std=c++11 -std=c++14 -D__GXX_EXPERIMENTAL_CXX0X__ -I/usr/include/codeblocks -I/usr/lib/llvm-3.4/include/ -I. -I../codeblocks-1510/src/include -c /home/astrapi/.lib/codeBlocks/ClangLib-master/cclogger.cpp -o .objs/plugins/clanglib/cclogger.o

/bin/sh: 1: Syntax error: "(" unexpecte


Certainly it's not terrible... But I don't know what to  do...

In the build option I see that there was a relative path to ..codeblockas-16.01/sdk/wxscintilla but I don't have this lib, and I can't see what thing I'v got to install... (it's really obscure all this for me...)

Thanks again for helping!
« Last Edit: March 19, 2016, 10:04:01 am by astrapi »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12062
    • Travis build status
Re: Unable to compile ClangCompletion cbplugin
« Reply #4 on: March 19, 2016, 02:53:02 pm »
You have this "(invalid)" in the command which means that you have not defined a global variable.
Go to the settings -> global variables and define it.
Then rebuild.
Also clean up all the -std and ansi option. You have almost all of them in a single command which is not good.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline astrapi

  • Multiple posting newcomer
  • *
  • Posts: 31
Re: Unable to compile ClangCompletion cbplugin
« Reply #5 on: March 19, 2016, 04:43:45 pm »
Oye oye oye...
It's in progress ! I've set a folder to my global variable (but I don't know what it is)
After little probleme of include I've got this :




-------------- Build: Release in clanglib (Unix) (compiler: GNU GCC Compiler)---------------

g++-5 -DBUILDING_PLUGIN -O3 -Wextra -Wall -std=c++0x -ansi /home/astrapi/.lib/codeBlocks -I/usr/lib/llvm-3.4/include -fmessage-length=0 -fexceptions -Winvalid-pch -fPIC -pthread -DcbDEBUG -DCB_PRECOMP -DWX_PRECOMP -Wall -D__GXX_EXPERIMENTAL_CXX0X__ -I/usr/include/codeblocks -I/usr/lib/llvm-3.4/include/ -I/usr/lib/x86_64-linux-gnu/wx/include/gtk2-unicode-3.0 -I/usr/include/wx-3.0/ -I. -I../codeblocks-1510/src/include -c /home/astrapi/.lib/codeBlocks/ClangLib-master/cclogger.cpp -o .objs/plugins/clanglib/cclogger.o
In file included from /usr/include/wx-3.0/wx/string.h:24:0,
                 from /home/astrapi/.lib/codeBlocks/ClangLib-master/cclogger.h:9,
                 from /home/astrapi/.lib/codeBlocks/ClangLib-master/cclogger.cpp:10:
/usr/include/wx-3.0/wx/defs.h:46:13: error: #error "No Target! You should use wx-config program for compilation flags!"
 #           error "No Target! You should use wx-config program for compilation flags!"


My other compilations options of the built program :

$(#CB_RELEASE_TYPE)
`wx-config --version=2.8 --cflags`
-I`llvm-config --includedir`
-fmessage-length=0
-fexceptions
-Winvalid-pch
-fPIC
-pthread


I'm all yours

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12062
    • Travis build status
Re: Unable to compile ClangCompletion cbplugin
« Reply #6 on: March 19, 2016, 06:11:47 pm »
What is the output of "wx-config --version=2.8 --cflags" if you run it in a console?
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline astrapi

  • Multiple posting newcomer
  • *
  • Posts: 31
Re: Unable to compile ClangCompletion cbplugin
« Reply #7 on: March 19, 2016, 06:36:03 pm »
Code: [Select]
✔ astrapi 18:34:21 ~ ▶ wx-config --version=2.8 --cflags

          Warning: No config found to match: /usr/bin/wx-config --version=2.8 --cflags
                   in /usr/lib/x86_64-linux-gnu/wx/config
          If you require this configuration, please install the desired
          library build.  If this is part of an automated configuration
          test and no other errors occur, you may safely ignore it.
          You may use wx-config --list to see all configs available in
          the default

✘ astrapi 18:34:44 ~ ▶ which wx-config
/bin/wx-config
✔ astrapi 18:34:54 ~ ▶ wx-config --list

    Default config is gtk2-unicode-3.0

  Default config will be used for output

  Alternate matches:
    base-unicode-3.0


« Last Edit: March 19, 2016, 06:41:28 pm by astrapi »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6661
    • My Best Post
Re: Unable to compile ClangCompletion cbplugin
« Reply #8 on: March 20, 2016, 02:04:24 am »
The Plugin seems to not yet support wxWidgets 3.0.

Does your Code::Blocks installation use wxWidgets 3.0? (yes or no)
Do you or can you self-build Code::Blocks? (yes,no,maybe)

I have forked one of the Git Repos listed above and I am doing changes in this location https://github.com/stahta01/ClangLib/tree/build/tim_s

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 #9 on: March 20, 2016, 02:43:03 am »
So, for my codeblocks version :

✔ astrapi 18:40:50 ~ ▶ codeblocks -v
Starting Code::Blocks Release 16.01  rev 10760 Feb  2 2016, 03:11:29 - wx2.8.12 (Linux, unicode) - 64 bit


Can I "down"date my wx-config to wx2.8 ? (does this question have a sense ?)

I think I can probably built codeblocks, with some probleme maybe.

I try to built right now your clanglib, thank you a lot !
(Codeblocks at start up of your project clanglib wx3.0.x ask me Global variable editor current variable cb, I don't what that mean, is this important ?)

I've got this error
-------------- Build: use_pch in clanglib  wx3.0.x - Unix (compiler: GNU GCC Compiler)---------------

g++-5 -DBUILDING_PLUGIN -DCB_PRECOMP -DWX_PRECOMP -O3 -Wextra -Wall -std=c++0x -ansi -fPIC /home/astrapi/.lib/codeBlocks -I/usr/lib/x86_64-linux-gnu/wx/include/gtk2-unicode-3.0 -I/usr/include/wx-3.0 -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL -D__WXGTK__ -pthread -I/usr/lib/llvm-3.4/include -fmessage-length=0 -fexceptions -Winvalid-pch -pthread -DcbDEBUG -Wall -std=c++11 -std=c++14 -D__GXX_EXPERIMENTAL_CXX0X__ -I/usr/include/codeblocks -I/usr/lib/llvm-3.4/include/ -I/usr/lib/x86_64-linux-gnu/wx/include/gtk2-unicode-3.0 -I/usr/include/wx-3.0/ -I/usr/include/codeblocks/wxscintilla/include -c /home/astrapi/.lib/codeBlocks/ClangLib-build-tim_s/clangccsettingsdlg.cpp -o .objs/plugins/clanglib/clangccsettingsdlg.o
In file included from /home/astrapi/.lib/codeBlocks/ClangLib-build-tim_s/translationunit.h:5:0,
                 from /home/astrapi/.lib/codeBlocks/ClangLib-build-tim_s/clangproxy.h:11,
                 from /home/astrapi/.lib/codeBlocks/ClangLib-build-tim_s/clangplugin.h:9,
                 from /home/astrapi/.lib/codeBlocks/ClangLib-build-tim_s/clangccsettingsdlg.cpp:39:
/usr/include/clang-c/Documentation.h:40:3: error: conflicting declaration ‘typedef struct CXComment CXComment’
 } CXComment;


reference to that part of code :
Code: [Select]
/**
 * \brief A parsed comment.
 */
typedef struct {
  const void *ASTNode;
  CXTranslationUnit TranslationUnit;
} CXComment;

Thanks again !

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6661
    • My Best Post
Re: Unable to compile ClangCompletion cbplugin
« Reply #10 on: March 20, 2016, 04:44:43 am »
I have NOT fixed the Linux wxWidgets 2.8 CB Project, yet.

I will work on it when I have time.

The CB Global variable points to the location in which I self-built Code::Blocks.
I ask questions in order to get answers.
Edit2: I am thinking your answer counts as maybe; after I re-read it a second time.
Since, your CB is already using wxWidgets 2.8.x; self building Code::Blocks is NOT the best solution for you.
But, I can NOT test the changes needed in the wxGTK28 Unix project. I will post in this thread when I think I have a CB Project for your to test.

Tim S.
« Last Edit: March 20, 2016, 04:51:28 am 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 yvesdm3000

  • Almost regular
  • **
  • Posts: 226
Re: Unable to compile ClangCompletion cbplugin
« Reply #11 on: March 20, 2016, 07:55:15 am »
Thanks for making a wx30 project. Don't forget to make a pull-request back.

Maybe I could backport the wx30 project to wx28 and make all paths relative properly?

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 #12 on: March 20, 2016, 11:01:39 am »
What I understand is that you are working on it, so I wait for you and it will be ok.

Wonderful thank you very much (I am the only one with this problem ? )

Just for understand better, I can't install clangplugin because my version of wxWidgets is higher than the one
the clanglib plugin uses ?

Thank you guys with skills , without you, Linux and open source softwares couldn't exist !
« Last Edit: March 20, 2016, 11:06:55 am by astrapi »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6661
    • My Best Post
Re: Unable to compile ClangCompletion cbplugin
« Reply #13 on: March 20, 2016, 02:31:38 pm »
What I understand is that you are working on it, so I wait for you and it will be ok.

Wonderful thank you very much (I am the only one with this problem ? )

Just for understand better, I can't install clangplugin because my version of wxWidgets is higher than the one
the clanglib plugin uses ?

Thank you guys with skills , without you, Linux and open source softwares couldn't exist !

You are on an LInux system using wxWidgets 2.8.x; like the person doing the most recent plugin updates.
I am on the newer version of wxWidgets 3.0.x; so, I have the newer version.
I am going to attach an CB Project for yvesdm3000 to test. Along with an NOPCH patch.
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 stahta01

  • Lives here!
  • ****
  • Posts: 6661
    • My Best Post
Re: Unable to compile ClangCompletion cbplugin
« Reply #14 on: March 20, 2016, 02:44:59 pm »
Thanks for making a wx30 project. Don't forget to make a pull-request back.

Maybe I could backport the wx30 project to wx28 and make all paths relative properly?

Yves
Linking to wxGTK2.8 untested CB Project. https://github.com/stahta01/ClangLib/blob/build/tim_s/clanglib_wxGTK28-unix.cbp
And, attaching NOPCH patch; the above project is a NOPCH project for default target.

FYI: My wxGTK3.0 project crashes CB when I try to install the plugin.
I removed the -pthread option to see if the crash went away; it did NOT. You will likely need to add that option back.

I am still at advance beginner on using Git; once I get the code to work right. I will apply my patch to the master branch and try to do a pull-request.

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