Anyone have problems with cabal and SDL?

When I use Cabal to get any program which depends on the SDL library, this is the error I get. " checking for sdl-config... no checking for sdl11-config... no configure: error: *** SDL not found! Get SDL from www.libsdl.org. If you already installed it, check it's in the path. If problem remains, please send a mail to the address that appears in ./configure --version indicating your platform, the version of configure script and the problem. cabal: Error: some packages failed to install: Raincat-1.1.1.2 depends on SDL-0.6.2 which failed to install. SDL-0.6.2 failed during the configure step. The exception was: exit: ExitFailure 1 SDL-image-0.6.1 depends on SDL-0.6.2 which failed to install. SDL-mixer-0.6.1 depends on SDL-0.6.2 which failed to install. " I have SDL 1.2.14 (correctly) installed on my system. I'd really appreciate any help with this. Tom

Hi Tom What OS are you using? Could you try to install SDL-0.6.2 (i.e. the Haskell binding) with the verbose output from Cabal, probably -v for the command line switch.

I'm using Mac OS X 10.6.
Sorry, everyone, for just dumping a bunch of terminal output here, but:
When I tried to install SDL-0.6.2 in Cabal, I ultimately end up with the
same error:
"
cm-macbookpro-3:roadmap colinmurphy$ cabal install -v SDL-0.6.2
/opt/local/bin/ghc --numeric-version
looking for package tool: ghc-pkg near compiler in /opt/local/bin
found package tool in /opt/local/bin/ghc-pkg
/opt/local/bin/ghc-pkg --version
/opt/local/bin/ghc --supported-languages
Reading installed packages...
/opt/local/bin/ghc-pkg dump --global
/opt/local/bin/ghc-pkg dump --user
Reading available packages...
Resolving dependencies...
selecting SDL-0.6.2 (hackage)
selecting base-3.0.3.1 (installed) and 4.1.0.0 (installed) and discarding
syb-0.1.0.0, 0.1.0.1, 0.1.0.2, 0.1.0.3, 0.2, 0.2.1, 0.2.2 and 0.3
selecting ghc-prim-0.1.0.0 (installed)
selecting integer-0.1.0.1 (installed)
selecting rts-1.0 (installed)
selecting syb-0.1.0.1 (installed)
In order, the following would be installed:
SDL-0.6.2 (new package)
SDL-0.6.2 has already been downloaded.
Extracting
/Users/colinmurphy/.cabal/packages/
hackage.haskell.org/SDL/0.6.2/SDL-0.6.2.tar.gz
to /var/folders/+p/+pUVycVKFDWsYP8YiYnM3k+++TM/-Tmp-/SDL-0.6.26837...
Creating
/var/folders/+p/+pUVycVKFDWsYP8YiYnM3k+++TM/-Tmp-/SDL-0.6.26837/SDL-0.6.2/dist/setup
(and its parents)
/opt/local/bin/ghc --make
/var/folders/+p/+pUVycVKFDWsYP8YiYnM3k+++TM/-Tmp-/SDL-0.6.26837/SDL-0.6.2/Setup.lhs
-o
/var/folders/+p/+pUVycVKFDWsYP8YiYnM3k+++TM/-Tmp-/SDL-0.6.26837/SDL-0.6.2/dist/setup/setup
-odir
/var/folders/+p/+pUVycVKFDWsYP8YiYnM3k+++TM/-Tmp-/SDL-0.6.26837/SDL-0.6.2/dist/setup
-hidir
/var/folders/+p/+pUVycVKFDWsYP8YiYnM3k+++TM/-Tmp-/SDL-0.6.26837/SDL-0.6.2/dist/setup
-i
-i/var/folders/+p/+pUVycVKFDWsYP8YiYnM3k+++TM/-Tmp-/SDL-0.6.26837/SDL-0.6.2
-package Cabal-1.6.0.3
[1 of 1] Compiling Main (
/var/folders/+p/+pUVycVKFDWsYP8YiYnM3k+++TM/-Tmp-/SDL-0.6.26837/SDL-0.6.2/Setup.lhs,
/var/folders/+p/+pUVycVKFDWsYP8YiYnM3k+++TM/-Tmp-/SDL-0.6.26837/SDL-0.6.2/dist/setup/Main.o
)
/var/folders/+p/+pUVycVKFDWsYP8YiYnM3k+++TM/-Tmp-/SDL-0.6.26837/SDL-0.6.2/Setup.lhs:2:2:
Warning: In the use of `defaultUserHooks'
(imported from Distribution.Simple):
Deprecated: "Use simpleUserHooks or autoconfUserHooks, unless
you need Cabal-1.2
compatibility in which case you must stick with
defaultUserHooks"
Linking
/var/folders/+p/+pUVycVKFDWsYP8YiYnM3k+++TM/-Tmp-/SDL-0.6.26837/SDL-0.6.2/dist/setup/setup
...
ld: warning: -read_only_relocs cannot be used with x86_64
/var/folders/+p/+pUVycVKFDWsYP8YiYnM3k+++TM/-Tmp-/SDL-0.6.26837/SDL-0.6.2/dist/setup/setup
configure --verbose=2 --ghc --prefix=/Users/colinmurphy/.cabal --user
--constraint=base ==3.0.3.1
Warning: defaultUserHooks in Setup script is deprecated.
Configuring SDL-0.6.2...
Dependency base >=3 && <5 && ==3.0.3.1: using base-3.0.3.1
Using Cabal-1.6.0.3 compiled by ghc-6.10
Using compiler: ghc-6.10.4
Using install prefix: /Users/colinmurphy/.cabal
Binaries installed in: /Users/colinmurphy/.cabal/bin
Libraries installed in: /Users/colinmurphy/.cabal/lib/SDL-0.6.2/ghc-6.10.4
Private binaries installed in: /Users/colinmurphy/.cabal/libexec
Data files installed in: /Users/colinmurphy/.cabal/share/SDL-0.6.2
Documentation installed in: /Users/colinmurphy/.cabal/share/doc/SDL-0.6.2
Using alex version 2.3.1 found on system at: /opt/local/bin/alex
Using ar found on system at: /usr/bin/ar
No c2hs found
No cpphs found
No ffihugs found
Using gcc version 4.2.1 found on system at: /usr/bin/gcc
Using ghc version 6.10.4 found on system at: /opt/local/bin/ghc
Using ghc-pkg version 6.10.4 found on system at: /opt/local/bin/ghc-pkg
No greencard found
Using haddock version 2.4.2 found on system at: /opt/local/bin/haddock
Using happy version 1.18.4 found on system at: /opt/local/bin/happy
No hmake found
Using hsc2hs version 0.67 found on system at: /opt/local/bin/hsc2hs
No hscolour found
No hugs found
No jhc found
Using ld found on system at: /usr/bin/ld
No nhc98 found
Using pkg-config version 0.25 found on system at: /opt/local/bin/pkg-config
Using ranlib found on system at: /usr/bin/ranlib
Using strip found on system at: /usr/bin/strip
Using tar found on system at: /usr/bin/tar
sh configure --with-hc=ghc --prefix=/Users/colinmurphy/.cabal
configure: WARNING: unrecognized options: --with-hc
checking for sdl-config... no
checking for sdl11-config... no
configure: error: *** SDL not found! Get SDL from www.libsdl.org.
If you already installed it, check it's in the path. If problem remains,
please send a mail to the address that appears in ./configure --version
indicating your platform, the version of configure script and the problem.
cabal: Error: some packages failed to install:
SDL-0.6.2 failed during the configure step. The exception was:
exit: ExitFailure 1
cm-macbookpro-3:roadmap colinmurphy$
"
The final error is different, but it's still before the claim that SDL-0.6.2
can't be found.
Thanks for any help!
Tom
On Mon, Feb 21, 2011 at 2:23 PM, Stephen Tetley
Hi Tom
What OS are you using?
Could you try to install SDL-0.6.2 (i.e. the Haskell binding) with the verbose output from Cabal, probably -v for the command line switch.
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners

Hi Tom
Thanks for the update.
It looks like you have the SDL runtime library installed but not the
development extras. If you have the sdl-devel extras they're not on
your search path.
On 22 February 2011 14:53, Tom Murphy
checking for sdl-config... no checking for sdl11-config... no configure: error: *** SDL not found! Get SDL from www.libsdl.org. If you already installed it, check it's in the path. If problem remains, please send a mail to the address that appears in ./configure --version indicating your platform, the version of configure script and the problem. cabal: Error: some packages failed to install:

The log says that configuration SDL tool `sdl-config` is not installed,
probably, due to you have installed SDL framework. Cabal, or the SDL package
(I dont know who has the problem here) doesn't take into account that the
system is a MacOs so it doesn't search the library as a framework.
To solve this, you have to compile the library manually, just `./configure
&&
make && sudo make install` or install it with MacPorts. Then you will be
able
to compile SDL projects. Nothing more. If you want to link and run your own
Haskell SDL projects on MacOs you have to dive in the next odyssey:
SDL has a tricky way to enable C `main` function to run graphic applications
on all systems. So first, we need a C function wich is going to be hooked by
SDL, and this function is going to run our Haskell application. We put this
main function in c_main.c [1].
To be compatible with all other plataforms we have keep our Main Haskell
function, so we rename this function in a FFI Module which will be compiled
only on MacOS, named HS_Main.hs [2].
Now we have to compile c_main.c with:
gcc -c c_main.c `sdl-config --cflags` -framework GHC
But, surprise, the GHC framework seems that is not well-formed, so gcc can
not get the
header and you have to search it manually. In my case:
find / -name "HsFFI.h"
...
/Library/Frameworks/GHC.framework/Versions/612/usr/lib/ghc-6.12.3/include/HSffi.h
...
gcc -c c_main.c `sdl-config --cflags`
-I/Library/Frameworks/GHC.framework/Versions/612/usr/lib/ghc-6.12.3/include/
And now we have a c_main.o. Next, we have to compile our HSMain which
imports
our Main module which contains the default main function.
ghc --make HSMain.hs -no-hs-main c_main.o -framework Cocoa
And if you have the default Haskell plataform for MacOs you are going to get
one surprise more:
Linking ./Main ...
ld: warning: in c_main.o, file was built for unsupported file format which
is not the architecture being linked (i386)
ld: warning: in /usr/local/lib/libSDLmain.a, file was built for unsupported
file format which is not the architecture being linked (i386)
ld: warning: in /usr/local/lib/libSDL.dylib, file was built for unsupported
file format which is not the architecture being linked (i386)
This means that you have a 32 bits GHC but gcc compiles to 64 bits. You have
3 options: give up, cross-compile c_main.c and sdl to 32 bits, compile and
install a custom haskell-plataform enabling 64 bits support.
Good luck, you will need it!
PD: With cabal is a little more easy, see TimePiece as example [3].
[1] https://gist.github.com/839329
[2] https://gist.github.com/839340
[3] http://hackage.haskell.org/package/TimePiece
2011/2/21 Tom Murphy
When I use Cabal to get any program which depends on the SDL library, this is the error I get.
" checking for sdl-config... no checking for sdl11-config... no configure: error: *** SDL not found! Get SDL from www.libsdl.org. If you already installed it, check it's in the path. If problem remains, please send a mail to the address that appears in ./configure --version indicating your platform, the version of configure script and the problem. cabal: Error: some packages failed to install: Raincat-1.1.1.2 depends on SDL-0.6.2 which failed to install. SDL-0.6.2 failed during the configure step. The exception was: exit: ExitFailure 1 SDL-image-0.6.1 depends on SDL-0.6.2 which failed to install. SDL-mixer-0.6.1 depends on SDL-0.6.2 which failed to install. "
I have SDL 1.2.14 (correctly) installed on my system. I'd really appreciate any help with this.
Tom
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners

Thanks for this.
I downloaded the source for TimePiece and am trying to get it running on my
Mac.
When I do a cabal install, I get the output below.
Feels like I am missing something simple, but various searches haven't
turned up much so far. Any thoughts?
$ cabal install
Warning: TimePiece.cabal: A package using 'cabal-version: >=1.2' must use
section syntax. See the Cabal user guide for details.
Resolving dependencies...
[1 of 1] Compiling Main (
/var/folders/+E/+EbqIqRfGbKrq3GUh28kdU+++TM/-Tmp-/SDL-0.6.215336/SDL-0.6.2/Setup.lhs,
/var/folders/+E/+EbqIqRfGbKrq3GUh28kdU+++TM/-Tmp-/SDL-0.6.215336/SDL-0.6.2/dist/setup/Main.o
)
/var/folders/+E/+EbqIqRfGbKrq3GUh28kdU+++TM/-Tmp-/SDL-0.6.215336/SDL-0.6.2/Setup.lhs:2:3:
Warning: In the use of `defaultUserHooks'
(imported from Distribution.Simple):
Deprecated: "Use simpleUserHooks or autoconfUserHooks, unless
you need Cabal-1.2
compatibility in which case you must stick with
defaultUserHooks"
Linking
/var/folders/+E/+EbqIqRfGbKrq3GUh28kdU+++TM/-Tmp-/SDL-0.6.215336/SDL-0.6.2/dist/setup/setup
...
ld: warning: could not create compact unwind for .LFB3: non-standard
register 5 being saved in prolog
Warning: defaultUserHooks in Setup script is deprecated.
Configuring SDL-0.6.2...
configure: WARNING: unrecognized options: --with-hc, --with-gcc
checking for sdl-config... /opt/local/bin/sdl-config
configure: creating ./config.status
config.status: creating config.mk
config.status: creating SDL.buildinfo
config.status: creating includes/HsSDLConfig.h
configure: WARNING: unrecognized options: --with-hc, --with-gcc
Preprocessing library SDL-0.6.2...
General.hsc: In function ‘main’:
General.hsc:60: error: ‘SDL_INIT_CDROM’ undeclared (first use in this
function)
General.hsc:60: error: (Each undeclared identifier is reported only once
General.hsc:60: error: for each function it appears in.)
compiling dist/build/Graphics/UI/SDL/General_hsc_make.c failed (exit code 1)
command was: /usr/bin/gcc -c dist/build/Graphics/UI/SDL/General_hsc_make.c
-o dist/build/Graphics/UI/SDL/General_hsc_make.o -march=i686 -m32
-fno-stack-protector -march=i686 -m32 -fno-stack-protector -march=i686 -m32
-D__GLASGOW_HASKELL__=700 -Ddarwin_BUILD_OS -Ddarwin_HOST_OS
-Di386_BUILD_ARCH -Di386_HOST_ARCH -I/opt/local/include/SDL -D_THREAD_SAFE
-I/Library/Frameworks/GHC.framework/Versions/7.0.3-i386/usr/lib/ghc-7.0.3/base-4.3.1.0/include
-I/Library/Frameworks/GHC.framework/Versions/7.0.3-i386/usr/lib/ghc-7.0.3/include
-I/Library/Frameworks/GHC.framework/Versions/7.0.3-i386/usr/lib/ghc-7.0.3/include
-I/Library/Frameworks/GHC.framework/Versions/7.0.3-i386/usr/lib/ghc-7.0.3/include/
cabal: Error: some packages failed to install:
SDL-0.6.2 failed during the building phase. The exception was:
ExitFailure 1
SDL-gfx-0.6.0 depends on SDL-0.6.2 which failed to install.
SDL-image-0.6.1 depends on SDL-0.6.2 which failed to install.
SDL-ttf-0.6.1 depends on SDL-0.6.2 which failed to install.
TimePiece-0.0.3 depends on SDL-0.6.2 which failed to install.
On Tue, Feb 22, 2011 at 1:05 PM, Alvaro Vilanova
The log says that configuration SDL tool `sdl-config` is not installed, probably, due to you have installed SDL framework. Cabal, or the SDL package (I dont know who has the problem here) doesn't take into account that the system is a MacOs so it doesn't search the library as a framework.
To solve this, you have to compile the library manually, just `./configure && make && sudo make install` or install it with MacPorts. Then you will be able to compile SDL projects. Nothing more. If you want to link and run your own Haskell SDL projects on MacOs you have to dive in the next odyssey:
SDL has a tricky way to enable C `main` function to run graphic applications on all systems. So first, we need a C function wich is going to be hooked by SDL, and this function is going to run our Haskell application. We put this main function in c_main.c [1].
To be compatible with all other plataforms we have keep our Main Haskell function, so we rename this function in a FFI Module which will be compiled only on MacOS, named HS_Main.hs [2].
Now we have to compile c_main.c with:
gcc -c c_main.c `sdl-config --cflags` -framework GHC
But, surprise, the GHC framework seems that is not well-formed, so gcc can not get the header and you have to search it manually. In my case:
find / -name "HsFFI.h" ...
/Library/Frameworks/GHC.framework/Versions/612/usr/lib/ghc-6.12.3/include/HSffi.h ...
gcc -c c_main.c `sdl-config --cflags` -I/Library/Frameworks/GHC.framework/Versions/612/usr/lib/ghc-6.12.3/include/
And now we have a c_main.o. Next, we have to compile our HSMain which imports our Main module which contains the default main function.
ghc --make HSMain.hs -no-hs-main c_main.o -framework Cocoa
And if you have the default Haskell plataform for MacOs you are going to get one surprise more:
Linking ./Main ... ld: warning: in c_main.o, file was built for unsupported file format which is not the architecture being linked (i386) ld: warning: in /usr/local/lib/libSDLmain.a, file was built for unsupported file format which is not the architecture being linked (i386) ld: warning: in /usr/local/lib/libSDL.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
This means that you have a 32 bits GHC but gcc compiles to 64 bits. You have 3 options: give up, cross-compile c_main.c and sdl to 32 bits, compile and install a custom haskell-plataform enabling 64 bits support.
Good luck, you will need it!
PD: With cabal is a little more easy, see TimePiece as example [3].
[1] https://gist.github.com/839329 [2] https://gist.github.com/839340 [3] http://hackage.haskell.org/package/TimePiece
2011/2/21 Tom Murphy
When I use Cabal to get any program which depends on the SDL library, this is the error I get.
" checking for sdl-config... no checking for sdl11-config... no configure: error: *** SDL not found! Get SDL from www.libsdl.org. If you already installed it, check it's in the path. If problem remains, please send a mail to the address that appears in ./configure --version indicating your platform, the version of configure script and the problem. cabal: Error: some packages failed to install: Raincat-1.1.1.2 depends on SDL-0.6.2 which failed to install. SDL-0.6.2 failed during the configure step. The exception was: exit: ExitFailure 1 SDL-image-0.6.1 depends on SDL-0.6.2 which failed to install. SDL-mixer-0.6.1 depends on SDL-0.6.2 which failed to install. "
I have SDL 1.2.14 (correctly) installed on my system. I'd really appreciate any help with this.
Tom
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners

On 17 July 2011 02:18, Ben Sanders
Thanks for this. I downloaded the source for TimePiece and am trying to get it running on my Mac. When I do a cabal install, I get the output below. Feels like I am missing something simple, but various searches haven't
Preprocessing library SDL-0.6.2... General.hsc: In function ‘main’: General.hsc:60: error: ‘SDL_INIT_CDROM’ undeclared (first use in this function) General.hsc:60: error: (Each undeclared identifier is reported only once General.hsc:60: error: for each function it appears in.) compiling dist/build/Graphics/UI/SDL/General_hsc_make.c failed (exit code 1)
I believe Cabal is shelling out to the C compiler at this point, and the C compiler cannot find the macro SDL_INIT_CDROM... Have you got the "dev" files for SDL installed - i.e. the C Header files? Alternatively is SDL_INIT_CDROM a old or new macro in the SDL library that isn't in the version you have installed?
participants (4)
-
Alvaro Vilanova
-
Ben Sanders
-
Stephen Tetley
-
Tom Murphy