5

I’m trying to install SDL within cabal for Haskell, in MinGW, but I got some problems. cabal can’t find the C library, and I don’t know why. Here some info:

  • I have downloaded both the dev and runtime library of the SDL1.2 ;
  • For the dev version, I make native it: it’s installed in /usr/include/SDL and /usr/lib ;
  • I tried a cabal install SDL, it failed because it can’t find both the header file and the lib ;
  • Then, I give it another try with cabal install SDL --extra-include-dirs=/usr/include/SDL --extra-lib-dirs=/usr/lib. It finds the header file but still not the lib ;
  • I copied the runtime library SDL.dll in /usr/lib, still have the same trouble ;
  • Finally, I added /usr/lib to both the PATH and LD_LIBRARY_PATH, still can’t find that @!#* C lib.

Do you have an idea?

Martin G
  • 17,357
  • 9
  • 82
  • 98
phaazon
  • 1,972
  • 15
  • 21
  • This may be "superstition" as I've never found out a reason for it, but supplying --extra-include-dirs and --extra-lib-dirs seems to want Windows style full paths when I build with MinGW / SYS and "runhaskell Setup ..." (I don't use cabal install). For SDL I edit the cabal file changing these fields "Include-Dirs: C:\msys\1.0\include\SDL" and "Extra-Lib-Dirs: C:\msys\1.0\lib" – stephen tetley Jan 04 '13 at 16:46
  • @stephentetley: The most likely reason for that sort of behavior is when GHC and/or cabal are Windows applications that expect Windows behavior, but you invoke them from a pseudo-unix environment that translates stuff for the benefit of applications that expect a unix-like environment, at which point boundless hilarity ensues as you try to figure out which style of path works where. – C. A. McCann Jan 04 '13 at 17:31
  • Last time I checked, this worked: http://www.animal-machine.com/blog/2010/04/a-haskell-adventure-in-windows/ – Alp Mestanogullari Jan 04 '13 at 23:28
  • @AlpMestanogullari I tried to follow the link you gave me, the problem remains the same: ghc can’t find the C lib. The weird thing is that I *see* the `libSDL.dll.a` and `libSDLmain.a`, I correctly set the `Extra-Libraries`, `Include-Dirs` and `Extra-Lib-Dirs` though… – phaazon Jan 07 '13 at 09:05
  • How come you go through all these /usr/* dirs? Litterally dumbly following that tutorial worked for me. What exact error message do you get from cabal/ghc? – Alp Mestanogullari Jan 07 '13 at 11:55
  • It fails to pass the step just after the edition of the SDL.cabal file. I run `runghc Setup.lhs configure`, and it says that there’s `Missing C lib: SDL.dll, SDLmain`. – phaazon Jan 07 '13 at 14:10
  • I spent much time struggling this problem too. Only switching to SFML did the thing for me. – user3974391 Nov 12 '13 at 21:06

0 Answers0