Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: [Solved]sf::String::String() Segfault after switching to DW2 (SFML2-RC)  (Read 2708 times)

0 Members and 1 Guest are viewing this topic.

Omegaclawe

  • Newbie
  • *
  • Posts: 8
    • View Profile
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, 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? :-\
« Last Edit: September 07, 2012, 12:01:43 am by Omegaclawe »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10801
    • View Profile
    • development blog
    • Email
Re: sf::String::String() Segfault after switching to DW2 (SFML2-RC)
« Reply #1 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)?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Omegaclawe

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: sf::String::String() Segfault after switching to DW2 (SFML2-RC)
« Reply #2 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)

victorlevasseur

  • Full Member
  • ***
  • Posts: 206
    • View Profile
Re: sf::String::String() Segfault after switching to DW2 (SFML2-RC)
« Reply #3 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.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: sf::String::String() Segfault after switching to DW2 (SFML2-RC)
« Reply #4 on: September 06, 2012, 11:20:49 am »
What's your version of gcc? You should show us the full output of "gcc -v".
Laurent Gomila - SFML developer

Omegaclawe

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: sf::String::String() Segfault after switching to DW2 (SFML2-RC)
« Reply #5 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.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10801
    • View Profile
    • development blog
    • Email
Re: sf::String::String() Segfault after switching to DW2 (SFML2-RC)
« Reply #6 on: September 06, 2012, 11:43:42 am »
gcc version 4.7.0 (GCC)
With 4.7 you have to recompile SFML. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: sf::String::String() Segfault after switching to DW2 (SFML2-RC)
« Reply #7 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.
Laurent Gomila - SFML developer

Omegaclawe

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: sf::String::String() Segfault after switching to DW2 (SFML2-RC)
« Reply #8 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.