我无法将它安装到我的系统上。这是我尝试过的。奇怪的是,我能够配置找到头文件而不是实际的二进制文件。
让我们试试吧。我已经安装了新的 2014 Haskell 平台。
cabal install sdl
Configuring SDL-0.6.5...
setup.exe: The package has a './configure' script. This requires a Unix
compatibility toolchain such as MinGW+MSYS or Cygwin.
Failed to install SDL-0.6.5
Haskell Platform 中的 GHC 自带 MinGW,所以我们可能需要安装 MSYS。 MSYS page 表示要安装 minggw get,表示要安装
名为mingw-get-setup.exe 的自动化GUI 安装程序助手是首次安装的首选方法。这将指导您正确设置 mingw-get 安装程序;然后,您将使用它来执行进一步的包安装,并管理您的安装。
使用默认选项运行安装程序会显示以下屏幕:
我们已经有了安装 Haskell 平台的 mingw,所以我们只点击列表中的最后一项,msys-base,然后选择“Mark for Installation”。然后,在左上角的“安装”菜单中,选择“应用更改”。这询问是否可以继续,我们选择“应用”
这个安装程序没有把msys-base放到路径里,我们可以把它加到路径里,再试试安装sdl
set PATH=C:\MinGW\msys\1.0\bin\;%PATH%
cabal install sdl
Configuring SDL-0.6.5...
configure: WARNING: unrecognized options: --with-compiler, --with-gcc
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.
Failed to install SDL-0.6.5
我们需要下载并安装 libsdl。我去了libsdl download page,下载了Win32开发库SDL-devel-1.2.15-mingw32.tar.gz。我提取了这个存档(7-zip 可以提取 tar 存档和 gzip 压缩文件)。为方便起见,我将SDL-1.2.15 目录移动到c:。我们将按照上一个错误的建议将其添加到路径中,然后重试
set PATH=C:\SDL-1.2.15\bin\;%PATH%
cabal install sdl
* Missing (or bad) header file: SDL/SDL.h
* Missing C library: SDL
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.
If the header file does exist, it may contain errors that are caught by the C
compiler at the preprocessing stage. In this case you can re-run configure
with the verbosity flag -v3 to see the error messages.
我们可以通过添加建议的--extra-include-dirs 标志来消除此错误的一部分,但仍然会出现以下错误
cabal install sdl --extra-include-dirs=c:\SDL-1.2.15\include
* Missing C library: SDL
This problem can usually be solved by installing the system package that
provides this library (you may need the "-dev" version). If the library is
already installed but in a non-standard location then you can use the flags
--extra-include-dirs= and --extra-lib-dirs= to specify where it is.
使用c:\SDL-1.2.15\bin 或C:\SDL-1.2.15\lib 或c:\SDL-1.2.15 添加--extra-lib-dirs 标志未能解决此问题。