Game Development Community

Linux OpenGL seg fault

by Peter Hunt · in Torque Game Engine · 09/04/2002 (7:16 am) · 10 replies

I'm having trouble running both the HEAD (4th Sep 2002) and 1.1.2 versions of torque on one of my Linux machines and need some help tracking down the problem.

I get a segmentation fault when I try and run the executables (both RELEASE & DEBUG targets) somewhere in the OpenGL library before the splash screen is displayed. (Although I can compile and run other OpenGL + SDL programs on the machine.)

Below is a gdb backtrace of the HEAD Debug executable after the segmentation fault. The target is dynamically linked (The default I think).

#0 0x08347c30 in glBegin ()
#1 0x40cfe5d7 in __nvsym05024 () from /usr/lib/libGLcore.so.1
#2 0x080927d2 in dglDrawRectFill (rect=@0xbffff010, color=@0x407f4090)
at dgl/dgl.cc:452
#3 0x080c2738 in renderRaisedBox (bounds=@0xbffff010, profile=0x407f4058)
at gui/guiDefaultControlRender.cc:24
#4 0x080c67b9 in GuiButtonCtrl::onRender (this=0x4087c528, offset=0xbffff080,
updateRect=@0xbffff090) at gui/guiButtonCtrl.cc:38
#5 0x080cd8a8 in GuiControl::renderChildControls (this=0x4087c478,
offset=0xbffff0f0, updateRect=@0xbffff150) at gui/guiControl.cc:339
#6 0x080cba9e in GuiChunkedBitmapCtrl::onRender (this=0x4087c478,
offset=0xbffff160, updateRect=@0xbffff150)
at gui/guiChunkedBitmapCtrl.cc:151
#7 0x080ca27f in GuiCanvas::renderFrame (this=0x40438548, preRenderOnly=false)
at gui/guiCanvas.cc:1166
#8 0x080fbb98 in DemoGame::processTimeEvent (this=0x83e9640, event=0xbffff2a8)
at game/main.cc:691
#9 0x081bd7f6 in GameInterface::processEvent (this=0x83e9640,
event=0xbffff2a8) at platform/gameInterface.cc:72
#10 0x081bd989 in GameInterface::postEvent (this=0x83e9640, event=@0xbffff2a8)
at platform/gameInterface.cc:153
#11 0x08268419 in TimeManager::process ()
at platformX86UNIX/x86UNIXWindow.cc:784

My system specs are as follows.

Mandrake 8.1 (2.96-0.62mdk)
Kernel 2.4.19-pre8
gcc version 2.96 20000731
NVIDIA OpenGL Drivers 1.0-2960

AMD Athlon(TM) XP1900+
GEFORCE2 MX 400

The frustrating part is I have another linux system which is setup much the same (excepting hardware) and all targets run fine on it.

Any help would be greatly appreciated.

About the author

Recent Threads


#1
09/05/2002 (4:10 am)
Hello.

I also get the same problem. My system spec is:
Mandrake Linux 8.2 DLE
IBM Thinkpad T23
256 MB RAM
S3 SuperSavage Video Card with 16MB VRAM
Pentium III 1Ghz

I have another machine which is a Pentium IV 1.4Ghz with 640MB RAM and NVidia GEForce 4 MX 420. The thing is I still havent tested it on this machine cause everytime I get home ... my wife is playing Anarchy Online on it. (Because AO doesnt work on her machine which is the Thinkpad)

As soon as I get my itchy hands on it, im going to boot to linux and try this same problem there. Hmmm. I have to think of a way to get her out of the house on Saturday though. He, he, he.

Alex
#2
09/07/2002 (3:03 am)
I got the torque demo running on my system without killing itself on my desktop machine. Although, I still can't make it work on the IBM Thinkpad T23 though.

For more info on how I got it working ... go here:
www.garagegames.com/index.php?sec=mg&mod=forums&page=result.thread&qt=5007

Alex
#3
09/07/2002 (6:30 am)
Have you tried installing the latest nVidia drivers and Mesa3D library?
#4
09/07/2002 (8:23 am)
I got it working on my Desktop machine that has an nVidia Video Card (GEForce4 MX 420). My problem is with the IBM Thinkpad T23 which has an S3 SuperSavage video card with 16MB VRAM.

I did compile the latest Mesa3D CVS snapshot on the laptop. Its just that S3 did not distribute a Linux XFree86 driver. Im stuck with using the generic "Savage" XFree86 (4.2) libraries.

