2025-07-19 18:10 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0000034Spring engineGeneralpublic2005-12-14 22:34
ReportertuXXX 
Assigned Totvo 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
Product Version 
Target VersionFixed in Version 
Summary0000034: spring segfault before main() under linux
DescriptionI can't start the game.
When using gdb I can see that this error occurs in _start(), before main()
Additional Information
Installed with the gentoo ebuild

 $ gdb /usr/share/games/taspring-linux-svn/spring
GNU gdb 6.4
[...]
This GDB was configured as "i686-pc-linux-gnu"...Using host libthread_db library "/lib/libthread_db.so.1".

(gdb) r
Starting program: /usr/share/games/taspring-linux-svn/spring
[Thread debugging using libthread_db enabled]
[New Thread -1223701664 (LWP 13345)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1223701664 (LWP 13345)]
0xb7ac24fd in memmove () from /lib/libc.so.6
(gdb) bt
#0 0xb7ac24fd in memmove () from /lib/libc.so.6
#1 0x0819b802 in std::__copy<true, std::random_access_iterator_tag>::copy<CInputReceiver**> (__first=0x0, __last=0x4, __result=0x8797634)
    at stl_algobase.h:300
#2 0x0819b837 in std::__copy_aux<CInputReceiver***, CInputReceiver***> (
    __first=0x0, __last=0x4, __result=0x8797634) at stl_algobase.h:317
0000003 0x0819b859 in std::__copy_normal<false, false>::copy_n<CInputReceiver***, CInputReceiver***> (__first=0x0, __last=0x4, __result=0x8797634)
    at stl_algobase.h:326
0000004 0x0819b883 in std::copy<CInputReceiver***, CInputReceiver***> (
    __first=0x0, __last=0x4, __result=0x8797634) at stl_algobase.h:387
0000005 0x0819bac3 in std::deque<CInputReceiver*, std::allocator<CInputReceiver*> >::_M_reallocate_map (this=0x85997e0, __nodes_to_add=1, __add_at_front=true)
    at deque.tcc:753
#6 0x0819bb67 in std::deque<CInputReceiver*, std::allocator<CInputReceiver*> >::_M_reserve_map_at_front (this=0x85997e0, __nodes_to_add=1) at stl_deque.h:1455
#7 0x0819bb8c in std::deque<CInputReceiver*, std::allocator<CInputReceiver*> >::_M_push_front_aux (this=0x85997e0, __t=@0xbfef5f40) at deque.tcc:371
#8 0x0819bc4a in std::deque<CInputReceiver*, std::allocator<CInputReceiver*> >::push_front (this=0x85997e0, __x=@0xbfef5f40) at stl_deque.h:1026
#9 0x0819a40d in CInputReceiver (this=0x8708b60) at InputReceiver.cpp:10
0000010 0x082c4c47 in CTimeProfiler (this=0x8708b60) at TimeProfiler.cpp:22
#11 0x082c510b in __static_initialization_and_destruction_0 (__initialize_p=1,
    __priority=65535) at TimeProfiler.cpp:20
0000012 0x082c513f in global constructors keyed to profiler ()
    at TimeProfiler.cpp:194
