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

Author Topic: libgcc_s_dw2.dll is missing  (Read 6268 times)

0 Members and 1 Guest are viewing this topic.

MaxPain

  • Newbie
  • *
  • Posts: 19
    • View Profile
libgcc_s_dw2.dll is missing
« on: February 13, 2021, 07:15:20 am »
Hello everyone!

I use SFML on MacOS and I want to compile it for Windows. I installed MinGW via HomeBrew and compile my program, but when I try to start it on Windows there is an error "libgcc_s_dw2.dll is missing".

I have already used -static, -static-libgcc and -static-libstd++ options. What is wrong? How can I fix it?
Maybe I should just download this dll manually and put in my execution's dir, but I think it is not the best way.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10815
    • View Profile
    • development blog
    • Email
Re: libgcc_s_dw2.dll is missing
« Reply #1 on: February 13, 2021, 01:04:00 pm »
You also need to build SFML with the mentioned static options, otherwise SFML will still rely on the dynamic runtime libraries.
Alternatively, you can just ship your application with the missing DLL from the MinGW installation (check the bin directory).
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

MaxPain

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: libgcc_s_dw2.dll is missing
« Reply #2 on: February 13, 2021, 03:44:00 pm »
There is no libgcc_s_dw2 in MinGW bin files, probably because its version for MacOS.

And I did not understand what it means to static build SFML, after all, I'm already doing it.

"PATH"/i686-w64-mingw32-g++ main.cpp   -L "PATH"/SFML-2.5.1-win32/lib -o test.exe -static -lsfml-audio -lsfml-graphics -lsfml-window -lsfml-system -I "PATH"/SFML-2.5.1-win32/include
 

The folder is named so because this is the version for Windows32

One more thing: if I use -lsfml-*-s to link it static, it says "Undefined reference to *Some SFML thing*", if I read it correctly, it does not find the code itself.
« Last Edit: February 13, 2021, 03:45:37 pm by MaxPain »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10815
    • View Profile
    • development blog
    • Email