I'm just glum cause with my wifes playing habit (she loves playing Anarchy Online), it seems that I'm stuck with using the laptop as my development machine. 'Cause, normally, when I do get my hands on our desktop machine ... I play AO too. W00t!!!

To note: Torque works relatively stable with S3 SuperSavage on M$-Windows. It does crash the system with a blue-screen-of-death after sometime. Bwah! Ha! Ha!

Alex
#5
09/07/2002 (9:02 am)
I don't think you can blame the Blue Screen of Death on your video card. :)
#6
09/07/2002 (12:26 pm)
Peter, you might try looking for stray non-NVIDIA libGL.so libraries in your /lib, /usr/lib, and /usr/local/lib directories (any directory listed in /etc/ld.so.conf). If its loading the wrong library it could cause a crash.
#7
09/07/2002 (10:50 pm)
Thanks for the suggestions so far.

On executing: find / -type f -name 'libGL*'

I get the following list.

/usr/lib/libGLcore.so.1.0.2960
/usr/lib/libGL.so.1.0.2960
/usr/X11R6/lib/libGLU.so.1.2.030402
/usr/X11R6/lib/libGLU.la
/usr/X11R6/lib/libGLw.a

Which i can account for. If anyone can see something I'm missing here please let me know.

I'm using a fairly old version of Mesa (3.4.2-2) which I will try and update now however this is the same version I'm using on my other Mandrake Box which runs torque successfully.

My /etc/ld.so.conf contains only 2 lines.

/usr/X11R6/lib
/usr/lib

Will update this thread when I get the latest Mesa Libraries installed. Cheers.
#8
09/18/2002 (11:59 pm)
Sorry for not updating this before now (if anyone has been waiting). I have tried everything I can think of. I can now not run torque on any of my linux Boxes.

My current setup after upgrading to both the latest nvidia & Mesa libraries is as follows:

- Mandrake Linux 9.0RC2 (After trying both 8.1 & 8.2)
- Mesa Libraries 4.0.3 stable
- nvidia libs 1.0-3123.

A dump of ldd torqueDemo_DEBUG.exe is as follows:

libGLU.so.1 => /usr/X11R6/lib/libGLU.so.1 (0x4001f000)
libSDL-1.2.so.0 => /usr/lib/libSDL-1.2.so.0 (0x400b6000)
libpthread.so.0 => /lib/i686/libpthread.so.0 (0x40133000)
libdl.so.2 => /lib/libdl.so.2 (0x40147000)
libstdc++-libc6.2-2.so.3 => /usr/lib/libstdc++-libc6.2-2.so.3 (0x4014a000)
libm.so.6 => /lib/i686/libm.so.6 (0x40196000)
libc.so.6 => /lib/i686/libc.so.6 (0x401b9000)
libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x402d9000)
libGL.so.1 => /usr/lib/libGL.so.1 (0x403a5000)
libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x403ed000)
libasound.so.2 => /usr/lib/libasound.so.2 (0x403f5000)
libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x4047e000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
libGLcore.so.1 => /usr/lib/libGLcore.so.1 (0x4048e000)


The current gdb trace with -console is (I have disabled sound / access to libopenal for the time being due to different bug):


