Author Topic: HELP! Codeblocks went nuts ? Missing compiler  (Read 1975 times)

Offline Elena

  • Multiple posting newcomer
  • *
  • Posts: 38
HELP! Codeblocks went nuts ? Missing compiler
« on: March 23, 2021, 07:40:26 pm »
Hi, using CB last public release on Win7 x64.
Everything was fine until today. I've been working with it without problems for about 15 days, I had set my compiler (WinLibs MinGW both x64 and x86 toolchains to compile for x64 and cross compile for x86), all without problems.
I haven't changed anything in my settings lately. Also my machine has no internet access, no viruses, no malicious software, no bloatware, no disk errors (brand new HD, scandisk reports no errors).
Today I opened a project I've been working on the past few days and...CB went nuts. Compiler settings are disappeared. If I try to compile I get this error message in red:

Project/Target: "ElenaDSPModules - Release_x64":
  The compiler's setup is invalid, so Code::Blocks cannot find/run the compiler.
  Probably the toolchain path within the compiler options is not setup correctly?!
  Do you have a compiler installed?
Goto "Settings->Compiler...->Global compiler settings->unknown->Toolchain executables" and fix the compiler's setup.

I tried to delete my global compiler settings (but they still looked fine, with the toolchain dirs all in place) to create them again (MinGW32 and MinGW64), but now when I open the project settings a window opens saying that the compiler cannot be located, I try to set them again for my targets but now the compiler option list is EMPTY! Where before I had many buttons for the checkmars and the various compiler options, now it is empty!
Luckily I had backed up my config file default.conf, so I deleted the supposedly corrupted one and replaced it with the backup copy. This did not solve the issue, so possibly it is some other config file getting corrupted... possibly the .cbp project files ? no idea. Still carrying further tests...

Addition: reinstalled mingw32 and mingw64 dirs in D: Nope,the compiler flags list is still empty, white !!! Those which were my flags are now listed textually in Additional Compiler Options as -m64 -o3 etc.

What's happening ?? Please help !!

Update: I disinstalled and reinstalled CB, then I restored my backed up default.config and now I have the compiler options back in place ! Evidently some config files got corrupted. You only can say which file is responsible for those compiler flags to show up or not, therefore I kindly ask you to investigate. Surely there is nothing wrong with my system, since everything is brand new and I never had any problems. The SSD where I have my system partition C: (where CB stores its config files) and D: (where CB, mingw32 and mingw64 are installed) is brand new, I changed it last week. I had no crashes during these days and as I said no filesystem errors show up with Scandisk.
« Last Edit: March 23, 2021, 09:13:37 pm by Elena »

Offline Elena

  • Multiple posting newcomer
  • *
  • Posts: 38
Re: HELP! Codeblocks went nuts ? Missing compiler
« Reply #1 on: March 26, 2021, 10:42:13 pm »
Still nobody ? Is it possible that nobody has an idea of what happened ? Sadly it is not something which you can replicate but it happened, please consider that thete is a bug somewhere causing such corruption! I hope it won't happen anymore but now I lost my confidence

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3006
Re: HELP! Codeblocks went nuts ? Missing compiler
« Reply #2 on: March 27, 2021, 02:35:59 am »
This is a bug we are on  the hunt for quite some time, but could not reproduce....
I had it 3 times in 10 years. So it is quite rear...
If this happens again, please send us the corrupt config file

The config file is located in c:\Users\USERNAME\AppData\Roaming\Codeblocks

One advice is to not use the global compiler options for storing compiler flags that are needed in a project.
Store compiler flags in the project file.
For the project it is ALWAYS a good idea to use a source code versioning system like git, and use it regularly. So if something went wrong (coding, or corrupt programs) you still have a functional version. This is a general advice, and has nothing to do with codeblocks in special....

[Edit:] Additional note: Codeblocks NEVER killed the project file for me, and there are special mechanics in place that prevent codeblocks from damaging source or project files
« Last Edit: March 27, 2021, 02:38:50 am by BlueHazzard »

Offline Elena

  • Multiple posting newcomer
  • *
  • Posts: 38
