我正在尝试安装helm。当我尝试安装它时,却出现此错误:

$ 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

当我自己单独安装sdl2时,会收到类似的消息。
$ 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

我不明白根据Hackage的说法,sdl2的版本为1.1,但是安装它是否需要版本2.0.3?我已经在沙盒中进行了尝试。如果您认为ghc-pkg list的结果是相关的,则在此处:http://pastebin.com/tFrsfPFe

我在Ubuntu Ubuntu上。

救命?

最佳答案

其他安装可能发生的另一件事是PKG_CONFIG_PATH变量可能未指向软件包配置文件(对我来说,在/usr/local/lib/pkgconfig目录中为sdl2.pc)。 pkg-config使用一些默认目录(“/usr/lib/pkgconfig”和“/usr/share/pkgconfig”),但是如果sdl.pc文件不在其中之一,则必须指定目录在环境变量中。您可以使用echo $PKG_CONFIG_PATH进行检查

如果事实证明您需要设置变量,则只需使用export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig(或将sdl2.pc文件放置在任何目录中)

08-04 15:01