(gdb) r -console
Starting program: /dump/cvs/torque/torque-head/example/torqueDemo_DEBUG.exe -console
--------- Loading MODS ---------
Loading compiled script common/main.cs.
Missing file: common/defaults.cs!
Loading compiled script fps/main.cs.
Loading compiled script fps/client/defaults.cs.
Loading compiled script fps/server/defaults.cs.
Loading compiled script fps/client/prefs.cs.
Loading compiled script fps/server/prefs.cs.
%
--------- Parsing Arguments ---------
%
--------- Initializing MOD: Common ---------
Loading compiled script common/client/canvas.cs.
Loading compiled script common/client/audio.cs.
%
--------- Initializing MOD: FPS ---------
Loading compiled script fps/client/init.cs.
Loading compiled script fps/server/init.cs.
Loading compiled script fps/data/init.cs.
Loading compiled script fps/data/terrains/grassland/propertyMap.cs.
Loading compiled script fps/data/terrains/scorched/propertyMap.cs.
%
--------- Initializing FPS: Server ---------
Loading compiled script common/server/audio.cs.
Loading compiled script common/server/server.cs.
Loading compiled script common/server/message.cs.
Loading compiled script common/server/commands.cs.
Loading compiled script common/server/missionInfo.cs.
Loading compiled script common/server/missionLoad.cs.
Loading compiled script common/server/missionDownload.cs.
Loading compiled script common/server/clientConnection.cs.
Loading compiled script common/server/kickban.cs.
Loading compiled script common/server/game.cs.
Loading compiled script fps/server/scripts/commands.cs.
Loading compiled script fps/server/scripts/centerPrint.cs.
Loading compiled script fps/server/scripts/game.cs.
%
--------- Initializing FPS: Client ---------
Loading compiled script common/client/message.cs.
Loading compiled script common/client/mission.cs.
Loading compiled script common/client/missionDownload.cs.
Loading compiled script common/client/actionMap.cs.
Loading compiled script common/editor/editor.cs.
Activating the OpenGL display device...
Setting screen mode to 800x600x24 (w)...
OpenGL Attributes:
DoubleBuffer: 1
BufferSize: 32, DepthSize: 24, StencilSize: 8
Red: 8, Green: 8, Blue: 8, Alpha: 0
Accum Red: 16, Green: 16, Blue: 16, Alpha: 16
OpenGL driver information:
Vendor: NVIDIA Corporation
Renderer: GeForce 256/AGP/SSE
Version: 1.3.1 NVIDIA 31.23
OpenGL Init: Enabled Extensions
ARB_multitexture (Max Texture Units: 2)
EXT_paletted_texture
EXT_compiled_vertex_array
NV_vertex_array_range
EXT_texture_env_combine
EXT_packed_pixels
EXT_fog_coord
ARB_texture_compression
EXT_texture_compression_s3tc
(ARB|EXT)_texture_env_add
EXT_texture_filter_anisotropic (Max anisotropy: 2.000000)
OpenGL Init: Disabled Extensions
3DFX_texture_compression_FXT1
WGL_EXT_swap_control