0000013 0x083b19a2 in __do_global_ctors_aux ()
0000014 0x08050575 in _init ()
#15 0x083b18fb in __libc_csu_init ()
#16 0xb7a6eed9 in __libc_start_main () from /lib/libc.so.6
#17 0x08051fb1 in _start ()
(gdb)

 $ ldd /usr/share/games/taspring-linux-svn/spring
        linux-gate.so.1 => (0xffffe000)
        libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x44dc3000)
        libz.so.1 => /lib/libz.so.1 (0x44d83000)
        libSDL-1.2.so.0 => /usr/lib/libSDL-1.2.so.0 (0x45336000)
        libpthread.so.0 => /lib/libpthread.so.0 (0xb7fa2000)
        libopenal.so.0 => /usr/lib/libopenal.so.0 (0xb7f19000)
        libGLEW.so.1.3 => /usr/lib/libGLEW.so.1.3 (0xb7ee7000)
        libboost_filesystem-mt.so.1.33.1 => /usr/lib/libboost_filesystem-mt.so.1.33.1 (0xb7ed5000)
        libboost_thread-mt.so.1.33.1 => /usr/lib/libboost_thread-mt.so.1.33.1 (0xb7ec5000)
        libboost_regex-mt.so.1.33.1 => /usr/lib/libboost_regex-mt.so.1.33.1 (0xb7e03000)
        libIL.so.1 => /usr/lib/libIL.so.1 (0xb7d04000)
        libaio.so.1 => /usr/lib/libaio.so.1 (0xb7d02000)
        libGL.so.1 => //usr/lib/opengl/nvidia/lib/libGL.so.1 (0xb7c7f000)
        libstdc++.so.6 => /usr/lib/gcc/i686-pc-linux-gnu/4.0.2/libstdc++.so.6 (0xb7b9c000)
        libm.so.6 => /lib/libm.so.6 (0xb7b78000)
        libgcc_s.so.1 => /usr/lib/gcc/i686-pc-linux-gnu/4.0.2/libgcc_s.so.1 (0xb7b6d000)
        libc.so.6 => /lib/libc.so.6 (0xb7a55000)
        libdl.so.2 => /lib/libdl.so.2 (0xb7a51000)
        libGLU.so.1 => /usr/lib/libGLU.so.1 (0x46182000)
        libdirectfb-0.9.so.22 => /usr/lib/libdirectfb-0.9.so.22 (0xb7a12000)
        libfusion-0.9.so.22 => /usr/lib/libfusion-0.9.so.22 (0xb7a0c000)
        libdirect-0.9.so.22 => /usr/lib/libdirect-0.9.so.22 (0xb7a01000)
        libXext.so.6 => /usr/lib/libXext.so.6 (0x44d96000)
        libggi.so.2 => /usr/lib/libggi.so.2 (0x452f8000)
        libgii.so.0 => /usr/lib/libgii.so.0 (0x45303000)
        libgg.so.0 => /usr/lib/libgg.so.0 (0x4530e000)
        libvga.so.1 => /usr/lib/libvga.so.1 (0xb7995000)
        libaa.so.1 => /usr/lib/libaa.so.1 (0x4531a000)
        libcaca.so.0 => /usr/lib/libcaca.so.0 (0x453b5000)
        libslang.so.1 => /usr/lib/libslang.so.1 (0x45253000)
        libX11.so.6 => /usr/lib/libX11.so.6 (0x44cbf000)
        libncurses.so.5 => /lib/libncurses.so.5 (0xb795c000)
        /lib/ld-linux.so.2 (0xb7fde000)
        libasound.so.2 => /usr/lib/libasound.so.2 (0xb78c5000)
        libesd.so.0 => /usr/lib/libesd.so.0 (0x4517a000)
        libaudiofile.so.0 => /usr/lib/libaudiofile.so.0 (0x4514f000)
        libvorbis.so.0 => /usr/lib/libvorbis.so.0 (0x452ce000)
        libvorbisfile.so.3 => /usr/lib/libvorbisfile.so.3 (0x453c6000)
        libsmpeg-0.4.so.0 => /usr/lib/libsmpeg-0.4.so.0 (0x44e33000)
        libXmu.so.6 => /usr/lib/libXmu.so.6 (0x458f4000)
        libXi.so.6 => /usr/lib/libXi.so.6 (0x44e8f000)
        librt.so.1 => /lib/librt.so.1 (0xb78bb000)
        libpng.so.3 => /usr/lib/libpng.so.3 (0x45073000)
        libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0x44f8a000)
        libtiff.so.3 => /usr/lib/libtiff.so.3 (0x4641e000)
        libmng.so.1 => /usr/lib/libmng.so.1 (0x45832000)
        libGLcore.so.1 => //usr/lib/opengl/nvidia/lib/libGLcore.so.1 (0xb70fd000)
        libnvidia-tls.so.1 => //usr/lib/opengl/nvidia/lib/libnvidia-tls.so.1 (0xb70fb000)
        libgpm.so.1 => /lib/libgpm.so.1 (0x458c3000)
        libogg.so.0 => /usr/lib/libogg.so.0 (0x452c7000)
        libXt.so.6 => /usr/lib/libXt.so.6 (0x450d0000)
        libSM.so.6 => /usr/lib/libSM.so.6 (0x44db9000)
        libICE.so.6 => /usr/lib/libICE.so.6 (0x44da3000)
        liblcms.so.1 => /usr/lib/liblcms.so.1 (0x45893000)

 $ g++ --version
g++ (GCC) 4.0.2 (Gentoo 4.0.2-r1, pie-8.7.8)

 $ /lib/libc.so.6
GNU C Library stable release version 2.3.6, by Roland McGrath et al.
Copyright (C) 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 3.4.4 (Gentoo 3.4.4-r1, ssp-3.4.4-1.0, pie-8.7.8).
Compiled on a Linux 2.6.11 system on 2005-12-03.
Available extensions:
        GNU libio by Per Bothner
        crypt add-on version 2.1 by Michael Glad and others
        Native POSIX Threads Library by Ulrich Drepper et al
        The C stubs add-on version 2.1.2.
        GNU Libidn by Simon Josefsson
        BIND-8.2.3-T5B
        NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk
Thread-local storage support included.

 $ emerge --info
