Page 2 of 3

Posted: Sat Feb 04, 2006 12:36 pm
by harm
After an hour or three compiling I got the debug executables and ran it throught gdb, I really have no idea how this works or what it tells:

Code: Select all

GNU gdb 6.4-debian
Copyright 2005 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...Using host libthread_db library "/lib/tls/libthread_db.so.1".

(gdb) run
Starting program: /home/harm/orion/FOsvn/freeorion/FreeOrion/freeorion 
[Thread debugging using libthread_db enabled]
[New Thread -1227016512 (LWP 28202)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1227016512 (LWP 28202)]
std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::str (this=0xbfcfb8d4) at basic_string.h:257
257           { return &((reinterpret_cast<_Rep*> (_M_data()))[-1]); }
If there is anything else I can do (and you are willing to indulge me further) please say so.

Posted: Sat Feb 04, 2006 12:44 pm
by harm
I can't help myself and looked into this error myself. The error seems to appear from basic_string.h which is not a FO or GG file but an include file. I have two of these files on my system, one in /usr/include/c++/3.3/bits and one in /usr/include/c++/4.0.3/bits ..... And I am using the 4.0 version.
What kind of compiler do you guys use?

Posted: Sat Feb 04, 2006 8:18 pm
by tzlaine
harm wrote:After an hour or three compiling I got the debug executables and ran it throught gdb, I really have no idea how this works or what it tells:

Code: Select all

GNU gdb 6.4-debian
Copyright 2005 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...Using host libthread_db library "/lib/tls/libthread_db.so.1".

(gdb) run
Starting program: /home/harm/orion/FOsvn/freeorion/FreeOrion/freeorion 
[Thread debugging using libthread_db enabled]
[New Thread -1227016512 (LWP 28202)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1227016512 (LWP 28202)]
std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::str (this=0xbfcfb8d4) at basic_string.h:257
257           { return &((reinterpret_cast<_Rep*> (_M_data()))[-1]); }
If there is anything else I can do (and you are willing to indulge me further) please say so.
Do just what you did before, but when it stops with a segfault, type 'bt' (for 'backtrace'), and post the resulting stack trace. Thanks.

Posted: Sat Feb 04, 2006 8:30 pm
by harm
No thank you.

Code: Select all

(gdb) run
Starting program: /home/harm/orion/FOsvn/freeorion/FreeOrion/freeorion 
[Thread debugging using libthread_db enabled]
[New Thread -1227282752 (LWP 17941)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1227282752 (LWP 17941)]
std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::str (this=0xbfbbb864) at basic_string.h:257
257           { return &((reinterpret_cast<_Rep*> (_M_data()))[-1]); }
(gdb) bt
#0  std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::str (this=0xbfbbb864) at basic_string.h:257
#1  0xb772d938 in std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::overflow (this=0xbfbbb864)
    at basic_string.h:358
#2  0xb6fa470f in std::basic_streambuf<char, std::char_traits<char> >::xsputn () from /usr/lib/libstdc++.so.5
#3  0xb769e24b in std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::_M_insert_float<double> ()
   from /usr/lib/libstdc++.so.6
#4  0xb769e5fc in std::num_put<char, std::ostreambuf_iterator<char, std::char_traits<char> > >::do_put ()
   from /usr/lib/libstdc++.so.6
#5  0xb76a8c26 in std::ostream::operator<< () from /usr/lib/libstdc++.so.6
#6  0x080d0d1d in boost::detail::lexical_stream<std::string, double>::operator<< (this=0xbfbbb858, input=@0xbfbbb978)
    at lexical_cast.hpp:151
#7  0x080d0d70 in boost::lexical_cast<std::string, double> (arg=@0xbfbbb978) at lexical_cast.hpp:222
#8  0x082f9e0c in OptionsDB::Add<double> (this=0x84d3080, name=@0xbfbbba24, description=@0xbfbbba1c, default_value=0.75, 
    validator=@0xbfbbb9f4) at OptionsDB.h:113
#9  0x08390f47 in (anonymous namespace)::AddOptions (db=@0x84d3080) at UI/TechTreeWnd.cpp:43
#10 0x081ff043 in GetOptionsDB () at util/OptionsDB.cpp:56
#11 0x0824ca73 in main (argc=1, argv=0xbfbbc0f4) at client/human/chmain.cpp:22
(gdb) 
Hmm useful stuff these debuggers. :)

