Author Topic: Compiler Toolchain Setting seems to be ignored in Version 20.03  (Read 1911 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,


Offline 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

Offline 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.

Offline 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.

Offline 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.

Offline 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 patraxbi

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Compiler Toolchain Setting seems to be ignored in Version 20.03
« Reply #15 on: April 30, 2020, 08:33:57 pm »
That "full comand" was already on. I pressed rebuild and that build log  is the same: ( I compiled the hello world program. Could it be from my computer?)
g++.exe  -o bin\Debug\test1.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))
 
The problem is that the compiler doesn't create the main.o file and I can't see why
« Last Edit: April 30, 2020, 08:41:42 pm by patraxbi »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7017
    • My Best Post
Re: Compiler Toolchain Setting seems to be ignored in Version 20.03
« Reply #16 on: April 30, 2020, 08:44:59 pm »
That "full comand" was already on. I pressed rebuild and that build log  is the same: ( I compiled the hello world program. Could it be from my computer?)
g++.exe  -o bin\Debug\test1.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))
 
The problem is that the compiler doesn't create the main.o file and I can't see why

If that is the full rebuild log then your CB Project is bad!!!!

Is there a reason you told the project to not build the source file?

Edit: My guess is you did not rebuild the project and the Antivirus is causing the problem.
But, you could delete the "default.conf" file under "%APPDATA%\CodeBlocks" in case you realy did a full rebuild to delete a possibly bad configuration file. (Do this when Code::Blocks is not running) The next start of Code::Blocks will recreate the configuration file.

Tim S.
« Last Edit: April 30, 2020, 08:52:38 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 patraxbi

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Compiler Toolchain Setting seems to be ignored in Version 20.03
« Reply #17 on: April 30, 2020, 08:52:42 pm »
I didn't tell the project to not build the source file. that's the problem. it won't build it. I reinstalled code blocks 4 times already. I choosed the console project, I haven't made a modification and
hit build & run on the hello world program. So... how could I tell my project to build the source file ? I've never encountered such thing and I'm still learning programming. I barely know some OOP so I wouldn't have a reason to mess up with the settings

Offline patraxbi

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Compiler Toolchain Setting seems to be ignored in Version 20.03
« Reply #18 on: April 30, 2020, 09:02:31 pm »
I don't think is the antivirus. I have Bitdefender Total Security for almost one year and never did such thing. I'm gonna try find the ""%APPDATA%\CodeBlocks"" file

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7017
    • My Best Post
Re: Compiler Toolchain Setting seems to be ignored in Version 20.03
« Reply #19 on: April 30, 2020, 09:07:32 pm »
So, you never used rebuild or did a clean and then a build.
I go with the anti-virus being the cause.

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 #20 on: April 30, 2020, 09:15:38 pm »
I deleted the default.conf , I entered codeblocks. went in the project. I cleared the project from "build" on that bar , then tried to build it. It won't work. I'm trying to see if it is Bitdefender's fault.

EDIT: OK, so I went through BITDEFENDER's notification and I couldn't find a thing. then I stopped the antivirus and tried do run codeblocks. it doesn't work either. Yeah.... could it be from something else other than the antivirus?  some other application which could interffere ?  I'm already sick of this
« Last Edit: April 30, 2020, 09:35:11 pm by patraxbi »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7017
    • My Best Post
Re: Compiler Toolchain Setting seems to be ignored in Version 20.03
« Reply #21 on: April 30, 2020, 09:29:45 pm »
I deleted the default.conf , I entered codeblocks. went in the project. I cleared the project from "build" on that bar , then tried to build it. It won't work. I'm trying to see if it is Bitdefender's fault.

Do you not know what rebuild means!

Build -> Rebuild (CTRL + F11)

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 #22 on: April 30, 2020, 09:38:16 pm »
I deleted the default.conf , I entered codeblocks. went in the project. I cleared the project from "build" on that bar , then tried to build it. It won't work. I'm trying to see if it is Bitdefender's fault.

Do you not know what rebuild means!

Build -> Rebuild (CTRL + F11)

Tim S.


I know what rebuild means. I did that. I just suck at explaining things.
I've done build -> rebuild twice
and build -> clear and build -> build once

and in all of those cases it apeared the same build log.... I'm already sick of it.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7017
    • My Best Post
Re: Compiler Toolchain Setting seems to be ignored in Version 20.03
« Reply #23 on: April 30, 2020, 09:50:01 pm »
This is what a real rebuild looks like.

Code: [Select]
-------------- Clean: Debug in testrebuild (compiler: GNU GCC Compiler)---------------

Cleaned "testrebuild - Debug"

-------------- Build: Debug in testrebuild (compiler: GNU GCC Compiler)---------------