Re: HELP! Codeblocks went nuts ? Missing compiler
« Reply #3 on: March 27, 2021, 01:42:13 pm »
Thanks for replying. The next time it should happen I will pay more attention to what exactly happened so to hopefully supply some more useful info. As I said, however, it looks like it is NOT the default.config file getting corrupted, because I had backed it up and once I restored it the problem persisted, so it is something else. No, I am NOT setting any compiler options in the general compiler options indeed, options and flags are all in the project and target settings in my case. I do not know anything of versioning though, I will investigate. Is that covered in CB manual? Any tutorials out there btw ?
As an additional note I must explain that after reinstalling I had to remove by hand three xml tags from the project file which I had inadvertedly saved after the problem showed up, tags which prevented CB from displaying the compiler options in the list as usual. Unfortunately I don't remember their name sorry, but they sounded like "invalid compiler [YOUR ANSWER IS ALREADY THERE. SEARCH THE FORUMS!] setting do not rely on them" or a similar thing. They were three similar tags. Once I removed them the project worked again. Hope this helps
« Last Edit: March 27, 2021, 01:44:23 pm by Elena »

Offline Elena

  • Multiple posting newcomer
  • *
  • Posts: 38
Re: HELP! Codeblocks went nuts ? Missing compiler
« Reply #4 on: March 27, 2021, 01:45:38 pm »
Ps sorry for those words between [] I dont know why they got added, it's not me !!!

Offline Elena

  • Multiple posting newcomer
  • *
  • Posts: 38
Re: HELP! Codeblocks went nuts ? Missing compiler
« Reply #5 on: March 27, 2021, 11:38:12 pm »
HELP! IT HAPPENED AGAIN ! Please read carefully, perhaps this time I can be more accurate about the details involved.

I had CB opened with a project but when all happened it was idle, I was brainstorming on my physical notes.
When I touched my mouse to resume my works I realized that it did not move. Everything was frozen including the keyboard. No input. HD leds were off, everything silent. I checked to access the workstation involved from another PC in my network and it was still operational, I could browse a remote dir, copy files etc. But the input was frozen. And the red light of the optical mouse turned off.
Since the HD led was inactive I felt confortable enough to press the reset button to reboot - I really couldn't do anything else.
After reboot everything was apparently normal. No errors or crashes were recorded by Windows event logger. I checked all my partitions with Scan Disk and there were no errors.
I opened the codeblocks project which was opened during the crash and I realized that in the Build Options the default compiler was no longer my MinGW64 but the generic GNU GCC.
I didn't touch anything. I exited CB and tried loading ANOTHER PROJECT, one which was ok this morning and was NOT opened when CB crashed. Tada. I opened the Build Options window and I received that feared requester:

  Compiler selection
  The defined compiler cannot be locaed (ID:mingw_64) [note: its name was MinGW64, I never entered "mingw_64" anywhere]
   Please choose the compiler you want to use instead and click OK
  ....

At this point I closed the project without touching or saving anything, I RESTORED the whole User/Elena/AppData/Roaming/CodeBlocks DIR which I had backed up, I reopened the project and STILL THE ERROR REQUESTER !
So it is DEFINITELY *NOT* ABOUT ANY CORRUPTION IN THE CODEBLOCKS/ Config folder, and *NOT* ABOUT THE PROJECT FILE, it is something elsewhere which got corrupted !!!! But what ? Where ? Perhaps something in the Registry ??
Where does CB store its settings otherwise ??
My Mingw64 installation dir on D: is pristine.
My setup has always been perfect, never gave me one problem before.
I appreciate any feedback, thanks.

LATER ADDITION - Please read carefully, maybe this contains some useful hints to help you track the bug ?

Referring to the second project I mentiond, the one which was not active during the crash and which I had been working on this morning, i.e many hours before the accident, and which now after the crash caused the error requester I reported, here is what I discovered...
I was smart enough and made a copy of it.
Then I opened it, opened the Build Options, the error requester about the missing compiler showed up, I seconded the request of picking a new compiler in place of mingw_64,and I effectively could choose my MinGW64 (was in the list).
After that everything was apparently fine again and I SAVED THE PROJECT, so I had now two copies of the same project to compare, the original one causing the error requester, and the fixed one.
I checked both .cbp xml files with wordpad.
Here is the ONLY DIFFERENCE:
Original .cbp, line 8 -> <Option compiler="mingw_64" />
Fixed .cbp, line 8     -> <Option compiler="mingw_x64 />     !!!!!
So... as a premise, I NEVER renamed my compiler after the initial setup. I always named it "MinGW64" in the compiler global settings, and nothing else than the toolchain dir was set there.
For some reason, BEFORE the crash all my project files referred to it as "mingw_64"; for some reason after the crash CB changed the way it is internally named and started referring to it as "mingw_x64", with the "x", so that after the crash all the previous projects referring to it as "mingw_64" could no longer recognize it !
But now I wonder, WHERE is this reference name stored (mingw_64 or mingw_x64) , if it is NOT in any file in Codeblocks config folder ? Is it in the registry ? A search with regedit gave no results...
Actually default.config seem to define the compilers and their names, and it always uses the "x". But why then all my project files BEFORE the crash referred to the compiler id WITHOUT the x, and now they need it instead ??
Almost getting insane.... :o
« Last Edit: March 28, 2021, 12:20:39 am by Elena »

