8

I am compiling my C++ project in the following way:

/usr/bin/i686-w64-mingw32-g++ -g -std=c++0x -Wall -I /home/bluszcz/dev/win64/SFML-2.1/include -L /home/bluszcz/dev/win64/SFML-2.1/lib -static-libgcc -static-libstdc++ -static -O4 -c src/game.cpp -o src/game.a -lsfml-graphics -lsfml-window -lsfml-system -lsfml-audio

However, when I try to run my exe file I am getting an error about missing DLL files:

bluszcz@zendo ~/dev/win32/builds/magicwizard $ wine mw.exe 
err:module:import_dll Library libgcc_s_dw2-1.dll (which is needed by L"Z:\\home\\bluszcz\\dev\\win32\\builds\\magicwizard\\sfml-system-2.dll") not found
err:module:import_dll Library libgcc_s_sjlj-1.dll (which is needed by L"Z:\\home\\bluszcz\\dev\\win32\\builds\\magicwizard\\libstdc++-6.dll") not found
err:module:import_dll Library libwinpthread-1.dll (which is needed by L"Z:\\home\\bluszcz\\dev\\win32\\builds\\magicwizard\\libstdc++-6.dll") not found
err:module:import_dll Library libstdc++-6.dll (which is needed by L"Z:\\home\\bluszcz\\dev\\win32\\builds\\magicwizard\\sfml-system-2.dll") not found
err:module:import_dll Library sfml-system-2.dll (which is needed by L"Z:\\home\\bluszcz\\dev\\win32\\builds\\magicwizard\\sfml-audio-2.dll") not found
err:module:import_dll Library libgcc_s_dw2-1.dll (which is needed by L"Z:\\home\\bluszcz\\dev\\win32\\builds\\magicwizard\\sfml-audio-2.dll") not found
err:module:import_dll Library libgcc_s_sjlj-1.dll (which is needed by L"Z:\\home\\bluszcz\\dev\\win32\\builds\\magicwizard\\libstdc++-6.dll") not found
err:module:import_dll Library libwinpthread-1.dll (which is needed by L"Z:\\home\\bluszcz\\dev\\win32\\builds\\magicwizard\\libstdc++-6.dll") not found
err:module:import_dll Library libstdc++-6.dll (which is needed by L"Z:\\home\\bluszcz\\dev\\win32\\builds\\magicwizard\\sfml-audio-2.dll") not found

I have compiled using static options - so why it asks for libgcc_s_dw2-1.dll for example?

Also, I copied some files there, but the application still doesn't see them.

bluszcz@zendo ~/dev/win32/builds/magicwizard $ ls *dll
libsndfile-1.dll  sfml-audio-2.dll     sfml-graphics-d-2.dll  sfml-system-2.dll    sfml-window-d-2.dll
libstdc++-6.dll   sfml-audio-d-2.dll   sfml-network-2.dll     sfml-system-d-2.dll
openal32.dll      sfml-graphics-2.dll  sfml-network-d-2.dll   sfml-window-2.dll
bluszcz@zendo ~/dev/win32/builds/magicwizard $

And some files, like libgcc_s_dw2-1.dll, don't exist on my file system at all...

To summarize:

  1. Why does my application not see the missing files?
  2. How to compile in static way with mingw32?
  3. How to get the missing files?

I use this version of sfml library to compile it: http://www.sfml-dev.org/download/sfml/2.1/SFML-2.1-windows-gcc-4.7-mingw-32bits.zip

Marc.2377
  • 7,807
  • 7
  • 51
  • 95
bluszcz
  • 4,054
  • 4
  • 33
  • 52
  • You can set `WINEPATH` to point to the folder with the DLLs. For example: `WINEPATH=/usr/local/x86_64-w64-mingw32/bin/;/usr/lib/gcc/x86_64-w64-mingw32/10-win32/` – Daniel Stevens Nov 30 '21 at 02:07

4 Answers4

1

The missing dll's can simply be added to your WINEPATH before running your program with wine, i.e.

export WINEPATH="/usr/x86_64-w64-mingw32/lib;/usr/lib/gcc/x86_64-w64-mingw32/7.3-posix"

!Note, your paths might be slightly different depending on the mingw version you are using.

Wout_bb
  • 387
  • 4
  • 9
0

Answering only the last of the three question:

About the standards libraries, it worked for me to copy them from the mingw folder:

cp /usr/lib/gcc/i686-w64-mingw32/5.3-win32/libstdc++-6.dll ./

However, when I copied from the wrong directory according to my build (e.g. /usr/lib/gcc/x86_64-w64-mingw32/5.3-posix/libstdc++-6.dll) I still had the same error while the file with the exact same name was here.

FloFu
  • 609
  • 1
  • 5
  • 21
0

On my Fedora 26 after installing mingw64-gcc and mingw64-gcc-g++:

[leo@pc]$ locate libgcc_s_seh-1.dll
/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libgcc_s_seh-1.dll
[leo@pc]$ locate libstdc++-6.dll
/usr/x86_64-w64-mingw32/sys-root/mingw/bin/libstdc++-6.dll
[leo@pc]$ 

If I copy dll's and run wine with generated a.out.exe it works.

leanid.chaika
  • 2,143
  • 2
  • 27
  • 30
0

Probably your application isn't seeing the files because it's configured like that, and you don't need to add tags like -static to the command.

For compiling static libraries, you must add -s, like -lsfml-window-s -lsfml-system-s

libgcc_s_dw2-1.dll is just inside bin folder, on latest MinGW releases.

If there are missing dlls, there's probably a version incompatibility.

Brhaka
  • 1,622
  • 3
  • 11
  • 31