Re: libgcc_s_dw2.dll is missing
« Reply #3 on: February 13, 2021, 04:00:55 pm »
Code: [Select]
[quote author=MaxPain link=topic=27887.msg175352#msg175352 date=1613227440]
There is no libgcc_s_dw2 in MinGW bin files, probably because its version for MacOS.
Maybe it's not in the bin directory, but it should exist somewhere, since it's linking it. Unless they provide an additional runtime package or similar.

And I did not understand what it means to static build SFML, after all, I'm already doing it.
You're link SFML and not building it. In order to build SFML, you need to get SFML's source code, generate a make file with CMake and build it.

One more thing: if I use -lsfml-*-s to link it static, it says "Undefined reference to *Some SFML thing*", if I read it correctly, it does not find the code itself.
When linking SFML statically, you also need to link SFML's dependencies (freetype, vorbis, flac, ogg, etc).

Personally, I highly recommend to build natively on Windows rather than cross-compilation, as it's usually easier to solve issues on a native setup rather than in a cross-compilation.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

MaxPain

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: libgcc_s_dw2.dll is missing
« Reply #4 on: February 14, 2021, 09:42:10 am »
I downloaded source code, built it with BUILD_SHARED_LIBS=FALSE and did this

i686-w64-mingw32-g++ main.cpp -o test.exe -static -I SFML-2.5.1/include -L SFML-2.5.1/lib -L SFML-2.5.1/extlibs/libs-mingw/x86 -lopengl32 -lgdi32 -lwinmm -lfreetype -lflac -lvorbisenc -lvorbisfile -lvorbis -logg -lws2_32 -lsfml-audio-s -lsfml-graphics-s -lsfml-system-s -lsfml-window-s

But it still says undefined reference, and I don't see gdi32, winmm, opengl32 and ws2_32 in extlibs folder.

I realized that it is more convenient to build on Windows, but I want to try because I'm the beginner.
« Last Edit: February 14, 2021, 09:44:04 am by MaxPain »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10815
    • View Profile
    • development blog
    • Email
Re: libgcc_s_dw2.dll is missing
« Reply #5 on: February 14, 2021, 04:46:31 pm »
But it still says undefined reference, and I don't see gdi32, winmm, opengl32 and ws2_32 in extlibs folder.
Those are system libs and should come with the compiler as well.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

MaxPain

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: libgcc_s_dw2.dll is missing
« Reply #6 on: February 16, 2021, 01:15:13 pm »
Alright, I did everything you said, I link every single library and even tried to build it on Windows but it still says
"Undefined reference". What I have to do?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10815
    • View Profile
    • development blog
    • Email
Re: libgcc_s_dw2.dll is missing
« Reply #7 on: February 16, 2021, 07:07:04 pm »
Well "undefined reference" is not just a magic set of words, but it's an actual error message that tells you exactly which references were unable to resolve while linking.

There can be various things, so you need to provide the detailed errors.

  • Missing source file
  • Wrong header include
  • Linked incompatible/different runtimes
  • Missing dependency
  • Wrong link order
  • Linking static without having SFML_STATIC defined
  • Linking dynamic while having SFML_STATIC defined
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

MaxPain

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: libgcc_s_dw2.dll is missing
« Reply #8 on: February 20, 2021, 04:46:23 pm »
Alright, I almost done it

i686-w64-mingw32-g++ main.cpp -DSFML_STATIC  -static -L SFML-2.5.1-win32/lib -o test.exe
 -lws2_32 -lopengl32 -lgdi32 -lwinmm -lfreetype -lflac -lvorbisenc -lvorbisfile -lvorbis -logg -lopenal32 -lsfml-audio-s -lsfml-graphics-s -lsfml-window-s -lsfml-system-s
 -I SFML-2.5.1-win32/include -v

And I get something like that

/usr/local/Cellar/mingw-w64/8.0.0_3/toolchain-i686/bin/i686-w64-mingw32-ld: SFML-2.5.1-win32/lib/libsfml-window-s.a(JoystickImpl.cpp.obj):JoystickImpl.cpp:(.text+0x2d79): undefined reference to `_imp__joyGetPosEx@8'
/usr/local/Cellar/mingw-w64/8.0.0_3/toolchain-i686/bin/i686-w64-mingw32-ld: SFML-2.5.1-win32/lib/libsfml-window-s.a(JoystickImpl.cpp.obj):JoystickImpl.cpp:(.eh_frame+0x83): undefined reference to `__gxx_personality_v0'
/usr/local/Cellar/mingw-w64/8.0.0_3/toolchain-i686/bin/i686-w64-mingw32-ld: SFML-2.5.1-win32/lib/libsfml-window-s.a(Joystick.cpp.obj):Joystick.cpp:(.text+0x192): undefined reference to `_Unwind_Resume'
/usr/local/Cellar/mingw-w64/8.0.0_3/toolchain-i686/bin/i686-w64-mingw32-ld: SFML-2.5.1-win32/lib/libsfml-window-s.a(Joystick.cpp.obj):Joystick.cpp:(.eh_frame+0x11b): undefined reference to `__gxx_personality_v0'

All the libraries are in place

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10815
    • View Profile
    • development blog
    • Email
Re: libgcc_s_dw2.dll is missing
« Reply #9 on: February 20, 2021, 07:47:06 pm »
Since SFML depends on all the other libraries, SFML needs to be listed before the other libraries.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

MaxPain

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: libgcc_s_dw2.dll is missing
« Reply #10 on: February 21, 2021, 06:36:41 am »
Right?

/usr/local/Cellar/mingw-w64/8.0.0_3/bin/i686-w64-mingw32-g++ main.cpp -DSFML_STATIC  -static  -L SFML-2.5.1-win32/lib -o test.exe -lsfml-audio-s -lsfml-graphics-s -lsfml-window-s -lsfml-system-s -lws2_32 -lopengl32 -lgdi32 -lwinmm -lfreetype -lflac -lvorbisenc -lvorbisfile -lvorbis -logg -lopenal32 -I SFML-2.5.1-win32/include -v
 

But it doesn't work.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10815
    • View Profile
    • development blog
    • Email
Re: libgcc_s_dw2.dll is missing
« Reply #11 on: February 21, 2021, 01:37:04 pm »
And what's the error now? :)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

MaxPain

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: libgcc_s_dw2.dll is missing
« Reply #12 on: February 22, 2021, 05:38:36 am »
Same :-\

Mostly "undefined reference to Unwind_Resume"
« Last Edit: February 22, 2021, 05:41:02 am by MaxPain »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10815
    • View Profile
    • development blog
    • Email
Re: libgcc_s_dw2.dll is missing
« Reply #13 on: February 22, 2021, 08:11:58 am »
Did you build SFML yourself? As the download page says in the prominently placed red box, compilers need to match 100% and we currently don't have any builds for the compiler you're using.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

MaxPain

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: libgcc_s_dw2.dll is missing
« Reply #14 on: February 22, 2021, 09:21:27 am »
I am using the only MinGW that I could download for Mac as I know version is 8.0.0_3 and GCC is 10.2.0.
On one of SFML pages I read 32bit version will be able to run on 64bit architecture so I decided to compile 32bit version, I tried to link libraries from SFML source code, but compiler said "unrecognized file format" apparently because it is 64bit then I need 32bit, that is why I downloaded a SFML-32bit for MinGW and now I have these errors.

I hardly will get MinGW version indicated on SFML download page.
« Last Edit: February 22, 2021, 09:23:53 am by MaxPain »