Ubuntu 11.04 SEGV at startup in opengl_initialise()

For problems with the game

Moderators: jelco, bert_the_turtle, Chris, Icepick, Rkiver, Punisher Bass

jmb
level0
Posts: 1
Joined: Thu Jun 14, 2012 10:35 pm
Location: Kildare, Ireland

Ubuntu 11.04 SEGV at startup in opengl_initialise()

Postby jmb » Sat Jun 16, 2012 1:48 am

I have an original CD copy of Uplink bought many years ago, and yesterday brought it out of retirement after a blog post from Sophos. Windows version works fine on a separate laptop, but I'm struggling to get the Linux version going on my desktop.

I've tried (a) original unpatched (b) patched to latest 1.55 downloaded from Introversion, and (c) 1.6 demo version, all with similar results. I get a segmentation fault immediately on startup:

Code: Select all

=============================
=                           =
=        U P L I N K        =
=                           =
=        Version 1.6DEMO    =
=        - D E M O -        =
=                           =
=============================

Version 1.6DEMO (RELEASE-DEMO)
Compiled on Dec 11 2011 at 13:48:40


An Uplink Internal Error has occured: segmentation violation (SIGSEGV)

An Uplink Internal Error has occured during graphics initialization

An (unrecognised) Uplink Internal Error has occured
===================================================
See the /home/jmb/.uplink/debug.log file for more informations on the error
Segmentation fault

Only the demo version actually drops any information into debug.log (the others create it but leave it zero length - very unhelpful):

Code: Select all

/usr/local/games/uplinkdemo/uplinkdemo.bin.x86[0x804fd8a]
/usr/local/games/uplinkdemo/uplinkdemo.bin.x86[0x804d0f7]
/usr/local/games/uplinkdemo/uplinkdemo.bin.x86[0x80fea29]
[0xa5a400]
/usr/local/games/uplinkdemo/uplinkdemo.bin.x86[0x8051af4]
/usr/local/games/uplinkdemo/uplinkdemo.bin.x86[0x80fdc84]
/usr/local/games/uplinkdemo/uplinkdemo.bin.x86[0x80febc1]
/usr/local/games/uplinkdemo/uplinkdemo.bin.x86[0x80feda6]
/lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xe7)[0x463e37]
/usr/local/games/uplinkdemo/uplinkdemo.bin.x86(__gxx_personality_v0+0x395)[0x804cae1]

I've seen some similar reports here with different (or no) causes/solutions, but perhaps I can add some more detail. Non-programmers may prefer to head for another thread about now... :)


gdb offers this backtrace, and confirms that the erroring function isn't from a .so:

Code: Select all

Program received signal SIGSEGV, Segmentation fault.
#0  0x08051af4 in opengl_initialise(int, char**) ()
#1  0x080fdc84 in Init_OpenGL(int, char**) ()
#2  0x080febc1 in RunUplink(int, char**) ()
#3  0x080feda6 in main ()

        `/usr/local/games/uplinkdemo/uplinkdemo.bin.x86', file type elf32-i386.
        Entry point: 0x804cac0
        0x08048134 - 0x08048147 is .interp
        ...
        0x0804cac0 - 0x081839c8 is .text

The disassembly (coerced to Intel form) shows that to be caused by an explicit access of address 0, which looks like deliberate "crash now" code, as it follows a printf of a fatal error message:

Code: Select all

   0x8051acb <_Z17opengl_initialiseiPPc+507>:   call   0x816c360 <_Z15GciInitGraphicsPKciiiiiiPPc>
   0x8051ad0 <_Z17opengl_initialiseiPPc+512>:   test   eax,eax
   0x8051ad2 <_Z17opengl_initialiseiPPc+514>:   je     0x8051afb <_Z17opengl_initialiseiPPc+555>
   0x8051ad4 <_Z17opengl_initialiseiPPc+516>:   mov    DWORD PTR [esp+0xc],0x70
   0x8051adc <_Z17opengl_initialiseiPPc+524>:   mov    DWORD PTR [esp+0x8],0x81843a2
   0x8051ae4 <_Z17opengl_initialiseiPPc+532>:   mov    DWORD PTR [esp+0x4],eax
   0x8051ae8 <_Z17opengl_initialiseiPPc+536>:   mov    DWORD PTR [esp],0x8184480
   0x8051aef <_Z17opengl_initialiseiPPc+543>:   call   0x804c56c <printf@plt>
=> 0x8051af4 <_Z17opengl_initialiseiPPc+548>:   mov    BYTE PTR ds:0x0,0x0
   0x8051afb <_Z17opengl_initialiseiPPc+555>:   call   0x816bcc0 <_Z23GciGetCurrentScreenModev>
   ...

0x8184480:       "\nUplink has been forced to Abort\n", '=' <repeats 31 times>, "\n Message   : %s\n Location  : %s, line %d\n"

0x81843a2:       "app/opengl.cpp"

Unfortunately stdout isn't in line-buffered mode (as it's redirected to the debug.log file) so the crash doesn't give stdio a chance to flush the output buffer, so the message is never seen. Maybe add an fflush(stdout) somewhere? (not sure why the signal handler wouldn't be doing this anyway).

Examining the contents of the stdout buffer lets me give you (at last) what ought to be in the debug.log:

Code: Select all

NEW GAME     0:8, 16/6/2012
===============================================
Version : 1.6DEMO
DEMO
Linux Build
Version 1.6DEMO (RELEASE-DEMO)
Compiled on Dec 11 2011 at 13:48:40

Path : /usr/local/games/uplinkdemo/
Loading uplink options from /home/jmb/.uplink/options...success

=====DEBUGGING INFORMATION ENABLED=====
Loading application data
Successfully loaded data archive data.dat
Successfully loaded data archive graphics.dat
Successfully loaded data archive loading.dat
Successfully loaded data archive sounds.dat
Successfully loaded data archive music.dat
Successfully loaded data archive fonts.dat
Successfully loaded data archive patch.dat
Successfully loaded data archive patch2.dat
Successfully loaded data archive patch3.dat
Finished loading application data
Init_Game called...creating game object
Finished with Init_Game
Saving uplink options to /home/jmb/.uplink/options...success
Initialising SDL...done
 SDL is now opening a 1024x768 window in 32 depth ...
Uplink has been forced to Abort
===============================
 Message   : Could not initialize SDL Video: Couldn't find matching GLX visual.
 Location  : app/opengl.cpp, line 112


I can see other posts mentioning that last error message, and I'll dig through those next, but fixing this error logging failure seems worthwhile. (This is on a venerable A7N8X with an AGP Radeon HD3650)
Software engineer, hacker, cat wrangler.

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 0 guests