6

I finally made it to install Haskell SDL bindings on Windows. Using this:

> $env:Path += ";C:\SDL;C:\SDL\bin;C:\SDL\include;C:\SDL\lib"
> cabal install SDL --extra-include-dirs="C:\SDL\include" --extra-lib-dirs="C:\SDL\lib"

This works, as long as Cygwin is installed for the configure script. However, I wrote a tiny test script:

import Graphics.UI.SDL as SDL
import Control.Monad (void)
import Control.Exception (bracket_)

main = bracket_ (SDL.init [InitEverything]) quit $ do
  screen <- setVideoMode 800 600 0 []
  SDL.flip screen
  void $ waitEvent

Trying this now gives me this error message:

*Main> :main
Loading package SDL-0.6.4 ... <interactive>: mingw32: Cannot find specified module.
can't load .so/.DLL for: mingw32.dll (addDLL: could not load DLL)

Now I was looking for that mingw32.dll but I couldn't find it on my computer, though I have MinGW32 installed. Does anyone have had any experience here?

Using SDL-0.6.4, GHC 7.4.2 from Haskell Platform 2012.4.0.0. Windows 7 64-Bit.

ADDITION: I have now also tried it in the way A Haskell Adventure In Windows recommends, and that has the very same result.

Lanbo
  • 15,118
  • 16
  • 70
  • 147

2 Answers2

1

It may be a 64 vs. 32 bit issue. Try copying that .dll to:

  • 64-bit version of Windows: copy to c:\windows\syswow64
  • 32-bit version of Windows: copy to c:\windows\system32

That helped me with FTGL - see here

sinelaw
  • 16,205
  • 3
  • 49
  • 80
  • But there is no `mingw32.dll` anywhere on my system. Googling that brought no results as well. I don't think a `mingw32.dll` exists at all. – Lanbo Apr 15 '13 at 08:14
  • @LambdaDusk, do you have mingw, msys or msysgit installed? If yes they may be interfering with your cygwin's build setup – sinelaw Apr 15 '13 at 11:09
  • @LambdaDusk actually now i just noticed that the instructions you're using are based on a mingw build of the sdl dev libs. You should either remove cygwin and install mingw instead, or remove the mingw-based sdl and install a cygwin one, or build it yourself (http://www.libsdl.org/extras/win32/cygwin/README.txt) – sinelaw Apr 15 '13 at 11:15
  • I will have to do the second option since I can't install haskell SDL without cygwin. – Lanbo Apr 15 '13 at 11:34
  • @LambdaDusk, the instructions you linked to indicate *no* cygwin. Am I missing something? Why do you need cygwin? – sinelaw Apr 15 '13 at 11:51
  • Because without cygwin, the `configure` script in the SDL package can't run. Anyway, SDL won't install via cygwin too, because my Windows user name has a space in it... – Lanbo Apr 15 '13 at 12:12
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/28242/discussion-between-lambda-dusk-and-sinelaw) – Lanbo Apr 15 '13 at 12:15
1

I used MSYS/MinGW to build, and I was having the exact same problem. After fiddling around I found that the flag -lmingw32 (in the file sdl-config) is being used, and this seems to imply mingw32.dll. I simple remove this flagged, and everything worked.

Pedro Rodrigues
  • 1,732
  • 11
  • 17