Offline blauzahn

  • Multiple posting newcomer
  • *
  • Posts: 114
Re: HELP! Codeblocks went nuts ? Missing compiler
« Reply #6 on: March 28, 2021, 08:55:20 am »
Hello,

if the way the name of the default compiler is assembled on that configuration (win/mingw) is somehow inconsistent in CB, there is a workaround. In options|compiler please make a copy of your compiler settings and rename it eg. mymingw. I would avoid any special character in that name. Then, in your project(s), please select that newly created compiler settings so that it does not depend on the default compiler's name anymore. If you port your code to another computer with codeblocks, that also has to have a compiler setting with that name.

I hope this does help you to avoid your problem and stay sane.

Please note, that I use CB under Linux. Therefore, I cannot help you with issues specific to win/mingw.

Have a nice day.


Offline Elena

  • Multiple posting newcomer
  • *
  • Posts: 38
Re: HELP! Codeblocks went nuts ? Missing compiler
« Reply #7 on: March 28, 2021, 01:20:49 pm »
Blauzahn, actually when I created my compiler settings I had indeed cloned an existing one, the gnu gcc (there is no mingw default setting here), and I named it MinGW64. I really didn't change anything since, just after that strange crash CB started referencing the compiler setting with an "x" as I said when it didn't do that before... that's very puzzling!

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 3006
Re: HELP! Codeblocks went nuts ? Missing compiler
« Reply #8 on: March 28, 2021, 07:35:32 pm »
Thank you for your reports.

Quote
[YOUR ANSWER IS ALREADY THERE. SEARCH THE FORUMS!]
This is an automatic answer, entered by the forum software, because there was a time, when we had dozens of questions with exact this error message. And this was some automated way to answer this questions :)


Quote
I had to remove by hand three xml
Where this tags added by codeblocks? If something like this happens again, please zip the file and add it here if possible

Quote
The defined compiler cannot be locaed (ID:mingw_64) [note: its name was MinGW64, I never entered "mingw_64" anywhere]
Codeblocks generates an internal id and uses this id for project and config files. This is not in direct relation to the name you entered, but in relation to the compiler type you copied (in your case mingw).

Quote
When I touched my mouse to resume my works I realized that it did not move
Do you think this crash was coming from codeblocks? I never had something like that...

Quote
I opened the codeblocks project which was opened during the crash and I realized that in the Build Options the default compiler was no longer my MinGW64 but the generic GNU GCC.
If the config file is corrupt this seems to be expected... Compiler id of the project is not present in the config file so it falls back to some default compiler...
Quote
Tada. I opened the Build Options window and I received that feared requester:
Again, expected on a corrupt config file

Quote
I RESTORED the whole User/Elena/AppData/Roaming/CodeBlocks DIR which I had backed up,
This is unfortunate... It would have helped us a lot if we could have examined this config folder,

Quote
it is something elsewhere which got corrupted !!!! But what ? Where ? Perhaps something in the Registry ??
Where does CB store its settings otherwise ??
As far as i know, codeblocks stores configuration settings only in the config file. This is found in the AppData/Roaming/Codeblocks folder or in the codeblocks installation folder
The configuration file has the name of your codeblocks profile. You can start codeblocks via command line with different profiles and codeblocks will use the configuration file with the profile name.

Quote
Original .cbp, line 8 -> <Option compiler="mingw_64" />
Fixed .cbp, line 8     -> <Option compiler="mingw_x64 />
This is puzzeling... i am reading the config code right now... quite complex... i will try to find the reason behind this...
Ultimately i still think one config file is corrput (the file in the App data folder, or the file near the codeblocks.exe)


Offline Elena

  • Multiple posting newcomer
  • *
  • Posts: 38
Re: HELP! Codeblocks went nuts ? Missing compiler
« Reply #9 on: March 29, 2021, 04:41:03 pm »
Hi, thanks for your support,
well at the time of crash I had Synthedit idle in background so I can't be 100% sure on which one froze the system, as I said Windows logger did not record anything so I can't say for sure...
Next time I will store everything so you can examine the config files. The truth is, one is never prepared enough when such accidents happen...
In the meanwhile I have installed the last nightly build, so if that happens again we at least can be 100% sure it is not something which maybe has been fixed in the meanwhile...