SFML community forums

Help => General => Topic started by: Omegaclawe on September 06, 2012, 12:14:21 am

Title: [Solved]sf::String::String() Segfault after switching to DW2 (SFML2-RC)
Post by: Omegaclawe on September 06, 2012, 12:14:21 am
After a few months of not coding due to... other obligations, I decided to pick up an old project on a new computer... took me a while to figure out that Code::blocks was using it's own Mingw instead of the one I installed, but I got it switched eventually, only to discover, according to this thread (http://en.sfml-dev.org/forums/index.php?topic=7613.0), that I had the wrong version. Switched to DW2, and it compiled fine... but...

Now, whenever I try to run the default constructor for sf::String, I get a segfault. Redid a fresh install of SFML, manually deleted all build artifacts, and rebuilt from scratch... still the same problem. Also restarted Code::blocks as I did so, for good measure. No luck. Any idea what I might have missed? :-\
Title: Re: sf::String::String() Segfault after switching to DW2 (SFML2-RC)
Post by: eXpl0it3r on September 06, 2012, 12:16:01 am
Are you mixing debug and release modes of your application and the library (e.g. you compile for debug but use the release libraries (= without the sufix -d)?
Title: Re: sf::String::String() Segfault after switching to DW2 (SFML2-RC)
Post by: Omegaclawe on September 06, 2012, 02:28:05 am
While I was mixing them, fixing that does not seem to help much... does give me a bit more info on the stack trace, though... thought I'd post the relevant bits here:

Code: [Select]
#0 00000000 0x005454ea in std::basic_string<unsigned int, std::char_traits<unsigned int>, std::allocator<unsigned int> >::_Alloc_hider::_Alloc_hider(this=0x411598 <__tcf_6() (d:/programmes/mingw-4.5-dw2/bin/../lib/gcc/mingw32/4.5.2/include/c++/bits/basic_string.h:261)
#1 00000000 0x00546595 in std::basic_string<unsigned int, std::char_traits<unsigned int>, std::allocator<unsigned int> >::basic_string(this=0x411598 <__tcf_6() (d:/programmes/mingw-4.5-dw2/bin/../lib/gcc/mingw32/4.5.2/include/c++/bits/basic_string.h:425)
#2 00000000 0x004df325 in sf::String::String(this=0x411598 <__tcf_6() (D:\developpement\sfml-master\src\SFML\System\String.cpp:41)
Title: Re: sf::String::String() Segfault after switching to DW2 (SFML2-RC)
Post by: victorlevasseur on September 06, 2012, 07:02:30 am
Hello,

If you use a particular version of MinGW (e.g. not 4.6.x), you have to recompile the library.
Title: Re: sf::String::String() Segfault after switching to DW2 (SFML2-RC)
Post by: Laurent on September 06, 2012, 11:20:49 am
What's your version of gcc? You should show us the full output of "gcc -v".
Title: Re: sf::String::String() Segfault after switching to DW2 (SFML2-RC)
Post by: Omegaclawe on September 06, 2012, 11:40:23 am
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.7.0/lto-wrapper.exe
Target: mingw32
Configured with: ../gcc-4.7.0/configure --enable-languages=c,c++,ada,fortran,obj
c,obj-c++ --disable-sjlj-exceptions --with-dwarf2 --enable-shared --enable-libgo
mp --disable-win32-registry --enable-libstdcxx-debug --disable-build-poststage1-
with-cxx --enable-version-specific-runtime-libs --build=mingw32 --prefix=/mingw
Thread model: win32
gcc version 4.7.0 (GCC)

I guess I'll try recompiling SFML when I get back tonight... not really that hard, but... it's a step I would have preferred to avoid.
Title: Re: sf::String::String() Segfault after switching to DW2 (SFML2-RC)
Post by: eXpl0it3r on September 06, 2012, 11:43:42 am
gcc version 4.7.0 (GCC)
With 4.7 you have to recompile SFML. ;)
Title: Re: sf::String::String() Segfault after switching to DW2 (SFML2-RC)
Post by: Laurent on September 06, 2012, 12:27:40 pm
Yep, someone reported that it's because gcc 4.7 enables C++11 mode by default. I guess it makes the standard library binary incompatible with builds that have it disabled.
Title: Re: sf::String::String() Segfault after switching to DW2 (SFML2-RC)
Post by: Omegaclawe on September 07, 2012, 12:01:25 am
Yeah... recompiling worked. Perhaps a big "for GCC versions <= 4.6" next to the download link would help, too. :P

Anyway... problem solved.