Haskell SDL-mixer编译错误

4

我正在尝试使用 "cabal install sdl-mixer" 命令安装 SDL-mixer Haskell 包。但是,安装过程中出现了错误。

Resolving dependencies...
[1 of 1] Compiling Main             ( /tmp/SDL-mixer-0.6.1-10381/SDL-mixer-0.6.1/Setup.lhs, /tmp/SDL-mixer-0.6.1-10381/SDL-mixer-0.6.1/dist/setup/Main.o )
Linking /tmp/SDL-mixer-0.6.1-10381/SDL-mixer-0.6.1/dist/setup/setup ...
Configuring SDL-mixer-0.6.1...
configure: WARNING: unrecognized options: --with-compiler, --with-gcc
checking for sdl-config... /usr/bin/sdl-config
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/tmp/SDL-mixer-0.6.1-10381/SDL-mixer-0.6.1':
configure: error: C compiler cannot create executables
See `config.log' for more details.
Failed to install SDL-mixer-0.6.1
cabal: Error: some packages failed to install:
SDL-mixer-0.6.1 failed during the configure step. The exception was:
ExitFailure 77

如果有区别的话,我使用的是Arch Linux。我该如何安装这个软件包?

2
该软件包有一个configure脚本,它无法识别--with-gcc选项。C编译器(gcc)似乎对configure脚本不起作用。在cabal install之前,您可以尝试设置CC环境变量,例如$ export CC="/path/to/your/gcc",但如果--with-gcc选项不是由您手动添加而是由cabal自动添加的,那么这种方法可能不起作用。您可以使用cabal unpack SDL-mixer,并在其目录中运行cabal install -v2(或者也许需要-v3)以获取configure所使用的命令行。然后自己运行它并查看config.log - Daniel Fischer
3个回答

2

确保您已经安装了libsdl-mixer作为先决条件。


我在Linux Mint 16上遇到了与上述相同的错误,这个方法对我有效。 - Alex Reinking

1

我在Ubuntu 12.04上使用软件包网络时出现了相同的症状。这是由于/usr/bin/ld是金色而不是ld.bfd引起的。对于某些软件包,仅传递--with-ld=ld.bfd是不够的。

解决方法:

mkdir /tmp/ld_override

ln -s /usr/bin/ld.bfd /tmp/ld_override/ld

PATH=/tmp/ld_override:$PATH cabal install ...

我还不太确定这个是干什么的,但现在cabal install cabal-install在我的Ubuntu 12.04上可以工作了,非常感谢你。 - Zajn

0

我尝试了这个方法,它对我有效。但是我不知道原因是什么 :-)

brew install sdl_mixer

然后尝试

cabal install SDL-mixer

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接