Author Topic: errors not clickable for cmake generated project using ninja or make  (Read 8577 times)

Offline fruitCode

  • Multiple posting newcomer
  • *
  • Posts: 13
Hello,

I have a project that is set-up for cmake. Cmake offers the possibility to generate a project file for codeBlocks.
When I generate a project file and open it I see my project files in the Projects workspace tree.
I can also trigger a project compilation by hitting CTRL-F9, it works like a charm.
I get some build errors in the "Build log" window in the bottom of the screen but I cannot click them. I expect that I can click them and that codeBlocks will open that specific file at the line where the error is reported.
I tried this using ninja and make as a build tool, both result in errors not being clickable.
An error looks like this:
"D:\Sources\git-repos\g0046-acu-mh_firmware_acm_2\03_Modules\01_CU_PlatForm\03_Implementation\include\ghdr\Compiler.h",27  Error[Pe020]:
          identifier "__huge" is undefined
  extern __huge U8BIT *CUBaseAddress;


I've used codeBlocks quite a lot in the past and I remembered this was working. Am I wrong? Are there any settings involved that can screw this up?

I tried using codeBlocks 17.12 and 13.12, both the portable version.

thanks

My question is: is

Offline fruitCode

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: errors not clickable for cmake generated project using ninja or make
« Reply #1 on: November 15, 2019, 05:45:05 pm »
I see my post was cut-off somehow..
So my question is: should it work? (clickable errors) and are there any settings related that can influence this behavior? (incorrect settings screwing this up)

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: errors not clickable for cmake generated project using ninja or make
« Reply #2 on: November 15, 2019, 07:51:34 pm »
Are you using a normal CB project or a custom makefile cb project?

I believe that feature is not supported with custom makefile cb projects.

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

Offline osdt

  • Multiple posting newcomer
  • *
  • Posts: 63
