Cabal:无法安装 GLUtil

Cabal: Failed to Install GLUtil

我是 Haskell 的新手,但我想尝试在其中编写一些 OpenGL 实验。 我已经成功安装了 OpenGL、GLUT 和其他一些软件包,但是当我尝试安装 GLUtil 时出现以下错误:

Building GLUtil-0.9.0.1...
Failed to install GLUtil-0.9.0.1
Build log ( C:\Users\David\AppData\Roaming\cabal\logs\GLUtil-0.9.0.1.log ):
Building GLUtil-0.9.0.1...
Preprocessing library GLUtil-0.9.0.1...
hpp: Couldn't open input file: -includeC:\Users\David\AppData\Local\Temp\ghc3236_0\ghc_2.h
CallStack (from HasCallStack):

error, called at src\Hpp\CmdLine.hs:89:0: error:
    22 in hpp-0.3.0.0-61vdEFyxUJDaeEBxsHCsL:Hpp.CmdLine
`hpp' failed in phase `C pre-processor'. (Exit code: 1)
cabal: Leaving directory 'C:\Users\David\AppData\Local\Temp\cabal-tmp-6356\GLUtil-0.9.0.1'
cabal: Error: some packages failed to install:
GLUtil-0.9.0.1 failed during the building phase. The exception was:
ExitFailure 1

我尝试使用旧版本的 GLUtil 及其依赖项,但它总是以相同的方式结束,我最终只是清除并重新安装了 Haskell 平台(我不知道沙盒)。

有一点很突出,-includeC:\Users\Dav... 在我看来像是一个拼写错误,好像 -includeC:\... 之间应该有一个 space 但我不知道不知道如何改变这一点。我找不到 CmdLine.hs,只有接口文件 CmdLine.hi 没有结果。

有人对如何解决这个问题有什么建议吗?

看来 -include 和文件名之间应该有一个 space。

我创建了一个 GLUtil-0.9.0.1 版本,它已经过预处理并且应该适合你:

https://github.com/erantapaa/GLUtil-0.9.0.1-no-cpp

假定您使用的是 GHC 7。10.x 或更高版本。

消除对 CPP 依赖的步骤是:

  • 文件 JuicyTextures.hs 和 ShaderProgram.hs 只是使用 CPP 来包含 Control.Applicative 旧版本的 GHC,所以我只是注释掉了这些行。同时从 LANGUAGE pragma 中删除 CPP

  • Linear.hs使用CPP生成代码。您可以使用以下命令创建预处理输出:

    gcc -E - < Linear.hs > new-Linear.hs
    

然后删除以井号 (#) 开头的行,并从 LANGUAGE 编译指示中删除 CPP

  • GLUtil.cabal评论out/remove行:

    if impl(ghc >= 7.10.1)
      Build-depends:     hpp >= 0.3 && < 0.4
      GHC-Options:       -pgmPhpp -optP--cpp -optP-P
    else
      Build-tools:       cpphs
      GHC-Options:       -pgmPcpphs -optP--cpp -optP