Posted: Sat Feb 04, 2006 11:16 pm
by tzlaine
Well, since the code indicated is pretty inocuous, how about posting the result of 'ldd freeorion'? It looks like you've got a mixed-compiler system, which is a recipe for disaster when compiling c++ code.

Posted: Sat Feb 04, 2006 11:39 pm
by harm
Allright here is the output of ldd freeorion:

Code: Select all

        linux-gate.so.1 =>  (0xffffe000)
        libGiGiSDL.so => /usr/local/lib/libGiGiSDL.so (0xb7f79000)
        libSDL-1.2.so.0 => /usr/lib/libSDL-1.2.so.0 (0xb7ec5000)
        libGiGiNet.so => /usr/local/lib/libGiGiNet.so (0xb7ebd000)
        libIL.so.1 => /usr/lib/libIL.so.1 (0xb7db2000)
        libILU.so.1 => /usr/lib/libILU.so.1 (0xb7d99000)
        libILUT.so.1 => /usr/lib/libILUT.so.1 (0xb7d94000)
        libGiGi.so => /usr/local/lib/libGiGi.so (0xb7a01000)
        libboost_signals-gcc-mt-1_33_1.so.1.33.1 => /usr/lib/libboost_signals-gcc-mt-1_33_1.so.1.33.1 (0xb79ef000)
        libboost_filesystem-gcc-mt-1_33_1.so.1.33.1 => /usr/lib/libboost_filesystem-gcc-mt-1_33_1.so.1.33.1 (0xb79df000)
        libGL.so.1 => /usr/X11R6/lib/libGL.so.1 (0xb797c000)
        libGLU.so.1 => /usr/X11R6/lib/libGLU.so.1 (0xb78fd000)
        libpthread.so.0 => /lib/tls/libpthread.so.0 (0xb78ea000)
        libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0xb787d000)
        libz.so.1 => /usr/lib/libz.so.1 (0xb7869000)
        libfmod-3.75.so => /usr/local/lib/libfmod-3.75.so (0xb77ce000)
        libcdt.so.0 => /usr/lib/graphviz/libcdt.so.0 (0xb77c9000)
        libcommon.so.0 => /usr/lib/graphviz/libcommon.so.0 (0xb7770000)
        libdotgen.so.0 => /usr/lib/graphviz/libdotgen.so.0 (0xb7753000)
        libdotneato.so.0 => /usr/lib/graphviz/libdotneato.so.0 (0xb7750000)
        libgraph.so.0 => /usr/lib/graphviz/libgraph.so.0 (0xb7745000)
        libgvrender.so.0 => /usr/lib/graphviz/libgvrender.so.0 (0xb7741000)
        libpathplan.so.0 => /usr/lib/graphviz/libpathplan.so.0 (0xb7734000)
        liblog4cpp.so.4 => /usr/local/lib/liblog4cpp.so.4 (0xb7701000)
        libnsl.so.1 => /lib/tls/libnsl.so.1 (0xb76eb000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb760d000)
        libm.so.6 => /lib/tls/libm.so.6 (0xb75e7000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb75dc000)
        libc.so.6 => /lib/tls/libc.so.6 (0xb74a5000)
        libasound.so.2 => /usr/lib/libasound.so.2 (0xb73f2000)
        libartsc.so.0 => /usr/lib/libartsc.so.0 (0xb73ec000)
        libgmodule-2.0.so.0 => /usr/lib/libgmodule-2.0.so.0 (0xb73e7000)
        libdl.so.2 => /lib/tls/libdl.so.2 (0xb73e3000)
        libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0xb73df000)
        libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0xb735a000)
        libesd.so.0 => /usr/lib/libesd.so.0 (0xb7351000)
        libaudiofile.so.0 => /usr/lib/libaudiofile.so.0 (0xb732d000)
        libaudio.so.2 => /usr/lib/libaudio.so.2 (0xb7317000)
        libXt.so.6 => /usr/X11R6/lib/libXt.so.6 (0xb72c7000)
        libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0xb71fc000)
        libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0xb71ee000)
        libvga.so.1 => /usr/lib/libvga.so.1 (0xb718e000)
        libaa.so.1 => /usr/lib/libaa.so.1 (0xb7173000)
        libpng12.so.0 => /usr/lib/libpng12.so.0 (0xb714d000)
        libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0xb712d000)
        libtiff.so.4 => /usr/lib/libtiff.so.4 (0xb70d9000)
        libmng.so.1 => /usr/lib/libmng.so.1 (0xb7074000)
        librt.so.1 => /lib/tls/librt.so.1 (0xb706c000)
        libXxf86vm.so.1 => /usr/X11R6/lib/libXxf86vm.so.1 (0xb7066000)
        /lib/ld-linux.so.2 (0xb7f8f000)
        libgvgd.so.2 => /usr/lib/graphviz/libgvgd.so.2 (0xb7017000)
        libexpat.so.1 => /usr/lib/libexpat.so.1 (0xb6ff7000)
        libneatogen.so.0 => /usr/lib/graphviz/libneatogen.so.0 (0xb6fdb000)
        libtwopigen.so.0 => /usr/lib/graphviz/libtwopigen.so.0 (0xb6fd7000)
        libfdpgen.so.0 => /usr/lib/graphviz/libfdpgen.so.0 (0xb6fcc000)
        libcircogen.so.0 => /usr/lib/graphviz/libcircogen.so.0 (0xb6fc5000)
        libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0xb6f0b000)
        libSM.so.6 => /usr/X11R6/lib/libSM.so.6 (0xb6f02000)
        libICE.so.6 => /usr/X11R6/lib/libICE.so.6 (0xb6eea000)
        libncurses.so.5 => /lib/libncurses.so.5 (0xb6ea6000)
        libslang.so.2 => /lib/libslang.so.2 (0xb6de4000)
        libgpm.so.1 => /usr/lib/libgpm.so.1 (0xb6dde000)
        liblcms.so.1 => /usr/lib/liblcms.so.1 (0xb6db0000)
        libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0xb6d81000)
        libpack.so.0 => /usr/lib/graphviz/libpack.so.0 (0xb6d7b000)