Re: errors not clickable for cmake generated project using ninja or make
« Reply #3 on: November 15, 2019, 08:33:17 pm »
AFAIK this feature was never implemented for the "Build log". Use the "Build messages" tab to have CB show the file/line in question.


Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: errors not clickable for cmake generated project using ninja or make
« Reply #4 on: November 16, 2019, 10:55:54 am »
What is the compiler which you're using? The errors/warnings are detected using regular expressions. Most probably none of the regexs matches the line you've posted.
(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 fruitCode

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: errors not clickable for cmake generated project using ninja or make
« Reply #5 on: November 18, 2019, 10:47:21 am »
Are you using a normal CB project or a custom makefile cb project?

I believe that feature is not supported with custom makefile cb projects.

Tim S.

I use a CB project file that is generated by the cmake utility so I guess its a custom one. I use cmake because I build for different targets (PC host for unit and integration tests and a simulator application) and an embedded target running on an ARM processor. Cmake is a great utility to assist in these kind of setups besides that it offers out of source building.

Offline fruitCode

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: errors not clickable for cmake generated project using ninja or make
« Reply #6 on: November 18, 2019, 10:48:51 am »
AFAIK this feature was never implemented for the "Build log". Use the "Build messages" tab to have CB show the file/line in question.

In doesn't work in that tab either

Offline fruitCode

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: errors not clickable for cmake generated project using ninja or make
« Reply #7 on: November 18, 2019, 10:54:49 am »
What is the compiler which you're using? The errors/warnings are detected using regular expressions. Most probably none of the regexs matches the line you've posted.

I am porting code from V850 to ARM, I use an IAR compiler but as an alternative path I also use the GCC ARM compiler (as cmake makes it really easy to have these different setups with fi different compilers for same project - yes I am a fan of it)
Your comment made me think so I tried with the GCC ARM compiler and yes, there it works like a charm. Thanks for hinting!

My conclusion is that the regex don't seem to match the IAR syntax

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: errors not clickable for cmake generated project using ninja or make
« Reply #8 on: November 18, 2019, 07:44:36 pm »
You can add a IAR compiler and then you can tell cmake to use it as the compiler for your project. See https://cmake.org/cmake/help/v3.16/variable/CMAKE_CODEBLOCKS_COMPILER_ID.html

If you make a IAR setup we'll be happy to review and accept a patch. :)
(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 fruitCode

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: errors not clickable for cmake generated project using ninja or make
« Reply #9 on: December 16, 2019, 05:39:06 pm »
Any hints where to find info on how to make an IAR setup? Glad to make one.. Checked the help of C::B but there I could'nt find it, or I overlooked..?

To be clear, I want C::B to build my project still to be build using the makefile/ninja file (generated via cmake) as my project also runs on a jenkins build server.
When fixing some errors, doing changes I want to use C::B IDE (locally)

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: errors not clickable for cmake generated project using ninja or make
« Reply #10 on: December 16, 2019, 09:21:00 pm »
To be clear, I want C::B to build my project still to be build using the makefile/ninja file (generated via cmake) as my project also runs on a jenkins build server.
When fixing some errors, doing changes I want to use C::B IDE (locally)

Do you expect the errors to be clickable and go to code line with error?

Edit: Remove part of the quote because it might mislead.

Tim S.
« Last Edit: December 17, 2019, 02:24:04 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: errors not clickable for cmake generated project using ninja or make
« Reply #11 on: December 17, 2019, 09:20:31 am »
Any hints where to find info on how to make an IAR setup? Glad to make one.. Checked the help of C::B but there I could'nt find it, or I overlooked..?
Probably start with these files:

share/codeblocks/compilers/options_common_re-iar.xml
share/codeblocks/compilers/options_iar8051.xml
share/codeblocks/compilers/options_iararm.xml
(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 stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: errors not clickable for cmake generated project using ninja or make
« Reply #12 on: December 18, 2019, 05:22:36 am »
To be clear, I want C::B to build my project still to be build using the makefile/ninja file (generated via cmake) as my project also runs on a jenkins build server.
When fixing some errors, doing changes I want to use C::B IDE (locally)

Do you expect the errors to be clickable and go to code line with error?

Edit: Remove part of the quote because it might mislead.

Tim S.

I just tried building wxWidgets samples using the wxWidgets makefiles and it worked after I added the files
to the CB project. Did you try that?

It worked means the errors were clickable and opened the files.

Edit2: I am using the native makefile.gcc not ones made by cmake.

Tim S.
 
« Last Edit: December 18, 2019, 05:36:19 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7582
    • My Best Post
Re: errors not clickable for cmake generated project using ninja or make
« Reply #13 on: December 18, 2019, 05:46:52 am »
And, the clickable error/warning requires a valid filename and line number in the first two columns of the "build messages".

Edit: The file path if relative likely needs to be relative to the CB project file location.
If not relative, needs to be in the CB project and likely needs to be the only one with that filename.

Tim S.
« Last Edit: December 18, 2019, 05:51:47 am by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline fruitCode

  • Multiple posting newcomer
  • *
  • Posts: 13
Re: errors not clickable for cmake generated project using ninja or make
« Reply #14 on: December 19, 2019, 05:27:31 pm »
@oBFusCATed Thanks for hinting me about those xml files. Then I noticed there is already the IAR ARM compiler defined, just what I need..

Q1: Where to find the ID number for that compiler setting to be used for CMAKE_CODEBLOCKS_COMPILER_ID ?

When is set this compiler for my project it still didn't work.
Then I went to menu Settings->Compiler
Selected "IAR ARM Compiler" as the selected compiler
Went to the tab "Other settings" and click button "advanced options..."
Click tab "Output parsing"
Then I adjusted the regular expression for "Compiler error" to "(.*)",([0-9]+)[ \t]+Error\[(.*)\]:.*" and then it works
I don't know what regex was there by default but it makes no sense to me...?

Q2: How to parse multi line error messages? The messages are spanned over 3 lines, first line contains file name and line number, second line contains the actual error message and the thirdth line contains the source line where the error is about. I need to match the second line to get the error message.. Tried to use \n in the regex but that didn't work. is it capable of processing multiple lines?

Thanks so far! it really helped me forward.
<rant> Tried the bloated eclipse in the meantime but that was a bad adventure.. Huge download, slow performance and it didn't work either.. (that is error clickable) despite I installed the error parsers provided by IAR. Found some hints on eclipse forums but the interface was totally changed so they were unusable <\rant>