依赖于gtk2hs的构建项目在lts-7.8及更高版本上失败

时间:2016-11-17 15:43:38

标签: haskell cabal haskell-stack gtk2hs

依赖于glib的构建项目在lts-7.8之后以及之后Cabal变为1.24.1.0后失败。

重现的步骤

  1. 将glib添加到项目的.cabal文件

    build-depends:       base
                       , gtktest
                       , glib
    
  2. 运行以下命令

    stack install gtk2hs-buildtools
    stack build
    
  3. 结果

    发生以下错误

    ...
    
    [debug] Ignoring package Cabal due to wanting version 1.24.1.0 instead of 1.24.0.0
    @(Stack\Build\Installed.hs:196:5)
    
    ...
    
    --  While building package glib-0.13.4.1 using:
      C:\Users\foo\AppData\Local\Programs\stack\x86_64-windows\ghc-8.0.1\bin\ghc.EXE --make -odir C:\Users\foo\AppData\Local\Temp\stack5512\glib-0.13.4.1\.stack-work\dist\b7fec021\setup -hidir C:\Users\foo\AppData\Local\Temp\stack5512\glib-0.13.4.1\.stack-work\dist\b7fec021\setup -i -i. -package=Cabal-1.24.0.0 -clear-package-db -global-package-db -package-db=C:\sr\snapshots\a78c6a89\pkgdb C:\Users\foo\AppData\Local\Temp\stack5512\glib-0.13.4.1\Setup.hs -o C:\Users\foo\AppData\Local\Temp\stack5512\glib-0.13.4.1\.stack-work\dist\b7fec021\setup\setup
    Process exited with code: ExitFailure 1
    Logs have been written to: C:\Users\foo\Documents\Files\Haskell\gtktest\.stack-work\logs\glib-0.13.4.1.log
    
    [1 of 1] Compiling Main             ( C:\Users\foo\AppData\Local\Temp\stack5512\glib-0.13.4.1\Setup.hs, C:\Users\foo\AppData\Local\Temp\stack5512\glib-0.13.4.1\.stack-work\dist\b7fec021\setup\Main.o )
    
    C:\Users\foo\AppData\Local\Temp\stack5512\glib-0.13.4.1\Setup.hs:8:29: error:
         Couldn't match expected type ‘Distribution.Simple.UserHooks.UserHooks’
                      with actual type ‘Cabal-1.24.1.0:Distribution.Simple.UserHooks.UserHooks’
          NB: Cabal-1.24.1.0:Distribution.Simple.UserHooks.UserHooks’
                is defined in ‘Distribution.Simple.UserHooks’
                    in package ‘Cabal-1.24.1.0’
              ‘Distribution.Simple.UserHooks.UserHooks’
                is defined in ‘Distribution.Simple.UserHooks’
                    in package ‘Cabal-1.24.0.0’
         In the first argument of ‘defaultMainWithHooks’, namely
            gtk2hsUserHooks’
          In the expression: defaultMainWithHooks gtk2hsUserHooks
          In an equation for ‘main’:
              main = defaultMainWithHooks gtk2hsUserHooks
    

    我认为ghc-8.0.1全局包中的Cabal-1.24.0.0导致了问题,并且在ghc的全局包中安装了Cabal-1.24.1.0后成功构建了它。

    然而,这种方法对初学者来说很难,我认为没有正确的解决方案。解决问题的正确方法如何?

    堆栈版

    Version 1.2.0, Git revision 123819b7d65df2ad7fe63fb5eb39a98536acb5f3 (4055 commits) x86_64 hpack-0.14.0
    

0 个答案:

没有答案