And I hope you are right. I did have to compile log4cpp with gcc 3.3, 4.0 would not do it and return a bunch of errors.

Posted: Sun Feb 05, 2006 12:26 pm
by harm
Alright forget it people. I give up. It tried to compile log4cpp with gcc4.0 and for that I had to remove a bug in Manipulator.h (I think), something with namespace. That worked(!). No matter anyway because GiGi now failed to configure with:

Code: Select all

scons: Reading SConscript files ...
Configuring for POSIX system...
Checking for C++ header file boost/shared_ptr.hpp... yes
Checking Boost version >= 1.33.1... yes
Looking for boost lib boost_signals... 
Checking for boost::signals::connection() in C++ library boost_signals... yes
Looking for boost lib boost_filesystem... 
Checking for boost::filesystem::initial_path() in C++ library boost_filesystem... yes
Boost configuration... ok
Checking for C header file pthread.h... yes
Checking for pthread_create() in C library pthread... yes
Checking for C header file GL/gl.h... yes
Checking for C header file GL/glu.h... yes
Checking for glBegin() in C library GL... yes
Checking for gluLookAt() in C library GLU... yes
Checking for sdl-config... yes
Checking SDL version >= 1.2.7... yes
Linking SDL/OpenGL test app... failed
SDL configuration... failed
I tried with_sdl and the like and that didn't work (never sure if I did that correctly ofcourse). I have

Code: Select all

