Author Topic: Kubuntu - C::B 8477 crash on Workspace load  (Read 14240 times)

Offline cacb

  • Lives here!
  • ****
  • Posts: 536
Kubuntu - C::B 8477 crash on Workspace load
« on: October 28, 2012, 09:01:06 pm »
Hi,

I have been using Nightly Build Code::Blocks for a long time with Windows and Kubuntu. On Kubuntu I am using the http://apt.jenslody.de/stable stable main
repository

I am running Kubuntu 12.04 with the latest updates.

Right now I am experiencing an awkward crash problem when loading any workspace on Kubuntu, see attched XML report. C::B starts ok, but crashes when I try to open a workspace.

Any help appreciated.....  :'(

Offline cacb

  • Lives here!
  • ****
  • Posts: 536
Re: Kubuntu - C::B 8477 crash on Workspace load
« Reply #1 on: October 29, 2012, 08:20:18 am »
FWIW, I just tried the same version of C::B on another Kubuntu 12.04 machine, same workspaces. It crashes out in the same way. It means I cannot get any work done until a solution is found....

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Kubuntu - C::B 8477 crash on Workspace load
« Reply #2 on: October 29, 2012, 09:05:52 am »
Two things: you can try to disable the CodeCompletion plugin and/or you can try to use C::B from pasgui's ppa (https://launchpad.net/~pasgui/+archive/ppa/), because my version is built in a debian chroot and there might be binary incompatibilities with some libs (should not be, but who knows).
By the way: I thought my version is not installable on 12.04 (at least not out of the box).

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Kubuntu - C::B 8477 crash on Workspace load
« Reply #3 on: October 29, 2012, 09:08:44 am »
...one more thing in addition: After you disabled the CC plugin, your project should load. Then, please check the settings of all your workspace/project/target compiler(s) you use in this workspace. It seems, there is an issue with CC running the compiler to obtain the compilation flags for your project(s).
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline cacb

  • Lives here!
  • ****
  • Posts: 536
Re: Kubuntu - C::B 8477 crash on Workspace load
« Reply #4 on: October 29, 2012, 11:44:24 am »
Thanks for these replies...  :)

jens: I disabled the CodeCompletion plugin, exited C::B, restarted C::B and opened the workspaces without any issues. Thanks, that saved my day. Apparently there is something fishy in the CodeCompletion plugin that causes the crash. If I re-enable the CC plugin and restart C::B again, the crashes return.

MortenMacFly: Be aware that my setup is a little special, perhaps it is of some relevance?
All my projects have 4 build targets
GCC_Release    (currently used on linux only)
GCC_Debug      (currently used on  linux only)
MSVC_Release  (used on Windows only)
MSVC_Debug    (used on Windows only)

I am using Bazaar source control (on Windows only). For linux development, I syncronise source and project files over Samba, using Komparator, then edit as required, compile&link. When happy, I use Komparator to sync it back over Samba, then commit to Bazaar there.

If, for some reason, the CC plugin tries to access the MSVC compiler on linux, it certainly will not succeed. If that is the issue, it should just give up, but not crash.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Kubuntu - C::B 8477 crash on Workspace load
« Reply #5 on: October 29, 2012, 01:04:44 pm »
If, for some reason, the CC plugin tries to access the MSVC compiler on linux, it certainly will not succeed. If that is the issue, it should just give up, but not crash.
It checks for the presence of the executable in a way that wxExecute (which we use) won't return success... However - I could tell you exactly if you were willing to compile C::B yourself or (maybe) provide a minimal test project for the Linux devs to reproduce. MAybe you can strip-down your project to something usable...?!
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline cacb

  • Lives here!
  • ****
  • Posts: 536
Re: Kubuntu - C::B 8477 crash on Workspace load
« Reply #6 on: October 29, 2012, 03:33:18 pm »
If, for some reason, the CC plugin tries to access the MSVC compiler on linux, it certainly will not succeed. If that is the issue, it should just give up, but not crash.
It checks for the presence of the executable in a way that wxExecute (which we use) won't return success... However - I could tell you exactly if you were willing to compile C::B yourself or (maybe) provide a minimal test project for the Linux devs to reproduce. MAybe you can strip-down your project to something usable...?!