x86_64-w64-mingw32-gcc.exe -Wall -g  -c C:\SourceCode\test\testrebuild\main.c -o obj\Debug\main.o
x86_64-w64-mingw32-gcc.exe  -o bin\Debug\testrebuild.exe obj\Debug\main.o   
Output file is bin\Debug\testrebuild.exe with size 295.02 KB
Process terminated with status 0 (0 minute(s), 5 second(s))
0 error(s), 0 warning(s) (0 minute(s), 5 second(s))

Edit add C++ rebuild
Code: [Select]
-------------- Clean: Debug in testcpprebuild (compiler: GNU GCC Compiler)---------------

Cleaned "testcpprebuild - Debug"

-------------- Build: Debug in testcpprebuild (compiler: GNU GCC Compiler)---------------

x86_64-w64-mingw32-g++.exe -Wall -fexceptions -g  -c C:\SourceCode\test\testcpprebuild\main.cpp -o obj\Debug\main.o
x86_64-w64-mingw32-g++.exe  -o bin\Debug\testcpprebuild.exe obj\Debug\main.o   
Output file is bin\Debug\testcpprebuild.exe with size 315.35 KB
Process terminated with status 0 (0 minute(s), 6 second(s))
0 error(s), 0 warning(s) (0 minute(s), 6 second(s))
« Last Edit: April 30, 2020, 09:55:47 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 stahta01

  • Lives here!
  • ****
  • Posts: 7017
    • My Best Post
Re: Compiler Toolchain Setting seems to be ignored in Version 20.03
« Reply #24 on: April 30, 2020, 09:53:40 pm »
You must understand!

You do not know how to use Code Tags.
You do not know how to start a new thread.
But, you are positive the anti-virus is not the cause.

You have failed to post a full rebuild log.
No idea why you have failed; till we get one the only guess we have is user error or the Anti-virus is causing the problem.

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 #25 on: April 30, 2020, 10:06:33 pm »
yeah... if u mean "build > clean", "build > build" or "build > run" or " file > new" by code tags, I just forgot 'bout them. I know how to start a new thread but this seemed like my problem... but it defenetly isn't.

So, i just tried to compile the main.cpp in command prompt with
g++.exe main.cpp  because code blocks wouldn't give me a full rebuild log
and a error occured: "The code execution cannot proceed because libwinpthread-1.dll was not found. Reinstalling the program may fix this problem"


EDIT: misspelling

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7017
    • My Best Post
Re: Compiler Toolchain Setting seems to be ignored in Version 20.03
« Reply #26 on: April 30, 2020, 10:08:17 pm »
Please use only ASCII characters in the path without and spaces!!!!!!!!!!!!!!

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: 7017
    • My Best Post
Re: Compiler Toolchain Setting seems to be ignored in Version 20.03
« Reply #27 on: April 30, 2020, 10:09:22 pm »
It is either path with spaces or other non-ascii characters or an antivirus software causing this. Which one is for your case?

Bye!!!!

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 #28 on: April 30, 2020, 10:10:48 pm »
i copy pasted the path from windows 10' explorer. I'm gonna rename it and try it again to see if that's the problem but usually it never affected if directory's name was "this is just some shit code"

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7017
    • My Best Post
Re: Compiler Toolchain Setting seems to be ignored in Version 20.03
« Reply #29 on: April 30, 2020, 10:12:06 pm »
Quote
"The code execution cannot proceed because libwinpthread-1.dll was not found.

This likely means your Compiler installation is broken; but, till you STOP USING non-ASCII path you can not be sure of that.

Please ask questions when you say things that are lies I start to believe you are a troll or a help vampire!!!

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 #30 on: April 30, 2020, 10:16:21 pm »
lmao. it works. in 17.12 it always worked even if I used non-ASCII. and I'm not a troll. nope. Just idiot 50% of the time. thanks for helping. I'm still courious how my 17.12 codeblocks and visual studio broken at the same time but that doesn't matter now. Sorry for annoying you. Accept my appologies. and what is a help vampire? really now, never heard of this expression.
At least I knew it wasn't the anti virus. sorry for causing trouble

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7017
    • My Best Post
Re: Compiler Toolchain Setting seems to be ignored in Version 20.03
« Reply #31 on: April 30, 2020, 10:18:03 pm »
http://slash7.com/2006/12/22/vampires/


Edit: Some MinGW GCC installs have issues using spaces and some do not.
It might be the same with non ASCII path; it might also be an Code::Blocks configuration setting that triggers the issue. But, with weird issues like the one you reported it tends to be Anti-Virus or bad characters in the path as the cause.

Tim S.
« Last Edit: April 30, 2020, 10:23:40 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 patraxbi

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Compiler Toolchain Setting seems to be ignored in Version 20.03
« Reply #32 on: April 30, 2020, 10:24:19 pm »
yeah... looking at this I could be a classified as a help vampire from time to time. sorry for sucking your energy. I just have a big problem on how to explain things. BIG problem. thanks for your time. sorry for disturbing

EDIT: ok, so I need to be more carefull at those characters and the antivirus
« Last Edit: April 30, 2020, 10:29:07 pm by patraxbi »