Can't install sdl2 via cabal
Asked Answered
N

2

7

I am trying to install helm. When I try to install it, however I get this error:

$ cabal install helm
Resolving dependencies...
Configuring sdl2-1.1.0...
cabal: The pkg-config package 'sdl2' version >=2.0.3 is required but it could
not be found.
Failed to install sdl2-1.1.0
cabal: Error: some packages failed to install:
helm-0.6.1 depends on sdl2-1.1.0 which failed to install.
sdl2-1.1.0 failed during the configure step. The exception was:
ExitFailure 1

When I go to install sdl2 by itself, I get a similar message.

$ cabal install sdl2
Resolving dependencies...
Configuring sdl2-1.1.0...
cabal: The pkg-config package 'sdl2' version >=2.0.3 is required but it could
not be found.
Failed to install sdl2-1.1.0
cabal: Error: some packages failed to install:
sdl2-1.1.0 failed during the configure step. The exception was:
ExitFailure 1

I don't understand. According to Hackage, sdl2 is at version 1.1, but installing it requires version 2.0.3? I've tried this in and out of a sandbox. Results of ghc-pkg list are here if you think they're relevant: http://pastebin.com/tFrsfPFe

I'm on Ubuntu btw.

Help?

Neglectful answered 7/9, 2014 at 17:59 Comment(3)
This is not refering to cabal/haskell packages (freedesktop.org/wiki/Software/pkg-config) - have tried to install the sdl2 packages using apt-get/synaptic/similar? (I guess it should be libsdl2-dev or something)Coolie
I did install libsdl2-2.0 whatever, but did not install libsdl2-dev... I just did, but apt-get gave me version 2.0.2, not 2.0.3. I'm updating apt-get sources now. We shall see. Thanks!Neglectful
If this don't work you can grab the 2.0.3 release here: libsdl.org/download-2.0.phpCoolie
A
4

Another thing which could happen (happened to me) for other installs is that the PKG_CONFIG_PATH variable might not point to the package config file (sdl2.pc, for me in the /usr/local/lib/pkgconfig directory). pkg-config uses some default directories ('/usr/lib/pkgconfig' and '/usr/share/pkgconfig'), but if the sdl.pc file isn't in one of these, you'll have to specify the directory in the environment variable. You can check this with echo $PKG_CONFIG_PATH

If it turns out you need to set the variable, just use export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig (or to whatever directory your sdl2.pc file lives in)

Arvid answered 29/1, 2015 at 15:31 Comment(0)
G
0

I ran into the same problem, and I just want to add my solution here for the record. The native sdl2 libraries need to be installed first by following the directions here: https://github.com/haskell-game/sdl2#building

Git answered 24/8, 2019 at 23:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.