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

Author Topic: game runs in debug mode, crashes in release (win 8 / gcc / code::blocks)  (Read 4707 times)

0 Members and 2 Guests are viewing this topic.

Septagon

  • Newbie
  • *
  • Posts: 7
    • View Profile
i recently released an SFML game which i build using visual studio.
(you can see the game here: http://lorenschmidt.itch.io/strawberrycubes)

i am working on a GCC build of the game in order to remove the dependency on microsoft's redistributables. i ran through the tutorial here: http://www.sfml-dev.org/tutorials/2.3/start-cb.php
afterward i made a few necessary syntax changes and got my game compiling using GCC. it is mostly working, but i have run into an oddly unsearchable problem: the game runs fine in debug mode, but on running in release mode it crashes

Error while reading shared library symbols for C:\Program Files (x86)\CodeBlocks\MinGW\bin\libstdc++-6.dll:
Error while reading shared library symbols for C:\Program Files (x86)\CodeBlocks\MinGW\bin\libstdc++-6.dll:
Error while reading shared library symbols for C:\Program Files (x86)\CodeBlocks\MinGW\bin\libstdc++-6.dll:
Error while reading shared library symbols for C:\Program Files (x86)\CodeBlocks\MinGW\bin\libstdc++-6.dll:
Error while reading shared library symbols for C:\Program Files (x86)\CodeBlocks\MinGW\bin\libstdc++-6.dll:
Error while reading shared library symbols for C:\Program Files (x86)\CodeBlocks\MinGW\bin\libstdc++-6.dll:
Error while reading shared library symbols for C:\Program Files (x86)\CodeBlocks\MinGW\bin\libstdc++-6.dll:
Error while reading shared library symbols for C:\Program Files (x86)\CodeBlocks\MinGW\bin\libstdc++-6.dll:
Error while reading shared library symbols for C:\Program Files (x86)\CodeBlocks\MinGW\bin\libstdc++-6.dll:
Error while reading shared library symbols for C:\Program Files (x86)\CodeBlocks\MinGW\bin\libstdc++-6.dll:
Error while reading shared library symbols for C:\Program Files (x86)\CodeBlocks\MinGW\bin\libstdc++-6.dll:
Error while reading shared library symbols for C:\Program Files (x86)\CodeBlocks\MinGW\bin\libstdc++-6.dll:
Error while reading shared library symbols for C:\Program Files (x86)\CodeBlocks\MinGW\bin\libstdc++-6.dll:
Error while reading shared library symbols for C:\Program Files (x86)\CodeBlocks\MinGW\bin\libstdc++-6.dll:
Error while reading shared library symbols for C:\Program Files (x86)\CodeBlocks\MinGW\bin\libstdc++-6.dll:
Error while reading shared library symbols for C:\Program Files (x86)\CodeBlocks\MinGW\bin\libstdc++-6.dll:
Error while reading shared library symbols for C:\Program Files (x86)\CodeBlocks\MinGW\bin\libstdc++-6.dll:
Error while reading shared library symbols for C:\Program Files (x86)\CodeBlocks\MinGW\bin\libstdc++-6.dll:
Error while reading shared library symbols for C:\Program Files (x86)\CodeBlocks\MinGW\bin\libstdc++-6.dll:
Error while reading shared library symbols for C:\Program Files (x86)\CodeBlocks\MinGW\bin\libstdc++-6.dll:
Error while reading shared library symbols for C:\Program Files (x86)\CodeBlocks\MinGW\bin\libstdc++-6.dll:
Error while reading shared library symbols for C:\Program Files (x86)\CodeBlocks\MinGW\bin\libstdc++-6.dll:
Error while reading shared library symbols for C:\Program Files (x86)\CodeBlocks\MinGW\bin\libstdc++-6.dll:
Error while reading shared library symbols for C:\Program Files (x86)\CodeBlocks\MinGW\bin\libstdc++-6.dll:
Error while reading shared library symbols for C:\Program Files (x86)\CodeBlocks\MinGW\bin\libstdc++-6.dll:
Error while reading shared library symbols for C:\Program Files (x86)\CodeBlocks\MinGW\bin\libstdc++-6.dll:
Error while reading shared library symbols for C:\Program Files (x86)\CodeBlocks\MinGW\bin\libstdc++-6.dll:
Program received signal SIGSEGV, Segmentation fault.
In ?? () ()


the dll mentioned is at the specified location, so i suspect it is perhaps a version mismatch? i am using code::blocks for this build. as recommended in the tutorial, i am using SFML-2.3-windows-gcc-4.7.1-tdm-32-bit. any suggestions are welcome- i have been in a lengthy conversation with google about this and have yet to turn up anything fruitful.

Septagon

  • Newbie
  • *
  • Posts: 7
    • View Profile
in case this isn't 100% clear, the game builds with no errors in release mode, and only crashes when it runs.

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
If the library has been built by a different compiler, yes, there will be some (read many) problems. Make sure you're downloading and using the correct type (or build it yourself on your own setup - recommended).

Although this isn't a part of your error, are you aware that you can statically link Visual Studio's necessary run-time files?
See here (stack overflow question) and here (MSDN).
I don't think they're a problem though as installing them is quite standard for a Windows user.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Also, switching compiler does not remove the fact that a runtime library is needed - it's just a different one.
If you build with gcc and link dynamically you will have to ship its runtime lib.
So, you are not changing anything, in that regard, by switching compiler (except exchanging one runtime lib for another).
« Last Edit: July 18, 2015, 04:57:07 pm by Jesper Juhl »

Septagon

  • Newbie
  • *
  • Posts: 7
    • View Profile
Hapax-
thanks for bringing up the possibility of statically linking to the runtime library. i'll try that, it would definitely be preferable.

interesting- do you know how is it that the libstdc dll it's using in debug mode works (which is the one which came with code::blocks), while the one it uses when i'm not debugging doesn't? and perhaps more to the point, how can i find out which version it needs?

Jesper Juhl-
thank you. right, the issue i'm running into is not that there is a dependency, but that microsoft has some rather strict requirements about how to distribute their runtime (they don't want you to just stick the required .dll in the folder, they want you to install their redistributable). it would be nice to not have to worry about that.

Daid

  • Newbie
  • *
  • Posts: 29
    • View Profile
Most likely the problem isn't SFML related at all, but just some uninitialized pointer or memory on your side of the code. As stack&memory layout is different in debug vs release, you'll end up with different values.

Or you could be overflowing a buffer, which corrupts the heap easier in release then debug.

Compile with -g, to add debug symbols, even in release, and you might get a better stacktrace then effectively nothing.

Septagon

  • Newbie
  • *
  • Posts: 7
    • View Profile
Daid-
thanks, that's interesting (and seems fairly likely). i have switched to compiling with -g, but unfortunately it's giving me exactly the same errors. but i think that's a fruitful set of problems to look into- i'll go through my source and look for culprits.

GalakTozawr

  • Newbie
  • *
  • Posts: 17
  • You must create more game that oneself.
    • View Profile
    • My SFML lesson for russian language
    • Email
You must build sfml from sourse. I build from source and runung, no warning. This is error from old version gcc.

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Or maybe you are mixing debug build of your app with release build of SFML or vice versa. Or maybe you are mixing 32 and 64bit. Or maybe you are not using the (exact) same compiler for your app as was used to build SFML.
These mixups happen all the time and they always cause trouble.
Easiest solution is usually just to build SFML yourself (for both debug and release) with the exact same compiler that you use for your own application and then make sure you link to the correct (debug/release) version of the lib to match your app build.

 

anything