Bug 177858 - cal3d 16bit-indicies cause eternal lands to segfault
Bug#: 177858 Product:  Gentoo Linux Version: unspecified Platform: AMD64
OS/Version: Linux Status: NEW Severity: normal Priority: P2
Resolution:  Assigned To: python@gentoo.org Reported By: branko.majic@gmail.com
Component: Games
URL: 
Summary: cal3d 16bit-indicies cause eternal lands to segfault
Keywords:  
Status Whiteboard: 
Opened: 2007-05-09 20:17 0000
Description:   Opened: 2007-05-09 20:17 0000
The game crashes right after you log in and the data is loaded, at the moment
when you should see the rendered surroundings.

Reproducible: Always

Steps to Reproduce:
1.Run Eternal Lands (el), preferably in terminal to see the error message
2.Log in

Actual Results:  
Game segfaults.

Expected Results:  
The game should have run normally (no segfaults).

Here's the output of 'emerge --info' command:
Portage 2.1.2.2 (default-linux/amd64/2006.0, gcc-3.4.6, glibc-2.5-r2,
2.6.18-gentoo-r6 x86_64)
=================================================================
System uname: 2.6.18-gentoo-r6 x86_64 AMD Athlon(tm) 64 X2 Dual Core Processor
3800+
Gentoo Base System release 1.12.9
Timestamp of tree: Mon, 07 May 2007 16:29:01 +0000
distcc 2.18.3 x86_64-pc-linux-gnu (protocols 1 and 2) (default port 3632)
[disabled]
dev-java/java-config: 1.3.7, 2.0.31-r5
dev-lang/python:     2.4.3-r4
dev-python/pycrypto: 2.0.1-r5
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.13, 2.61
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10
sys-devel/binutils:  2.16.1-r3
sys-devel/gcc-config: 1.3.16
sys-devel/libtool:   1.5.22
virtual/os-headers:  2.6.17-r2
ACCEPT_KEYWORDS="amd64"
AUTOCLEAN="yes"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=k8"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/3.5/env /usr/kde/3.5/share/config
/usr/kde/3.5/shutdown /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/env.d /etc/env.d/java/ /etc/gconf
/etc/java-config/vms/ /etc/php/apache1-php5/ext-active/
/etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/
/etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/splash /etc/terminfo
/etc/texmf/web2c"
CXXFLAGS="-O2 -pipe -march=k8"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig distlocks metadata-transfer sandbox sfperms strict"
GENTOO_MIRRORS="http://distro.ibiblio.org/pub/linux/distributions/gentoo/
http://mirror.etf.bg.ac.yu/gentoo "
LANG="sr_CS.UTF-8"
LC_ALL="sr_CS.UTF-8"
LINGUAS="en sr sr@Latn sr_CS"
MAKEOPTS="-j1"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress
--force --whole-file --delete --delete-after --stats --timeout=180
--exclude=/distfiles --exclude=/local --exclude=/packages
--filter=H_**/files/digest-*"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X a52 aac aalib acl acpi afs aim alsa amd64 apache apache2 apm audiofile
bash-completion bcmath berkdb bidi bitmap-fonts blas bluetooth bonobo bzip2
cairo calendar canna cdb cddb cdparanoia cdr chasen cjk clamav cli cracklib
crypt ctype cups curl curlwrappers dbus dga directfb doc dri dv dvb dvd dvdr
dvdread eds emboss encode examples exif expat fam fbcon ffmpeg fftw firefox
flac flatfile foomaticdb fortran freewnn ftp gb gcj gd gif ginac glut gphoto2
gpm gps graphviz gstreamer gtk gtk2 gtkhtml guile hal iconv icq imagemagick
imap imlib inifile ipv6 isdnlog jabber java javascript joystick jpeg jpeg2k kde
kdeenablefinal kdexdeltas ldap libcaca libg++ libgda libnotify libwww lirc
lm_sensors lua lzw lzw-tiff mad maildir matroska mbox mcal midi mikmod mime mng
mono mp3 mpeg mplayer msn musepack musicbrainz mysql mysqli nas ncurses nls
nntp nptl nsplugin offensive ogg opengl oscar pam pcre pda pdf perl php
plotutils png posix ppds pppd python qt3 qt4 quicktime readline reflection ruby
samba sasl scanner sdl session sharedext shorten simplexml slang sockets speex
spell spl sqlite3 ssl startup-notification svg szip tcl tcltk tcpd tetex theora
threads tidy tiff tk tokenizer truetype truetype-fonts type1-fonts unicode usb
v4l vcd vhosts vorbis wmf wxwindows x264 xcomposite xine xinetd xml xorg xpm xv
xvid yahoo zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106
cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0
intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci"
ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file
hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route
share shm softvol" ELIBC="glibc" INPUT_DEVICES="keyboard mouse" KERNEL="linux"
LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses
text" LINGUAS="en sr sr@Latn sr_CS" LIRC_DEVICES="pctv" USERLAND="GNU"
VIDEO_CARDS="nvidia vesa fbdev"
Unset:  CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LDFLAGS, PORTAGE_COMPRESS,
PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