Thanks, I have put a small (397 kB) file here

It is a zip file with a Code::Blocks workspace according to the description I gave (except the project Bmp2Xpm does not have any GCC targets, but if you remove it from the workspace, C::B still crashes on Kubuntu 12.04 as explained when the CC plugin is enabled, I just tried it).

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Kubuntu - C::B 8477 crash on Workspace load
« Reply #7 on: October 29, 2012, 03:55:47 pm »
Thanks, I have put a small (397 kB) file here
Hopefully one of the Linux devs with debugging capabilities can pick it up...
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Kubuntu - C::B 8477 crash on Workspace load
« Reply #8 on: October 29, 2012, 04:11:31 pm »
I get this crash here too.
I will look into it.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Kubuntu - C::B 8477 crash on Workspace load
« Reply #9 on: October 29, 2012, 04:25:11 pm »
Error is simple: nativeparser.cpp:1921
Code
    Compiler* compiler = CompilerFactory::GetCompiler(project->GetCompilerID());

    cb::shared_ptr<CompilerCommandGenerator> generator(compiler->GetCommandGenerator(project));

Missing check for nullptr.
compiler is 0x0, therefore it crashes (obviously).

Question is: what to do in this case, just step out the function or ... ?
CC devs should look into it I think.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Kubuntu - C::B 8477 crash on Workspace load
« Reply #10 on: October 29, 2012, 05:28:31 pm »
Question is: what to do in this case, just step out the function or ... ?
CC devs should look into it I think.
For now I would do what's attached (which avoids the crash).

Solution 1: If we don't have a compiler all project path's with macros cannot safely be resolved and are error prone. Also, CC is questionable anyways as we don't have the system headers, for example.

Solution 2: Maybe we could also iterate through the project include dirs and add them only, if they contain no macros in case no compiler is present. Also, if no compiler-related macro is needed (like a simply envvar) it could work, too. This may work nice for projects using the same compiler (GCC) on several platforms.

Solution 3: We just ignore that we cannot resolve the macros correct and use all project path's "as is".

What would be most wise??? Really not that simple. ::)
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline cacb

  • Lives here!
  • ****
  • Posts: 536
Re: Kubuntu - C::B 8477 crash on Workspace load
« Reply #11 on: October 29, 2012, 05:32:16 pm »
Error is simple: nativeparser.cpp:1921
Code
    Compiler* compiler = CompilerFactory::GetCompiler(project->GetCompilerID());

    cb::shared_ptr<CompilerCommandGenerator> generator(compiler->GetCommandGenerator(project));

Missing check for nullptr.
compiler is 0x0, therefore it crashes (obviously).

Question is: what to do in this case, just step out the function or ... ?
CC devs should look into it I think.

Thanks for your nice work, that was very fast...

In this case, I guess the nullptr is for MSVC, a compiler that does not exist for the platform in question (here: Linux). I believe it must be allowed to refer to compilers that don't exist for the current platform (or are missing), as long as there are other relevant build targets with valid compilers. On Windows I have the opposite case, no GCC compiler installed, but it does not cause any crash or other problems, and it should not.


Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Kubuntu - C::B 8477 crash on Workspace load
« Reply #12 on: October 29, 2012, 08:46:57 pm »
On Windows I have the opposite case, no GCC compiler installed, but it does not cause any crash or other problems, and it should not.
The difference is most likely that the entry (compilerID) for the gcc compiler exists on windows, but it is (probably) not configured, but on linux no msvc compilerID exists.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Kubuntu - C::B 8477 crash on Workspace load
« Reply #13 on: October 29, 2012, 10:20:26 pm »
I've committed a patch (slightly different to the one posted here) to trunk that should at least fix the crash bug.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Kubuntu - C::B 8477 crash on Workspace load
« Reply #14 on: October 29, 2012, 10:56:15 pm »
I've committed a patch (slightly different to the one posted here) to trunk that should at least fix the crash bug.
Dammed - that one didn't really work due to the shared pointer. Now I am unsure, how to do it.
@obfuscated: Can you have a look at the attached patch, if I can initialise a shared_ptr like that?

At least it compiled and seems to run...
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