Portage 2.0.53 (default-linux/x86/2005.1, gcc-4.0.2, glibc-2.3.6-r1, 2.6.14.3 i686)
=================================================================
System uname: 2.6.14.3 i686 AMD Athlon(tm) MP 2400+
Gentoo Base System version 1.12.0_pre11
distcc 2.18.3 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [disabled]
ccache version 2.4 [disabled]
dev-lang/python: 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="x86 ~x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-Os -mtune=athlon-mp -march=athlon-mp -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.5/env /usr/kde/3.5/share/config /usr/kde/3.5/shutdown /usr/kde/3/share/config /usr/lib/X11/xkb /usr/lib/mozilla/defaults/pref /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/texmf/web2c /etc/env.d"
CXXFLAGS="-Os -mtune=athlon-mp -march=athlon-mp -pipe -fomit-frame-pointer -finline-functions"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig collision-protect distlocks sandbox sfperms"
GENTOO_MIRRORS="http://ftp.belnet.be/mirror/rsync.gentoo.org/gentoo/"
LANG="fr_FR@euro"
LC_ALL="fr_FR@euro"
LDFLAGS="-Wl,-O1,-z,now"
LINGUAS="fr"
MAKEOPTS="-j 3"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.de.gentoo.org/gentoo-portage"
USE="x86 3dnow 3dnowex X aalib acpi alsa apm audiofile avi berkdb bitmap-fonts bzip2 cairo cdr crypt cups curl dbus dga directfb dts dvd dvdr dvdread eds emboss encode esd ethereal exif expat fam fbcon ffmpeg flac foomaticdb gcj gd gdbm ggi gif glut gmp gnome gnomedb gpm gstreamer gtk gtk2 guile hal idn imagemagick imap imlib ipv6 java jikes jpeg junit lcms libcaca libg++ libwww linguas_fr lm_sensors logitech-mouse lua mad matroska mikmod ming mmx mmx2 mng motif mozilla mp3 mpeg mysql ncurses network nls nptl nptlonly nsplugin nvidia ogg oggvorbis openal opengl pam pcre pdflib perl php pic pie plotutils png python quicktime rdesktop readline real recode rtc samba sasl sdl slang smp speex spell sqlite sse ssl svg svga tcltk tcpd tetex threads tiff truetype truetype-fonts type1-fonts udev usb v4l v4l2 vorbis win32codecs xine xinerama xml xml2 xv xvid zlib userland_GNU kernel_linux elibc_glibc"
Unset: ASFLAGS, CTARGET


Note : CFLAGS and CXXFLAGS aren't used when merging taspring with the ebuild.
I trid with gcc 3.4.4 and glibc 2.3.5, and I have the same problem
TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files

-Relationships
+Relationships

-Notes

~0000033

tvo (reporter)

Last edited: 2005-12-14 20:32

It's an order of initialization problem (ie. linking order matters). You can workaround the bug by manually linking all object files into an executable, but swapping the link order of rts/InputReceiver.o and rts/TimeProfiler.o. (rts/InputReceiver.o should go first.)

Technical details: CTimeProfiler inherits CInputReceiver and CTimeProfiler is the type of a global variable (rts/TimeProfiler.cpp:20). On program startup (in __static_initialization_and_destruction_0), CTimeProfiler::CTimeProfiler is called, which calls CInputReceiver::CInputReceiver, which tries to push_back itself into a std::deque declared at rts/InputReceiver.cpp:6, which is at that time not yet initialized, resulting in the OP's crash. Swapping link order changes order of initialization and hence the problem doesn't occur.

May I ask, which exact version of scons are you using?

I'll make sure this gets fixed as soon as possible.

~0000035

tuXXX (reporter)

> May I ask, which exact version of scons are you using?
Yes :
$ scons --version
SCons by Steven Knight et al.:
        script: v0.96.1.D001, 2004/08/23 09:55:29, by knight on casablanca
        engine: v0.96.1.D001, 2004/08/23 09:55:29, by knight on casablanca

>I'll make sure this gets fixed as soon as possible.
Great! thanks :)

~0000036

tuXXX (reporter)

Currently I was able to start it when compiling.
But in my build command, InputReceiver.o was before TimeProfiler.o
I put TimerProfiler.o before InputReceiver.o and now I can start the game (and play)!

~0000037

tvo (reporter)

> $ scons --version
> SCons by Steven Knight et al.:
> script: v0.96.1.D001, 2004/08/23 09:55:29, by knight on casablanca
> engine: v0.96.1.D001, 2004/08/23 09:55:29, by knight on casablanca

Hmm, apparantly the build order initialization differs per gcc or libc/libstdc++ version... I don't know. We shouldn't depend on it anyway.

> >I'll make sure this gets fixed as soon as possible.
> Great! thanks :)

Committed a fix into SVN. Closing bug.
+Notes

-Issue History
Date Modified Username Field Change
2005-12-13 20:15 tuXXX New Issue
2005-12-13 20:15 tuXXX Status new => assigned
2005-12-13 20:15 tuXXX Assigned To => jcnossen
2005-12-14 16:58 jcnossen Assigned To jcnossen => tvo
2005-12-14 20:31 tvo Note Added: 0000033
2005-12-14 20:32 tvo Note Edited: 0000033
2005-12-14 20:53 tuXXX Note Added: 0000035
2005-12-14 22:16 tuXXX Note Added: 0000036
2005-12-14 22:29 tvo Note Added: 0000037
2005-12-14 22:34 tvo Status assigned => resolved
2005-12-14 22:34 tvo Resolution open => fixed
+Issue History