Haskell gtk安装类型冲突

时间:2015-10-13 14:38:54

标签: macos haskell gtk haskell-platform threadscope

基本问题:

我试图在OSX 10.10.4上使用gtk安装Haskell的standard mac instructions软件包。具体来说,我想运行threadscope,因此我需要gtkhomebrewgtk buildtools的早期阶段工作正常,但是当我

cabal install gtk

或使用

cabal install --with-gcc=gcc-4.8 gtk

我收到以下编译错误:

Graphics/UI/Gtk/Embedding/Plug.chs:120:6:
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:
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:
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)
cabal: Error: some packages failed to install:

我之前已经安装并运行了Haskell的gtk库和threadscope应用程序,然后我将Haskell平台从ghc 7.8.4更新为ghc 7.10.2。起初我认为存在安装冲突,但是我使用thorough removal instructions反复从系统中删除了Haskell平台,并重新尝试了threadscope安装但没有成功。我甚至使用gtk+删除并重新安装了基础homebrew及相关软件包,但再次没有成功。

我不确定Ptr ()Maybe DrawWindow类型的来源,以及冲突可能来自哪里。任何可能出错的想法都会受到欢迎!

2 个答案:

答案 0 :(得分:3)

也许您可以尝试使用此行安装gtk

cabal install gtk -fhave-quartz-gtk

答案 1 :(得分:1)

在edsko的博客中有一个安装GTK和threadscope的方法:

http://www.edsko.net/2015/03/09/sandboxes-revisited/

在页面中搜索" GTK沙箱"。

<强>更新

我能够使用ghc-7.10.2上面的说明构建threadcope。

我使用的具体命令:

export PATH=/opt/X11/lib/pkgconfig
brew install gtk+                      # installed gtk+-2.24.25
brew install poppler                   # installed poppler-0.35.0
cabal sandbox init
cabal install gtk2hs-buildtools
cabal install gtk
cabal install poppler --with-gcc=gcc-4.9 --extra-include-dirs=/usr/local/include
cabal install threadscope

沙箱中安装的软件包的特定版本:

cairo-0.13.1.0
ghc-events-0.4.4.0
gio-0.13.1.0
glib-0.13.2.1
gtk-0.13.9
hashtables-1.2.0.2
pango-0.13.1.0
poppler-0.13.1
utf8-string-1.0.1.1