ii  libsdl-image1.2                1.2.4-1                     image loading library for Simple DirectMedia
ii  libsdl-mixer1.2                1.2.6-1.1+b1                mixer library for Simple DirectMedia Layer 1
ii  libsdl-mixer1.2-dev            1.2.6-1.1+b1                development files for SDL1.2 mixer library
ii  libsdl1.2-dev                  1.2.9-0.1                   Simple DirectMedia Layer development files
ii  libsdl1.2debian                1.2.9-0.1                   Simple DirectMedia Layer
ii  libsdl1.2debian-all            1.2.9-0.1                   Simple DirectMedia Layer (with all available
ii  libsmpeg-dev                   0.4.5+cvs20030824-1.7       SDL MPEG Player Library - development files
ii  libsmpeg0                      0.4.5+cvs20030824-1.7       SDL MPEG Player Library - shared libraries

installed for the next daring debian user.

This whole trip through gdb/ldd/ldconfig and libraries was at the very least very educational. I wish I had more time to spend on learning this whole FO/GG/C++/SCONS thing.

PS does this boost restriction still holds (have to have 1.32)? [/code]

Posted: Sun Feb 05, 2006 5:19 pm
by harm
I really shouldn't have spend so much time on it but I finally compiled and ran it! The down side was I was behind a 800x600 monitor and freeorion requires 1024x768.... well that was a bit of a disappointment. I'll see if I can get something about that on the WIki.
The final solution was that I compiled log4cpp with g++3.3 and the rest with 4.0. That didn't really work and resulted in seg faults. But thank you guy for putting me on the right track!

Posted: Sun Feb 05, 2006 6:50 pm
by harm
I summarized my experiences from the past days in http://freeorion.org/index.php/User:Harm/Debian
I believe it will be helpful to others.

Thanks again for all the help.

Harm

Posted: Sun Feb 05, 2006 9:26 pm
by Tyreth
FreeOrion can run on 800x600, it's just that things may be missing. Edit config.xml to change the resolution.

Posted: Mon Feb 06, 2006 5:47 am
by tzlaine
harm wrote:Allright here is the output of ldd freeorion:

Code: Select all

        linux-gate.so.1 =>  (0xffffe000)
        libGiGiSDL.so => /usr/local/lib/libGiGiSDL.so (0xb7f79000)
        libSDL-1.2.so.0 => /usr/lib/libSDL-1.2.so.0 (0xb7ec5000)
        libGiGiNet.so => /usr/local/lib/libGiGiNet.so (0xb7ebd000)
        libIL.so.1 => /usr/lib/libIL.so.1 (0xb7db2000)
        libILU.so.1 => /usr/lib/libILU.so.1 (0xb7d99000)
        libILUT.so.1 => /usr/lib/libILUT.so.1 (0xb7d94000)
        libGiGi.so => /usr/local/lib/libGiGi.so (0xb7a01000)
        libboost_signals-gcc-mt-1_33_1.so.1.33.1 => /usr/lib/libboost_signals-gcc-mt-1_33_1.so.1.33.1 (0xb79ef000)
        libboost_filesystem-gcc-mt-1_33_1.so.1.33.1 => /usr/lib/libboost_filesystem-gcc-mt-1_33_1.so.1.33.1 (0xb79df000)
        libGL.so.1 => /usr/X11R6/lib/libGL.so.1 (0xb797c000)
        libGLU.so.1 => /usr/X11R6/lib/libGLU.so.1 (0xb78fd000)
        libpthread.so.0 => /lib/tls/libpthread.so.0 (0xb78ea000)
        libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0xb787d000)
        libz.so.1 => /usr/lib/libz.so.1 (0xb7869000)
        libfmod-3.75.so => /usr/local/lib/libfmod-3.75.so (0xb77ce000)
        libcdt.so.0 => /usr/lib/graphviz/libcdt.so.0 (0xb77c9000)
        libcommon.so.0 => /usr/lib/graphviz/libcommon.so.0 (0xb7770000)
        libdotgen.so.0 => /usr/lib/graphviz/libdotgen.so.0 (0xb7753000)
        libdotneato.so.0 => /usr/lib/graphviz/libdotneato.so.0 (0xb7750000)
        libgraph.so.0 => /usr/lib/graphviz/libgraph.so.0 (0xb7745000)
        libgvrender.so.0 => /usr/lib/graphviz/libgvrender.so.0 (0xb7741000)
        libpathplan.so.0 => /usr/lib/graphviz/libpathplan.so.0 (0xb7734000)
        liblog4cpp.so.4 => /usr/local/lib/liblog4cpp.so.4 (0xb7701000)
        libnsl.so.1 => /lib/tls/libnsl.so.1 (0xb76eb000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb760d000)
        libm.so.6 => /lib/tls/libm.so.6 (0xb75e7000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb75dc000)
        libc.so.6 => /lib/tls/libc.so.6 (0xb74a5000)
        libasound.so.2 => /usr/lib/libasound.so.2 (0xb73f2000)
        libartsc.so.0 => /usr/lib/libartsc.so.0 (0xb73ec000)
        libgmodule-2.0.so.0 => /usr/lib/libgmodule-2.0.so.0 (0xb73e7000)
        libdl.so.2 => /lib/tls/libdl.so.2 (0xb73e3000)
        libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0xb73df000)
        libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0xb735a000)
        libesd.so.0 => /usr/lib/libesd.so.0 (0xb7351000)
        libaudiofile.so.0 => /usr/lib/libaudiofile.so.0 (0xb732d000)
        libaudio.so.2 => /usr/lib/libaudio.so.2 (0xb7317000)
        libXt.so.6 => /usr/X11R6/lib/libXt.so.6 (0xb72c7000)
        libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0xb71fc000)
        libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0xb71ee000)
        libvga.so.1 => /usr/lib/libvga.so.1 (0xb718e000)
        libaa.so.1 => /usr/lib/libaa.so.1 (0xb7173000)
        libpng12.so.0 => /usr/lib/libpng12.so.0 (0xb714d000)
        libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0xb712d000)
        libtiff.so.4 => /usr/lib/libtiff.so.4 (0xb70d9000)
        libmng.so.1 => /usr/lib/libmng.so.1 (0xb7074000)
        librt.so.1 => /lib/tls/librt.so.1 (0xb706c000)
        libXxf86vm.so.1 => /usr/X11R6/lib/libXxf86vm.so.1 (0xb7066000)
        /lib/ld-linux.so.2 (0xb7f8f000)
        libgvgd.so.2 => /usr/lib/graphviz/libgvgd.so.2 (0xb7017000)
        libexpat.so.1 => /usr/lib/libexpat.so.1 (0xb6ff7000)
        libneatogen.so.0 => /usr/lib/graphviz/libneatogen.so.0 (0xb6fdb000)
        libtwopigen.so.0 => /usr/lib/graphviz/libtwopigen.so.0 (0xb6fd7000)
        libfdpgen.so.0 => /usr/lib/graphviz/libfdpgen.so.0 (0xb6fcc000)
        libcircogen.so.0 => /usr/lib/graphviz/libcircogen.so.0 (0xb6fc5000)
        libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0xb6f0b000)
        libSM.so.6 => /usr/X11R6/lib/libSM.so.6 (0xb6f02000)
        libICE.so.6 => /usr/X11R6/lib/libICE.so.6 (0xb6eea000)
        libncurses.so.5 => /lib/libncurses.so.5 (0xb6ea6000)
        libslang.so.2 => /lib/libslang.so.2 (0xb6de4000)
        libgpm.so.1 => /usr/lib/libgpm.so.1 (0xb6dde000)
        liblcms.so.1 => /usr/lib/liblcms.so.1 (0xb6db0000)
        libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0xb6d81000)
        libpack.so.0 => /usr/lib/graphviz/libpack.so.0 (0xb6d7b000)
