[Haskell-cafe] Haskell with C++: removing runtime dependencies on Windows 10.

aditya siram aditya.siram at gmail.com
Thu Jan 19 22:16:48 UTC 2017


Hi,
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:
$ ldd <executable>
        ...
        libwinpthread-1.dll =>
/c/Users/user/AppData/Local/Programs/stack/x86_64-windows/ghc-8.0.1/mingw/bin/libwinpthread-1.dll
(0x64940000)
        libstdc++-6.dll =>
/c/Users/user/AppData/Local/Programs/stack/x86_64-windows/ghc-8.0.1/mingw/bin/libstdc++-6.dll
(0x6fc40000)
        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)

I have verified that the standalone versions of those libs are in available
in stack install:
libstdc++:

../stack/x86_64-windows/ghc-8.0.1/mingw/lib/gcc/x86_64-w64-mingw32/5.2.0/libstdc++.a

../stack/x86_64-windows/ghc-8.0.1/mingw/lib/gcc/x86_64-w64-mingw32/5.2.0/libstdc++.dll.a

../stack/x86_64-windows/ghc-8.0.1/mingw/lib/gcc/x86_64-w64-mingw32/5.2.0/libgcc.a
libgcc:

../stack/x86_64-windows/ghc-8.0.1/mingw/lib/gcc/x86_64-w64-mingw32/5.2.0/libgcc_eh.a

../stack/x86_64-windows/ghc-8.0.1/mingw/lib/gcc/x86_64-w64-mingw32/5.2.0/libgcc_s.a
libpthread:

../stack/x86_64-windows/ghc-8.0.1/mingw/x86_64-w64-mingw32/lib/libpthread.a

../stack/x86_64-windows/ghc-8.0.1/mingw/x86_64-w64-mingw32/lib/libpthread.dll.a

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 "
raw" to the linker like:
`ghc-Options: -pgml g++ "-optl-Wl,--whole-archive" "-optl-Wl,-Bstatic"
"-optl-Wl,-lstdc++" "-optl-Wl,-Bdynamic" "-optl-Wl,--no-whole-archive"

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.
Thanks!
-deech
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20170119/bea4af64/attachment.html>


More information about the Haskell-Cafe mailing list