Haskell gtk安装类型冲突

G. *_*man 6 gtk macos haskell haskell-platform threadscope

基本问题:

我正在尝试gtk使用OSX 10.10.4上的标准mac指令安装Haskell的软件包.具体来说,我想跑threadscope,所以我需要gtk.早期阶段homebrewgtk buildtools工作正常,但当我

cabal install gtk
Run Code Online (Sandbox Code Playgroud)

或使用

cabal install --with-gcc=gcc-4.8 gtk
Run Code Online (Sandbox Code Playgroud)

我收到以下编译错误:

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:
Run Code Online (Sandbox Code Playgroud)

我以前有Haskell的gtk库和threadscope应用程序安装并运行从我更新了我的Haskell平台之前ghc 7.8.4ghc 7.10.2.起初我假设安装冲突,但我已经使用完全删除指令反复从我的系统中删除Haskell平台,并重新尝试threadscope安装但没有成功.我甚至删除并重新安装了底层gtk+和相关的包使用homebrew,再次没有成功.

我不确定类型Ptr ()Maybe DrawWindow起源的位置,因此也不确定冲突的来源.任何可能出错的想法都会受到欢迎!

Eri*_*ikR 1

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

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

搜索“GTK 沙盒”页面。

更新

我能够使用上述说明和 ghc-7.10.2 构建 threadscope。

我使用的具体命令:

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
Run Code Online (Sandbox Code Playgroud)

沙箱中安装的软件包的具体版本:

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
Run Code Online (Sandbox Code Playgroud)