And I hope you are right. I did have to compile log4cpp with gcc 3.3, 4.0 would not do it and return a bunch of errors.
We have a winner! This is the source of all your problems. When you call code built with GCC 4.x from code built with GCC 3.x, the results are undefined. You are seeing undefined the results. Notice that you are linking to libstdc++.so.5 AND libstdc++.so.6. This means no matter what you do, things will be buggy. You must link to one or the other. That means you need to build everything with GCC 3.3 or GCC 4.0, and cannot run code together compiled with a mixture of the two.

Posted: Mon Feb 06, 2006 7:04 am
by harm
Tyreth wrote:FreeOrion can run on 800x600, it's just that things may be missing. Edit config.xml to change the resolution.
Uhm, I don't have such a file in my FO root dir or subdirs.

Code: Select all

 
find . -name "*.xml"  
./default/buildings.xml
./default/credits.xml
./default/data/art/planets/atmospheres.xml
./default/data/art/planets/planets.xml
./default/empire_colors.xml
./default/specials.xml
./default/techs.xml
./default/planet_specials.xml

Posted: Mon Feb 06, 2006 7:10 am
by Geoff the Medio
harm wrote:
Tyreth wrote:FreeOrion can run on 800x600, it's just that things may be missing. Edit config.xml to change the resolution.
Uhm, I don't have such a file in my FO root dir or subdirs.
Run FO and then change an option in the Options menu, then exit the program. config.xml should be created.

I also think you used to be able to do

freeorion -g

to generate config.xml, but I'm not sure if this still works.

Posted: Mon Feb 06, 2006 5:42 pm
by harm
Probably you don't want to hear this but I strongly recommend NOT using the -g commandline option. It did not generate a config.xml and now FO seg faults whenever I push a button. BTW changing an option and exiting didn't create a config.xml either.

Running it again with -g does not seg fault, I just found out.

Posted: Mon Feb 06, 2006 5:54 pm
by harm
my bad. I expected it in my root dir of FO. But I see it is dropped in my personal home dir in .freeorion.