<div dir="ltr"><div>Hi,</div><div>I am trying to create an executable on Windows 10 with some Haskell->C++ bindings I wrote but having trouble getting rid of some runtime DLL dependencies. I'm currently compiling and linking using the MSYS2 and GHC environment that ships with Windows Stack installer but no matter what I do I end up with the following dependencies:</div><div>$ ldd <executable></div><div>        ...</div><div>        libwinpthread-1.dll => /c/Users/user/AppData/Local/Programs/stack/x86_64-windows/ghc-8.0.1/mingw/bin/libwinpthread-1.dll (0x64940000)</div><div>        libstdc++-6.dll => /c/Users/user/AppData/Local/Programs/stack/x86_64-windows/ghc-8.0.1/mingw/bin/libstdc++-6.dll (0x6fc40000)</div><div>        libgcc_s_seh-1.dll => /c/Users/user/AppData/Local/Programs/stack/x86_64-windows/ghc-8.0.1/mingw/bin/libgcc_s_seh-1.dll (0x61440000)</div><div><br></div><div>I have verified that the standalone versions of those libs are in available in stack install:</div><div>libstdc++:</div><div>  ../stack/x86_64-windows/ghc-8.0.1/mingw/lib/gcc/x86_64-w64-mingw32/5.2.0/libstdc++.a</div><div>  ../stack/x86_64-windows/ghc-8.0.1/mingw/lib/gcc/x86_64-w64-mingw32/5.2.0/libstdc++.dll.a</div><div>  ../stack/x86_64-windows/ghc-8.0.1/mingw/lib/gcc/x86_64-w64-mingw32/5.2.0/libgcc.a</div><div>libgcc:</div><div>  ../stack/x86_64-windows/ghc-8.0.1/mingw/lib/gcc/x86_64-w64-mingw32/5.2.0/libgcc_eh.a</div><div>  ../stack/x86_64-windows/ghc-8.0.1/mingw/lib/gcc/x86_64-w64-mingw32/5.2.0/libgcc_s.a</div><div>libpthread:</div><div>  ../stack/x86_64-windows/ghc-8.0.1/mingw/x86_64-w64-mingw32/lib/libpthread.a</div><div>  ../stack/x86_64-windows/ghc-8.0.1/mingw/x86_64-w64-mingw32/lib/libpthread.dll.a</div><div><br></div><div>I've unsuccessfully tried to link them into the executable using many combinations of `-optl-static`, `-optl-static-gcc`, and `-optl-static-stdc++` and also passing along these libraries "</div><div>raw" to the linker like:</div><div>`ghc-Options: -pgml g++ "-optl-Wl,--whole-archive" "-optl-Wl,-Bstatic" "-optl-Wl,-lstdc++" "-optl-Wl,-Bdynamic" "-optl-Wl,--no-whole-archive"</div><div><br></div><div>Short of shipping these DLL with the executable (which I'd really rather not do) I'm running out of ideas so any suggestions would be appreciated.</div><div>Thanks!</div><div>-deech</div></div>