I'd just like to mention that compilation goes without a flaw. I even tried to
fetch the latest client from the cvs, compiled it, and it still segfaults. Now,
what makes it interesting is that the static (32-bit) precompiled binary, which
can be downloaded from their site, works without a flaw. I've also tried to
recompile all of the direct dependencies to no avail. I also tried to trace the
segfault by compiling the client with debug symbols, and it didn't help (the
segfault probably occurs in some of the underlying libraries, I got something
"blahblahblah in ??" when it occurred). I've also verified that this is
amd64-specific problem (my bro's x86 machine had no problems with it). One
thing that might be the problem is my usage of some of the testing packages (I
tried using the stable nvidia-drivers, though, and nothing changed). On the
other hand, I don't see any library which is used by EL to be a test-masked.

------- Comment #1 From Roy Marples (RETIRED) 2007-05-09 22:08:21 0000 -------
I'm not seeing this on my amd64.
Can you provide attach backtrace please?
http://www.gentoo.org/proj/en/qa/backtraces.xml

------- Comment #2 From Branko Majic 2007-05-10 06:21:57 0000 -------
My backtrace won't provide any useful information - the system's binaries are
stripped of all debugging symbols (except that one time when I tried compiling
EL with debug symbols, but it doesn't help either). Now, I'm using
gcc-3.4.6-r2, so I'm thinking if that may be the problem? Seeing that other
people have no such problems, I'm beginning to think that it's only occurring
on my machine. Btw, EL 1.3.3 stopped working after I updated the world at some
point. I have no idea what to do (except to switch to new gcc 4.x, but it will
take a lot of time to recompile the system).

------- Comment #3 From Roy Marples (RETIRED) 2007-05-10 06:39:38 0000 -------
(In reply to comment #2)
> My backtrace won't provide any useful information - the system's binaries are
> stripped of all debugging symbols (except that one time when I tried compiling
> EL with debug symbols, but it doesn't help either). Now, I'm using
> gcc-3.4.6-r2, so I'm thinking if that may be the problem? Seeing that other
> people have no such problems, I'm beginning to think that it's only occurring
> on my machine. Btw, EL 1.3.3 stopped working after I updated the world at some
> point. I have no idea what to do (except to switch to new gcc 4.x, but it will
> take a lot of time to recompile the system).
> 

You need to follow th GCC upgrade guide.
http://www.gentoo.org/doc/en/gcc-upgrading.xml#upgrade-general

Re-open when you have done this and still have this error

------- Comment #4 From Branko Majic 2007-05-13 14:04:05 0000 -------
I've upgraded my gcc, and the problem persists (hey, at least I got my gcc
upgraded, eh?). I'll try to rebuild some of the game's dependencies with
debugging information, and then run it through gdb.

------- Comment #5 From Branko Majic 2007-05-13 15:00:06 0000 -------
Created an attachment (id=119118) [details]
Backtrace with (I hope) some useful information

I'm not sure if I got all of this right, I hope I did. Unfortunately, I didn't
recompile my glibc with debugging symbols. If it would be more useful to do
that, let me know.

------- Comment #6 From Roy Marples (RETIRED) 2007-05-13 15:09:33 0000 -------
OK that's showing an error in the OpenGL part shipped by nVidia.

Do other 3D applications work fine? For example, we have ut2004-demo in
portage, does that work? How about 3D OpenGL screensavers?

------- Comment #7 From Branko Majic 2007-05-13 15:30:45 0000 -------
As far as I can tell, other games work just fine. I've tried playing X2: The
Threat - it works. Sauerbraten - works. Savage - works, bzflag (the only game
listed here which is not distributed in binary, I think) - works, several games
played through wine work as well. I've also tried using older nvidia drivers
(the non-masked ones), but as I said - it still segfaults. When did you last
update your packages?

------- Comment #8 From Branko Majic 2007-05-13 15:33:31 0000 -------
Ah, sorry, I'd also like to add that non-game OpenGL applications work as well
(I use a screensaver which uses OpenGL), Beryl included.

------- Comment #9 From Roy Marples (RETIRED) 2007-05-13 18:51:48 0000 -------
Have you tried running EL without compiz and Beryl? Also try disabling
compostie, XGL and AIGLX if you have them enabled.

As to the packages, my system runs a full ~amd64 - which means all the latest
libraries.

------- Comment #10 From Branko Majic 2007-05-13 19:13:29 0000 -------
Neither Compiz nor Beryl are running on my machine all the time (I mostly use
Beryl for showing-off due to the ugly bug in nvidia-drivers). Hm... I'm using
mostly stable branch (a package here and there is from ~amd64), the only direct
link to this problem might be nvidia-drivers (I use version 1.0.9755-r1, which
is marked as testing), but as I said earlier, I've tried using the stable
version to no avail. It might be interesting to have someone who runs mostly
stable amd64 to test this thing as well (apart from myself). I'm pretty sure
that some of the underlying libraries are messing things up, maybe the newer
libs you have work better? Btw, are you sure the segfault occurs in nvidia
drivers, since I'm not sure that my trackeback is good enough? I think I'll try
to get X up without some specific options in xorg.conf that allow the usage of
Beryl.

------- Comment #11 From Branko Majic 2007-05-13 19:40:50 0000 -------
I have (finally) identified the problem. The problem was the '16bit-indices'
USE flag in media-libs/cal3d-0.11.0-r1. I've tried recompiling this library
without this flag, and the problem is gone. Then, just in case, I compiled it
again with this USE flag, problem is back. Tomorrow I'll do a check on x86
machine in order to see if it's arch-specific (so far I've encountered several
problems regarding the sizes of various integer types on amd64). Since you're
running testing branch, it would be nice if you could verify these findings
(just to make sure).

------- Comment #12 From Roy Marples (RETIRED) 2007-05-13 20:26:37 0000 -------
Good catch!

I've added this check to the ebuild, thanks.

------- Comment #13 From Roy Marples (RETIRED) 2007-05-13 20:55:37 0000 -------
re-opening as cal3d should not cause this crash, but it is a cal3d bug