Author Topic: Segmentation fault with wxGLCanvas only in CB  (Read 7741 times)

Offline Pille456

  • Single posting newcomer
  • *
  • Posts: 7
Segmentation fault with wxGLCanvas only in CB
« on: October 22, 2008, 08:17:45 pm »
Hi!

I try to develop a wxWidgets application which uses OpenGL with Code::Blocks. The problem is, that I always receive a SIGSEGV error when I try to create a wxGLCanvas object. I already tried the examples from the wxWiki, which didn't work too (so the problem here is not the code!). The strange about this is, that this problem only occurs when I use Code::Blocks. With wxDevCpp or VC++ everything works fine.
Here my setup:
- Code::Blocks (latest nightly build)
- wxPack 2.8
- MinGW (latest version)

The only logical reason(for me) why the examples doesn't run with Code::Blocks is, that I messed up some settings of Code::Blocks or something like that.
Therefore I'm questioning myself what the term "us wxWidget DLL" in the project wizard exactly means? Unchecking this (and manually linking all libraries) leads me into an linker error, check this (and manually linking all libraries) leads me into this SIGSEGV error.
Any ideas?

Here the debugger stuff:
Code: [Select]
Program received signal SIGSEGV, Segmentation fault.
In wxHashTableBase::DoGet (this=0x0, key=1640022, hash=1640022) at ../../src/common/hash.cpp:877 ()
In ntdll!LdrDisableThreadCalloutsForDll () (F:\WINDOWS\system32\ntdll.dll)
In ntdll!LdrFindCreateProcessManifest () (F:\WINDOWS\system32\ntdll.dll)
In ntdll!RtlCheckRegistryKey () (F:\WINDOWS\system32\ntdll.dll)
In ntdll!LdrFindCreateProcessManifest () (F:\WINDOWS\system32\ntdll.dll)
In ntdll!RtlCheckRegistryKey () (F:\WINDOWS\system32\ntdll.dll)
In ntdll!LdrFindCreateProcessManifest () (F:\WINDOWS\system32\ntdll.dll)
In ntdll!RtlUnhandledExceptionFilter () (F:\WINDOWS\system32\ntdll.dll)
In ntdll!LdrFindCreateProcessManifest () (F:\WINDOWS\system32\ntdll.dll)
In ntdll!RtlInitAnsiString () (F:\WINDOWS\system32\ntdll.dll)
In ntdll!RtlAppendStringToString () (F:\WINDOWS\system32\ntdll.dll)
In strchr () (F:\WINDOWS\system32\ntdll.dll)
In ntdll!RtlAppendStringToString () (F:\WINDOWS\system32\ntdll.dll)
Program received signal SIGSEGV, Segmentation fault.
In wxHashTableBase::DoGet (this=0x0, key=1640022, hash=1640022) at ../../src/common/hash.cpp:877 ()
Program exited with code 030000000005.
Debugger finished with status 0

And here the example I compiled: http://wiki.wxwidgets.org/WxGLCanvas (error in line " new wxGLCanvasSubClass(frame);")

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6981
    • My Best Post
Re: Segmentation fault with wxGLCanvas only in CB
« Reply #1 on: October 25, 2008, 01:32:34 am »
In setup.h for the wxWidgets you are using, what was the original value of wxUSE_GLCANVAS?

Tim S

Quote
Therefore I'm questioning myself what the term "use wxWidget DLL" in the project wizard exactly means?

Means do you wish to use (Dynamic = DLL is yes) or Static wxWidgets Library (No to DLL).

What is the type of wxWidgets build are you trying to use?
DLL/Dynamic/Shared or Static ?
Unicode or non-unicode (sometimes called ANSI) ?
Release or Debug (Can be both, but you need to pick just one right now to trouble shoot this problem.) ?
Monolith or MultiLib ?

You stated you wanted an OpenGL build so assuming yes to OpenGL.

Which GLUT for MinGW under Windows are you using? Download Link Needed?

Tim S

« Last Edit: October 25, 2008, 02:22:53 am 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 Pille456

  • Single posting newcomer
  • *
  • Posts: 7
Re: Segmentation fault with wxGLCanvas only in CB
« Reply #2 on: October 25, 2008, 10:53:52 am »
I'm using wxPack, which is an already built version of wxWidgets (see: http://wxpack.sourceforge.net/Main/Downloads). This version includes many builds of wxWidgets including opengl (see forum: http://sourceforge.net/forum/forum.php?thread_id=1578110&forum_id=595652)
For debugging I use:
- unicode
- debug
- monolith (what does this suppose?)
and I have to use dynamic because if I do not so, then I receive lots of linker errors I cant solve.

Yeha, I have an application which (should) use(s) OpenGL for a few animations, therefore I dont need GLUT at this time.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6981
    • My Best Post
Re: Segmentation fault with wxGLCanvas only in CB
« Reply #3 on: October 25, 2008, 05:11:14 pm »
I'm using wxPack, which is an already built version of wxWidgets (see: http://wxpack.sourceforge.net/Main/Downloads). This version includes many builds of wxWidgets including opengl (see forum: http://sourceforge.net/forum/forum.php?thread_id=1578110&forum_id=595652)
For debugging I use:
- unicode
- debug
- monolith (what does this suppose?)
and I have to use dynamic because if I do not so, then I receive lots of linker errors I cant solve.

Yeha, I have an application which (should) use(s) OpenGL for a few animations, therefore I dont need GLUT at this time.

Quote
- monolith (what does this suppose?)
That you wish to use larger, but less numerous libraries.

What sample code are you using; the link you gave requires GLUT header of <GL/glut.h>

Edit: I am getting the wxWidgets own openGL samples to work using Monolith DLL builds under Code::Blocks. Will attach project files when done.

Note: I do not use openGL so you going to have to figure out why the sample you found does not work right.

But, the samples with wxWidgets do work; I test them every few months when testing wxWidgets.

NOTE: The wxWidgets openGL samples crash with wxPack when Monolithic Build is used.
But, works when multiLib build is used. This appears to be caused by the wxPack packaging of wxWidgets.

The wxPack issue is likely explained in some readme file; my second guess is that the OpenGL DLL only works under MultiLib builds

Attached: CodeBlocks.7z which is Code::Blocks projects for OpenGL Samples with DLLs MultiLib Builds

Tim S



[attachment deleted by admin]
« Last Edit: October 25, 2008, 09:56:34 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 Pille456

  • Single posting newcomer
  • *
  • Posts: 7
Re: Segmentation fault with wxGLCanvas only in CB
« Reply #4 on: October 26, 2008, 10:48:13 am »
Ahh man big thanks to you!!
Now everything works fine :D :D
Just checked the projects you gave me which worked. Already checked the wxGLCanvas example from the wxWiki with a new project (with mulitlib) which also worked!
Thanks!

Yet I've another question:
My application project uses monolith libraries: Is there an easy way (except of manually editing everything) to change that? Well I could just copy/past the stuff into a new project, but maybe CB has a function for this?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6981
    • My Best Post
Re: Segmentation fault with wxGLCanvas only in CB
« Reply #5 on: October 26, 2008, 07:49:53 pm »
Yet I've another question:
My application project uses monolith libraries: Is there an easy way (except of manually editing everything) to change that? Well I could just copy/past the stuff into a new project, but maybe CB has a function for this?

The only real difference is library search paths and the library names.

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