Author Topic: Compiler Toolchain Setting seems to be ignored in Version 20.03  (Read 1913 times)

Offline BackInTheSandbox

  • Multiple posting newcomer
  • *
  • Posts: 16
Hello,
today I installed Code::Blocks version 20.03. I made sure to be able to switch back and forth between this new version and 17.12.
As compiler we use 'GNU GCC Compiler for TriCore v3.4.6'.
When compiling an existing project I get "undefined reference to `cosf'" from a c-file which uses math.h. With Code::Blocks 17.12 the same project compiles fine, although all settings are identical. It took me a while to identify the difference between the two versions. I set the compiler logging to 'Full command line' and compared the outputs of both versions.

One of the last lines is:
From Code::Blocks 17.12:
Code: [Select]
tricore-g++.exe -L..\..[...]From Code::Blocks 20.03:
Code: [Select]
tricore-gcc.exe -L..\..[...]
Attached a screenshot of the compiler settings, identical in both versions. It seems to me that the 20.03 version ignores the 'Linker for dynamic libs' setting and uses the 'C compiler' as linker. Have I detected a bug, or do I have to change some other setting to get it to work?
TIA,


Online stahta01

  • Lives here!
  • ****
  • Posts: 7017
    • My Best Post
Re: Compiler Toolchain Setting seems to be ignored in Version 20.03
« Reply #1 on: April 27, 2020, 10:19:56 pm »
There is a new setting; but, I have no idea where it is.

I think it has the word "auto" in it.

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

Online stahta01

  • Lives here!
  • ****
  • Posts: 7017
    • My Best Post
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 BackInTheSandbox

  • Multiple posting newcomer
  • *
  • Posts: 16
Re: Compiler Toolchain Setting seems to be ignored in Version 20.03
« Reply #3 on: April 28, 2020, 08:47:56 am »
http://forums.codeblocks.org/index.php/topic,23491.msg162590.html#msg162590

Thanks, that helped. The solution which works for me is:

I just switched my codeblocks version from 13.12 to 20.03 and I found that some of my old projects don't link anymore.

[...] I found a new option under "Project"->"Build options.."->"Linker Settings" - "Linker executable".

When I change that from "Auto detect" to "Use C++ compiler", the program links fine.
Using the setting 'Use linker' instead also works. I guess in that case it refers to the chosen linker in 'Settings' => 'Compiler...' => 'Toolchain executables'

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12911
    • Travis build status