Loading compiled script common/ui/defaultProfiles.cs.
Loading compiled script common/ui/GuiEditorGui.gui.
Loading compiled script common/ui/ConsoleDlg.gui.
Loading compiled script common/ui/InspectDlg.gui.
Loading compiled script common/ui/InspectAddFieldDlg.gui.
Loading compiled script common/ui/LoadFileDlg.gui.
Loading compiled script common/ui/SaveFileDlg.gui.
Loading compiled script common/ui/MessageBoxOkDlg.gui.
Loading compiled script common/ui/MessageBoxYesNoDlg.gui.
Loading compiled script common/ui/MessageBoxOKCancelDlg.gui.
Loading compiled script common/ui/MessagePopupDlg.gui.
Loading compiled script common/ui/HelpDlg.gui.
Loading compiled script common/ui/RecordingsDlg.gui.
Loading compiled script common/client/metrics.cs.
Loading compiled script common/ui/FrameOverlayGui.gui.
Loading compiled script common/client/messageBox.cs.
Loading compiled script common/client/screenshot.cs.
Loading compiled script common/client/cursor.cs.
Loading compiled script common/client/help.cs.
Loading compiled script common/client/recordings.cs.
%
OpenAL Driver Init:
OpenAL
Error loading OpenAL Library: libopenal.so: cannot open shared object file: No such file or directory
Failed to initialize driver.
Vendor:
Version:
Renderer:
Extensions:
%
Loading compiled script fps/client/scripts/audioProfiles.cs.
Loading compiled script fps/client/ui/defaultGameProfiles.cs.
Loading compiled script fps/client/ui/PlayGui.gui.
Loading compiled script fps/client/ui/ChatHud.gui.
Loading compiled script fps/client/ui/playerList.gui.
Loading compiled script fps/client/ui/mainMenuGui.gui.
Loading compiled script fps/client/ui/aboutDlg.gui.
Loading compiled script fps/client/ui/startMissionGui.gui.
Loading compiled script fps/client/ui/joinServerGui.gui.
Loading compiled script fps/client/ui/endGameGui.gui.
Loading compiled script fps/client/ui/loadingGui.gui.
Loading compiled script fps/client/ui/optionsDlg.gui.
Loading compiled script fps/client/ui/remapDlg.gui.
Loading compiled script fps/client/scripts/client.cs.
Loading compiled script fps/client/scripts/missionDownload.cs.
Loading compiled script fps/client/scripts/serverConnection.cs.
Loading compiled script fps/client/scripts/playerList.cs.
Loading compiled script fps/client/scripts/loadingGui.cs.
Loading compiled script fps/client/scripts/optionsDlg.cs.
Loading compiled script fps/client/scripts/chatHud.cs.
Loading compiled script fps/client/scripts/messageHud.cs.
Loading compiled script fps/client/scripts/playGui.cs.
Loading compiled script fps/client/scripts/centerPrint.cs.
Loading compiled script fps/client/scripts/game.cs.
Loading compiled script fps/client/scripts/default.bind.cs.
Loading compiled script fps/client/config.cs.
Binding server port to default IP
UDP initialized on port 0
Unable to initialize IPX - error 5
Engine initialized...
%
Program received signal SIGILL, Illegal instruction.
0x083581e0 in glVertex2d ()
Current language: auto; currently c
(gdb) bt
#0 0x083581e0 in glVertex2d ()
#1 0xff04c483 in ?? ()
#2 0x080a4a12 in dglDrawRectFill (rect=@0xbffff3d0, color=@0x40ca5670)
at dgl/dgl.cc:452
#3 0x080dd328 in renderRaisedBox (bounds=@0xbffff3d0, profile=0x40ca5638)
at gui/guiDefaultControlRender.cc:24
#4 0x080e1fa9 in GuiButtonCtrl::onRender (this=0x40d58bf8, offset=0xbffff440,
updateRect=@0xbffff450) at gui/guiButtonCtrl.cc:38
#5 0x080ee4d8 in GuiControl::renderChildControls (this=0x40d58b48,
offset=0xbffff4b0, updateRect=@0xbffff510) at gui/guiControl.cc:339
#6 0x080ebfae in GuiChunkedBitmapCtrl::onRender (this=0x40d58b48,
offset=0xbffff520, updateRect=@0xbffff510)
at gui/guiChunkedBitmapCtrl.cc:151
#7 0x080e5d2f in GuiCanvas::renderFrame (this=0x40cc8528, preRenderOnly=false)
at gui/guiCanvas.cc:1166
#8 0x08122768 in DemoGame::processTimeEvent (this=0x8427020, event=0xbffff668)
at game/main.cc:691
#9 0x082043e6 in GameInterface::processEvent (this=0x8427020,
event=0xbffff668) at platform/gameInterface.cc:72
#10 0x08204579 in GameInterface::postEvent (this=0x8427020, event=@0xbffff668)
at platform/gameInterface.cc:153
#11 0x082c0049 in TimeManager::process ()
at platformX86UNIX/x86UNIXWindow.cc:784
#12 0x081222a2 in DemoGame::main (this=0x8427020, argc=2, argv=0x4091d3f8)
at game/main.cc:489
#13 0x082c0248 in main (argc=2, argv=0xbffff734)
at platformX86UNIX/x86UNIXWindow.cc:838
#14 0x401d1082 in __libc_start_main () from /lib/i686/libc.so.6
(gdb)



On stepping through the code it appears that when dglDrawRectFill() is executing GL functions my stack gets mangled because I jump out of the library into a completely bogus address.

I can successfully run the latest linux Realm Wars demo (the dynamically linked version) however the GL libraries appear to be statically linked in that.

Although I would like to debug and fix this problem, I haven't been able to do any torque coding for a really long time. If someone could suggest a known working distro/library combination I would be willing to reinstall at this stage.

I hope some use can come from any of the detail I've added if anymore info would help please let me know either via forum, email (pchunt@toxiferous.com),
or IM (pchunt77@hotmail.com, pchunt@jabber.org).
#9
09/19/2002 (8:37 am)
Your ldd output is odd. The binary should not be dynamically linked with libGL.so, that library is loaded at runtime. Also libGLU should be statically linked so it shouldn't show up in the ldd list.

Have you modified the makefiles to get this dynamic linking?
#10
09/20/2002 (5:02 am)
Cheers John, I seem to have been missing the obvious (more or less). libGLU should be linked statically but unfortunately I didn't have one on my system (or in any of the many Mesa RPMs I got my hands on.)

So that no one else has to put up with this particular problem for long I'll leave a solution in this entry for reference.

- Install Mandrake 8.x/9.x (with NASM & libSDL)
(I'm using XFree86 4.2.1 so there doesn't appear to be the correct NVIDIA drivers bundled with it... You'll want the latest ones anyway)
- Download the latest Mesa tarball.
./configure --prefix=/usr --enable-static
(The '--enable-static' option is what has caused me alot of angst, the static GLU library is fairly important)
make && make install
- Install the latest NVIDIA kernel & GLX packages (RPM or source)

This should give you a healthy Torque dev platform.

Thanks for all the constructive ideas John & Ryan.