Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 64522 - clanbomber-1.05 segfaults on amd64
Summary: clanbomber-1.05 segfaults on amd64
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Games (show other bugs)
Hardware: AMD64 Linux
: High normal (vote)
Assignee: AMD64 Project
URL:
Whiteboard:
Keywords:
Depends on: 86861
Blocks:
  Show dependency tree
 
Reported: 2004-09-18 07:44 UTC by Marco Squarcina
Modified: 2006-01-20 07:28 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Fixes the compilation issue (clanbomber-gcc34.patch,281 bytes, patch)
2004-11-21 03:43 UTC, Benjamin Schindler (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marco Squarcina 2004-09-18 07:44:51 UTC
clanlib compiles fine but when i compile clanbomber....


# emerge -v clanbomber

[...]

In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/3.4.1/include/g++-v3/fstream:857,
                 from Config.cpp:26:
/usr/lib/gcc/x86_64-pc-linux-gnu/3.4.1/include/g++-v3/bits/fstream.tcc: In member function `virtual typename std::basic_filebuf<_CharT, _Traits>::int_type std::basic_filebuf<_CharT, _Traits>::underflow()':
/usr/lib/gcc/x86_64-pc-linux-gnu/3.4.1/include/g++-v3/bits/fstream.tcc:277: error: expected unqualified-id before '(' token
/usr/lib/gcc/x86_64-pc-linux-gnu/3.4.1/include/g++-v3/bits/fstream.tcc: In member function `virtual std::streamsize std::basic_filebuf<_CharT, _Traits>::xsputn(const _CharT*, std::streamsize)':
/usr/lib/gcc/x86_64-pc-linux-gnu/3.4.1/include/g++-v3/bits/fstream.tcc:518: error: expected unqualified-id before '(' token
make[3]: *** [Config.o] Error 1
make[3]: Leaving directory `/var/tmp/portage/clanbomber-1.05/work/clanbomber-1.05/clanbomber'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/var/tmp/portage/clanbomber-1.05/work/clanbomber-1.05/clanbomber'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/var/tmp/portage/clanbomber-1.05/work/clanbomber-1.05'
make: *** [all] Error 2

!!! ERROR: games-action/clanbomber-1.05 failed.
!!! Function src_compile, Line 36, Exitcode 2
!!! emake failed
!!! If you need support, post the topmost build error, NOT this status message.


Reproducible: Always
Steps to Reproduce:
1.emerge clanbomber
2.
3.




Portage 2.0.51_rc1 (default-linux/amd64/gcc34-2004.2, gcc-3.4.1,
glibc-2.3.4.20040808-r0, 2.6.9-rc2 x86_64)
=================================================================
System uname: 2.6.9-rc2 x86_64 AMD Athlon(tm) 64 Processor 3200+
Gentoo Base System version 1.5.3
Autoconf: sys-devel/autoconf-2.59-r4
Automake: sys-devel/automake-1.8.5-r1
Binutils: sys-devel/binutils-2.15.90.0.1.1-r3
Headers:  sys-kernel/linux26-headers-2.6.7-r4
Libtools: sys-devel/libtool-1.5.2-r5
ACCEPT_KEYWORDS="amd64 ~amd64"
AUTOCLEAN="yes"
CFLAGS="-march=athlon64 -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
COMPILER=""
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config
/usr/kde/3.3/share/config:/usr/kde/3.3/env:/usr/kde/3.3/shutdown
/usr/kde/3/share/config /usr/lib/mozilla/defaults/pref /usr/share/config
/var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-march=athlon64 -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs ccache"
GENTOO_MIRRORS="ftp://sunsite.informatik.rwth-aachen.de/pub/Linux/gentoo
http://195.56.77.10/ http://194.149.10.102/
ftp://ftp.wh2.tu-dresden.de/pub/mirrors/gentoo"
MAKEOPTS="-j3"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="X acpi alsa amd64 avi berkdb bitmap-fonts cdr crypt dvd dvdr encode esd
foomaticdb gdbm gif gpm gtk gtk2 imlib ipv6 java jpeg libg++ libwww mikmod motif
mozilla mpeg ncurses nls oggvorbis opengl pam pdflib perl png python quicktime
readline sdl slang spell ssl tcltk tcpd tiff truetype xml2 xmms xprint xv zlib"
Comment 1 Matthias Pannek 2004-10-08 16:19:56 UTC
Same problem her on ~x86 :/
Comment 2 Chris Gianelloni (RETIRED) gentoo-dev 2004-11-20 06:06:47 UTC
Sounds like this is a gcc 3.4 issue rather than an amd64 issue, then.
Comment 3 Benjamin Schindler (RETIRED) gentoo-dev 2004-11-21 03:42:25 UTC
I've found a fix for this. The problem is, that compat.h (which gets included indirectly in Config.cpp) defines a min and max macro which expanded in fstream.tcc and made the syntax fail. 

I'm attaching a proposed fix and the new patched ebuild
Comment 4 Benjamin Schindler (RETIRED) gentoo-dev 2004-11-21 03:43:17 UTC
Created attachment 44402 [details, diff]
Fixes the compilation issue
Comment 5 Benjamin Schindler (RETIRED) gentoo-dev 2004-11-21 05:26:36 UTC
The game compiles like this, but it won't run. _Could_ be an amd64 issue that might even be fixed with later releases of clanlib (The error happens in clanlib)
I'll look into that later and open another bug for that
Comment 6 Marco Squarcina 2004-12-05 23:49:55 UTC
I tried the patch and yes... it compiles but it doesn't work

lavish@darkstar ~ $ clanbomber 
Segmentation fault
Comment 7 Benjamin Schindler (RETIRED) gentoo-dev 2004-12-07 13:32:50 UTC
Could some people using 32bit arches test this patch and see whether it works? The segfault issue seems to be 64bit specific (Open another bug for that)
Comment 8 Marco Squarcina 2004-12-08 00:52:54 UTC
I opened a new report:

http://bugs.gentoo.org/show_bug.cgi?id=73763

clanbomber compiles and works fine with this patch. So segfaulting is just an amd64 related issue
Comment 9 Mr. Bones. (RETIRED) gentoo-dev 2004-12-09 23:04:47 UTC
Is this still a problem with the clanlib 0.7.8-r1?
Comment 10 Marco Squarcina 2004-12-10 00:25:07 UTC
I've just emerged clanlib-0.7.8-r1 . 
It's slotted so I actually have 2 clanlibs:

lavish@darkstar ~ $ etcat -v clanlib | grep I
        [  I] 0.6.5-r2 (0.6)
        [  I] 0.7.8-r1 (0.7)

Ran clambomber but it still segfaults... that's why (I think) it still uses the old clanlib:

lavish@darkstar ~ $ clanlib-config 
Usage: clanlib-config [--version] [--cflags] [--libs]

lavish@darkstar ~ $ clanlib-config --libs
-L/usr/lib/clanlib-0.6.5 -lclanCore -lclanApp

lavish@darkstar ~ $ clanlib-config --version
0.6.3

lavish@darkstar ~ $ clanlib-config --cflags 
-I/usr/include/clanlib-0.6.5 -DDEBUG=1 -g3 -ggdb3


I really don't know how to switch to clanlib-0.7.8-r1... I also unmerged the 0.6 release but in that case nothing worked.... mhh....

Any suggestions?
Comment 11 Mr. Bones. (RETIRED) gentoo-dev 2004-12-10 00:27:09 UTC
unmerge the older clanlib and then remerge clanbomber.
Comment 12 Marco Squarcina 2004-12-10 00:53:48 UTC
darkstar lavish # emerge -C =clanlib-0.6.5-r2 && emerge -v clanlib && emerge --nodeps -v clanbomber (without --nodeps it will emerge also the old clanlib)

...

./configure --prefix=/usr/games --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share/games --sysconfdir=/etc/games --localstatedir=/var/games
configure: WARNING: If you wanted to set the --build type, don't use --host.
    If a cross compiler is detected then cross compile mode will be used.
checking for a BSD-compatible install... /bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for x86_64-pc-linux-gnu-strip... no
checking for strip... strip
checking for x86_64-pc-linux-gnu-g++... x86_64-pc-linux-gnu-g++
checking for C++ compiler default output file name... a.out
checking whether the C++ compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether x86_64-pc-linux-gnu-g++ accepts -g... yes
checking for style of include used by make... GNU
checking dependency style of x86_64-pc-linux-gnu-g++... gcc3
checking for x86_64-pc-linux-gnu-gcc... x86_64-pc-linux-gnu-gcc
checking whether we are using the GNU C compiler... yes
checking whether x86_64-pc-linux-gnu-gcc accepts -g... yes
checking for x86_64-pc-linux-gnu-gcc option to accept ANSI C... none needed
checking dependency style of x86_64-pc-linux-gnu-gcc... gcc3
checking for main in -lz... yes
checking for main in -lHermes... yes
checking for main in -lclanCore... no
ClanBomber requires ClanLib to run.

!!! ERROR: games-action/clanbomber-1.05 failed.
!!! Function egamesconf, Line 58, Exitcode 1
!!! egamesconf failed
!!! If you need support, post the topmost build error, NOT this status message.
Comment 13 Mr. Bones. (RETIRED) gentoo-dev 2004-12-10 01:39:30 UTC
oops, sorry, I didn't look at the clanbomber ebuild before recommending that.  It really needs the .6 version after all.  Sorry about that.

So... unmerge the 7.8 version, remerge the .6 version and confirm the segfault please.
Comment 14 Marco Squarcina 2004-12-10 01:53:03 UTC
np, emerged clanlib-0.6.* and clanbomber... I can (sigh) confirm the segfault
Comment 15 Mr. Bones. (RETIRED) gentoo-dev 2004-12-10 02:23:14 UTC
darn.  ok, thanks for testing.
Comment 16 Benjamin Schindler (RETIRED) gentoo-dev 2004-12-18 02:58:54 UTC
Ok... I've got a backtrace of this:

0x0000002a963ec960 in memcpy () from /lib/libc.so.6
#0  0x0000002a963ec960 in memcpy () from /lib/libc.so.6
#1  0x0000002a9580d2d0 in SubBlitter_Transparent<unsigned int>::blt_noclip (
    parent=0x654c00, target=0x4, x=20, y=6666576, spr_no=15)
    at blit_transparent.h:37
#2  0x0000002a9580b9c4 in CL_Blit_Transparent::blt_noclip (this=0x654c00, 
    target=0x577b80, x=333, y=0, spr_no=0) at blit_transparent.cpp:373
#3  0x0000002a9580e852 in CL_CardSurface_Blitter::put_screen (this=0x656ea0, 
    x=333, y=0, spr_no=0, target=0x577b80) at blitters.h:163
#4  0x0000002a95825f53 in CL_Surface_Generic::put_screen (this=0x645d30, 
    x=333, y=0, spr_no=0, card=0x2b974531e0) at surface_generic.cpp:88
#5  0x0000002a95812051 in CL_Font_Bitmap::print_generic (this=0x643d80, x=400, 
    y=25, _text=@0x10, n_height=1, alignment=1) at font_bitmap.cpp:151
#6  0x000000000043535d in Menu::redraw ()
#7  0x0000000000435c04 in Menu::scroll_in ()
#8  0x000000000042fa4c in ClanBomberApplication::main ()
#9  0x0000002a95963f0c in main (argc=1, argv=0x7fbffff0a8) at clanapp.cpp:32
#10 0x0000002a96397e31 in __libc_start_main () from /lib/libc.so.6
#11 0x0000000000403dca in _start ()

What's strange is the value of y in SubBlitter_Transparent<unsigned int>::blt_noclip+

I started digging through things, and it really looks very odd: 
We have: 
#2  0x0000002a9580b9c4 in CL_Blit_Transparent::blt_noclip ()
   from /usr/lib/libclanDisplay.so.2

Which looks like this: 

void CL_Blit_Transparent::blt_noclip(
	CL_Target *target,
	int x,
	int y,
	int spr_no)
{
	target->lock();
	
	unsigned int dest_bytes_per_pixel = (target->get_depth()+7)/8;
	switch (dest_bytes_per_pixel)
	{
	case 2:
		SubBlitter_Transparent<unsigned short>::blt_noclip(this, target, x, y, spr_no);
		break;
	case 4:
		SubBlitter_Transparent<unsigned int>::blt_noclip(this, target, x, y, spr_no);
		break;
	default:
		cl_assert(false);
		break;
	}

y has the value of zero when calling this function. I then checked dest_bytes_per_pixel, which has the value of 2, however, it would call 
SubBlitter_Transparent<unsigned int>::blt_noclip(this, target, x, y, spr_no);
Which would mean dest_bytes_per_pixel had to be 4, which isn't the case. And upon calling this function (y just gets passed along), y mutates to that very big, overflow-like looking value. 

Any thoughts of this?
Comment 17 Benjamin Schindler (RETIRED) gentoo-dev 2004-12-18 03:00:17 UTC
Oh, and I forgot: the value of parent (which also gets passed along) also looks very odd (0x4), which should be target=0x577b80 (according to my backtrace)
Comment 18 Simon Stelling (RETIRED) gentoo-dev 2005-08-31 08:56:56 UTC
this bug is terribly old, anybody ever had a look at it again?
Comment 19 Chris Gianelloni (RETIRED) gentoo-dev 2005-09-07 12:55:46 UTC
No tthat I am aware of... Care to take a stab at it?
Comment 20 Nathan Sullivan 2005-12-06 20:35:25 UTC
hmm, just built clanib 0.6.5-r3 and clanbomber 1.0.5, execute it and it starts
up fine for me. Does the segfault occur as soon as you execute clanbomber?

Portage 2.0.53 (default-linux/amd64/2005.0, gcc-3.4.4, glibc-2.3.5-r3,
2.6.14-ck6 x86_64)
=================================================================
System uname: 2.6.14-ck6 x86_64 AMD Opteron(tm) Processor 148
Gentoo Base System version 1.12.0_pre11
ccache version 2.4 [enabled]
dev-lang/python:     2.3.5, 2.4.2
sys-apps/sandbox:    1.2.17
sys-devel/autoconf:  2.13, 2.59-r7
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils:  2.16.1-r1
sys-devel/libtool:   1.5.20-r1
virtual/os-headers:  2.6.11-r3
ACCEPT_KEYWORDS="amd64 ~amd64"
AUTOCLEAN="yes"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -march=k8 -pipe -g"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config
/usr/lib/X11/xkb /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O2 -march=k8 -pipe -g"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig ccache distlocks fixpackages nostrip sandbox sfperms strict"
GENTOO_MIRRORS="http://mirror.isp.net.au/ftp/pub/gentoo
http://mirror.pacific.net.au/pub/Gentoo
http://public.planetmirror.com/pub/gentoo http://mirror.gentoo.gr.jp
ftp://gg3.net/pub/linux/gentoo http://ftp-mirror.internap.com/pub/gentoo
ftp://gentoo.agsn.ca/"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://172.17.0.1/gentoo-portage"
USE="X acpi aim alsa amd64 apache2 audiofile avi bash-completion berkdb
big-tables bitmap-fonts browserplugin bzip2 cairo cdr cli crypt cups curl dba
debug divx4linux dvd dvdr emboss encode ethereal exif expat extraengine fam
ffmpeg firefox flac foomaticdb fortran gd gdbm gif glut gpm gstreamer gtk gtk2
icq idn imap imlib innodb ipv6 jabber java jpeg kerberos lcms ldap lzw lzw-tiff
mad mhash mng mozsvg mp3 mpeg mppe-mppc mysql mysqli ncurses nls nptl nptlonly
nsplugin nvidia ogg openal opengl pam pcntl pcre pdflib pear perl php png posix
python quicktime readline real ruby samba sdl session slang soap sockets spell
sqlite ssl svg tcpd tiff truetype truetype-fonts type1-fonts udev unicode usb
userlocales utf8 vorbis wddx xine xinerama xml2 xmlrpc xmms xosd xpm xsl xv xvid
yahoo zlib userland_GNU kernel_linux elibc_glibc"
Unset:  ASFLAGS, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS
Comment 21 Simon Stelling (RETIRED) gentoo-dev 2006-01-20 07:28:28 UTC
it did, yes