Re: Compiler Toolchain Setting seems to be ignored in Version 20.03
« Reply #4 on: April 28, 2020, 10:06:39 am »
It seems your C compiler (when used for linking) is under-linking, is this a project generated by a template?
Can you reproduce this in a minimal project? Is there some public documentation for this compiler/libc combination?
(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 BackInTheSandbox

  • Multiple posting newcomer
  • *
  • Posts: 16
Re: Compiler Toolchain Setting seems to be ignored in Version 20.03
« Reply #5 on: April 28, 2020, 10:23:18 am »
It seems your C compiler (when used for linking) is under-linking, is this a project generated by a template?

We are using the same Control Units from the same Supplier as
Quote
Why do you need a C++ linker in the first place?
I basically still use the toolchain setup that came from the supplier of the hardware and bios libraries. Never thought about changing it.

Can you reproduce this in a minimal project?

I'm not sure, if I can setup a minimal project without supplier's libraries which would still show the issue. But I can try in my spare time.

Is there some public documentation for this compiler/libc combination?

It seems the only publicly available information is this:
https://www.stw-technic.com/products/canbus-modules/hardware-and-software-tools/c-compiler-and-debugger/
The manual of the product with the instructions on how to set up Code::Blocks and gcc seems to be available only to customers who buy the ECU.

Offline BackInTheSandbox

  • Multiple posting newcomer
  • *
  • Posts: 16
Re: Compiler Toolchain Setting seems to be ignored in Version 20.03
« Reply #6 on: April 28, 2020, 05:08:49 pm »
Can you reproduce this in a minimal project?
Attached a minimal project for GNU GCC Compiler for TriCore v3.4.6.
The "Release" build uses the C++ Linker, while the "Debug" build uses the C-Linker.

Online stahta01

  • Lives here!
  • ****
  • Posts: 7017
    • My Best Post
Re: Compiler Toolchain Setting seems to be ignored in Version 20.03
« Reply #7 on: April 28, 2020, 06:18:42 pm »
https://www.stw-technic.com/wp-content/uploads/2018/02/ESX-3CM-User-Manual.pdf

No idea if the above links gives useful information.

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 oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12911
    • Travis build status
Re: Compiler Toolchain Setting seems to be ignored in Version 20.03
« Reply #8 on: April 28, 2020, 06:46:42 pm »
BackInTheSandbox: Can you check in the docs if the use of cosf requires mentions that you have to explicitly link with libm?
(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 BackInTheSandbox

  • Multiple posting newcomer
  • *
  • Posts: 16
Re: Compiler Toolchain Setting seems to be ignored in Version 20.03
« Reply #9 on: April 28, 2020, 08:16:20 pm »
BackInTheSandbox: Can you check in the docs if the use of cosf requires mentions that you have to explicitly link with libm?
I checked and libm is not mentioned. It would have surprised me anyway. The manufacturer builds a hardware, and programs a BIOS/Bootloader in the system. No idea what kind of IDE and compiler they use for that.
For their customers they provide basic support for open source tools which don't require a license. They probably are not very proficient with these tools. Maybe that's the reason why they recommend to use the C++ linker instead of the C linker. The latter didn't work for them and they found by trial and error that the former does, so they recommend that setting to their customers. Just a theory of course, but we can't expect in depth expertise from them, and therefore the documentation doesn't help either.

Online stahta01

  • Lives here!
  • ****
  • Posts: 7017
    • My Best Post
Re: Compiler Toolchain Setting seems to be ignored in Version 20.03
« Reply #10 on: April 28, 2020, 10:00:44 pm »
The docs I linked above do give this. And cosf requires the <math.h> include.

Quote
The error callback function delivers:
the ou32_CallbackParameter (reserved for C++ applications),
the output channel number ou16_Channel where the error occurred,
the parameter ou16_Event that signals the callback event.

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 patraxbi

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Compiler Toolchain Setting seems to be ignored in Version 20.03
« Reply #11 on: April 30, 2020, 11:34:21 am »
I have a problem. everytime I hit build&run it will appear this error to me:
Build Log:
g++.exe  -o "bin\Debug\ex 1.exe" obj\Debug\main.o   
g++.exe: error: obj\Debug\main.o: No such file or directory
g++.exe: fatal error: no input files
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))
2 error(s), 0 warning(s) (0 minute(s), 0 second(s))
 

Message Log:
File:                                            |   Line:                         |          Message
obj\Debug\main.o                        |                                   |                    No such file or directory exists
                                                  |                                   |                    error: no input files







I used the auto-detect in toolchains, but it's like my computer refuses to make the -o file .
What could be the cause and how to make it right ? (I'm not sure if this is the right topic to put this)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 12911
    • Travis build status
Re: Compiler Toolchain Setting seems to be ignored in Version 20.03
« Reply #12 on: April 30, 2020, 07:11:39 pm »
It is either path with spaces or other non-ascii characters or an antivirus software causing this. Which one is for your case?
(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 patraxbi

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Compiler Toolchain Setting seems to be ignored in Version 20.03
« Reply #13 on: April 30, 2020, 08:07:13 pm »
It's none of those ( path with spaces or non-ascii characters). I mean I had no problem for a long time. I have Bitdefender antivirus for almost one year. and the paths are the ones predefined from that minGW binary release. I had no problem untill now. I haven't entered codeblocks neither Visual studio for like  2 weeks. and when I tried to enter today, my 17.12 version of codeblocks would just crash when I would press hit and run. And when I tried to open visual studio it was corrupted. I reinstalled visual studio and that one works fine now. but I reinstalled codeblocks 3 times already ( using revo unninsteller when I uninstalled them to delete all those remains) and it still doesn't work. And the mean time of 2 weeks I haven't installed a thing. When I code, I usually do it in Visual Studio, but for school they want code blocks.

Online stahta01

  • Lives here!
  • ****
  • Posts: 7017
    • My Best Post
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