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.
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?
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:
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.
(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)
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.
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:
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
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]
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!
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.
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.