Cabal安装gtk失败 [英] Cabal install gtk failing

查看:154
本文介绍了Cabal安装gtk失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 我试图通过cabal安装gtk,但是,编译Graphics.UI.Gtk.Embedding.Plug(dist / build / Graphics / UI / Gtk / Embedding / Plug.hs,dist / build / Graphics / UI / Gtk / Embedding / Plug.o)

Graphics / UI / Gtk / Embedding / Plug.chs:120:6:error:
无法匹配预期类型'Ptr()'
与实际类型'Maybe DrawWindow'
在'gtk_plug_new'的第一个参数中,即
'(fromNativeWindowId(fromMaybe nativeWindowIdNone socketId))'
在'($)'的第二个参数中,即
'gtk_plug_new
(fromNativeWindowId(fromMaybe nativeWindowIdNone socketId))'

Graphics / UI / Gtk / Embedding / Plug.chs:137:6:error:
无法匹配预期的类型' Ptr()'
与实际类型'Maybe DrawWindow'
在'\(显示arg1)的第二个参数arg2
- > withForeignPtr arg1
$ \ argPtr1 - > gtk_plug_new_for_display argPtr1 arg2',即
'(fromNativeWindowId(fromMaybe nativeWindowIdNone socketId))'
在'($)'的第二个参数中,即
'(\(Display arg1)arg2
- > withForeignPtr arg1
$ \ argPtr1 - > gtk_plug_new_for_display argPtr1 arg2)
display
(fromNativeWindowId(fromMaybe nativeWindowIdNone socketId))'

Graphics /UI/Gtk/Embedding/Plug.chs:151:3:错误:
无法将类型'Ptr()'与'Maybe DrawWindow'
预期类型:IO(也许DrawWindow)
实际类型:IO(Ptr())
在'($)'的第二个参数中,即
'(\(Plug arg1)
- > withForeignPtr arg1 $ \\在表达式中:
liftM toNativeWindowId
$(\(Plug arg1)
- > \\ argPtr1 - > gtk_plug_get_id argPtr1)
(toPlug self)'
withForeignPtr arg1 $ \ argPtr1 - > gtk_plug_get_id argPtr1)
(toPlug self)
未能安装gtk-0.13.9
cabal:错误:某些软件包未能安装:
gtk- 0.13.9在建设阶段失败。例外情况是:
ExitFailure 1

要安装此软件包,您需要gtk2hsC2hs和类型错误位于 .chs 文件中,大概是从gtk2hsC2hs工具生成的。这是gtk2hsC2hs的已知问题吗?其他人是否能够构建这个包?任何人都知道解决方案?



我在Mac OS X Yosemite(10.10.4)上

  $ gtk2hsC2hs --version 
C-> Haskell编译器,版本0.13.13(gtk2hs分支)Bin IO,2012年5月27日

$ cabal --version
cabal-install版本1.22.6.0
使用Cabal库的版本1.22.4.0

我做了一个 cabal update ,所以我所有的软件包看起来都是最新的。我也尝试过构建一些可以从hackage获得的旧版本,但是我得到了同样的错误。

编辑

生成的文件中的错误似乎全部涉及由gtk2hsC2hs生成的FFI导入。在文件的底部,我得到了

  foreign import ccall unsafegtk_plug_new
gtk_plug_new ::( (Ptr()) - >(IO(Ptr Widget)))

up Ptr() with 也许DrawWindow
那么生成的类型 Ptr()不正确,或者它的用法不正确?

解决方案

这有一个非常简单的解决方案。

  cabal install gtk -fhave-quartz-gtk 

如果有更好的记录,这将是很好的,但希望这可以帮助任何其他人以类似的情况出现。


I'm trying to install gtk via cabal, however, I'm getting the following type errors when building it

[ 22 of 209] Compiling Graphics.UI.Gtk.Embedding.Plug ( dist/build/Graphics/UI/Gtk/Embedding/Plug.hs, dist/build/Graphics/UI/Gtk/Embedding/Plug.o )

Graphics/UI/Gtk/Embedding/Plug.chs:120:6: error:
    Couldn't match expected type ‘Ptr ()’
                with actual type ‘Maybe DrawWindow’
    In the first argument of ‘gtk_plug_new’, namely
      ‘(fromNativeWindowId (fromMaybe nativeWindowIdNone socketId))’
    In the second argument of ‘($)’, namely
      ‘gtk_plug_new
         (fromNativeWindowId (fromMaybe nativeWindowIdNone socketId))’

Graphics/UI/Gtk/Embedding/Plug.chs:137:6: error:
    Couldn't match expected type ‘Ptr ()’
                with actual type ‘Maybe DrawWindow’
    In the second argument of ‘\ (Display arg1) arg2
                                 -> withForeignPtr arg1
                                    $ \ argPtr1 -> gtk_plug_new_for_display argPtr1 arg2’, namely
      ‘(fromNativeWindowId (fromMaybe nativeWindowIdNone socketId))’
    In the second argument of ‘($)’, namely
      ‘(\ (Display arg1) arg2
          -> withForeignPtr arg1
             $ \ argPtr1 -> gtk_plug_new_for_display argPtr1 arg2)
         display
         (fromNativeWindowId (fromMaybe nativeWindowIdNone socketId))’

Graphics/UI/Gtk/Embedding/Plug.chs:151:3: error:
    Couldn't match type ‘Ptr ()’ with ‘Maybe DrawWindow’
    Expected type: IO (Maybe DrawWindow)
      Actual type: IO (Ptr ())
    In the second argument of ‘($)’, namely
      ‘(\ (Plug arg1)
          -> withForeignPtr arg1 $ \ argPtr1 -> gtk_plug_get_id argPtr1)
         (toPlug self)’
    In the expression:
      liftM toNativeWindowId
      $ (\ (Plug arg1)
           -> withForeignPtr arg1 $ \ argPtr1 -> gtk_plug_get_id argPtr1)
          (toPlug self)
Failed to install gtk-0.13.9
cabal: Error: some packages failed to install:
gtk-0.13.9 failed during the building phase. The exception was:
ExitFailure 1

To install this package, you need "gtk2hsC2hs" and the type errors are in .chs files, which presumably are generated from the gtk2hsC2hs tool. Is this a known problem with gtk2hsC2hs? Has anyone else been able to build this package? Anyone know of a solution?

I'm on Mac OS X Yosemite (10.10.4)

$ gtk2hsC2hs --version
C->Haskell Compiler, version 0.13.13 (gtk2hs branch) "Bin IO", 27 May 2012

$ cabal --version
cabal-install version 1.22.6.0
using version 1.22.4.0 of the Cabal library 

I've done a cabal update, so all my packages appear to be up to date. I've also tried building some of the older versions available from hackage, but I'm getting the same errors.

Edit

The errors in the generated files, seem to all deal with the FFI imports that are getting generated by gtk2hsC2hs. At the bottom of the file, I'm getting

foreign import ccall unsafe "gtk_plug_new"
  gtk_plug_new :: ((Ptr ()) -> (IO (Ptr Widget)))

It seems to consistently mix up Ptr() with Maybe DrawWindow. So is the generated type Ptr() incorrect, or is the usage of it incorrect?

解决方案

This had a really simple solution.

cabal install gtk -fhave-quartz-gtk

It would be nice if this was more well documented, but hopefully this will help anyone else that ends up in a similar situation

这篇关于Cabal安装gtk失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