在mac

时间:2016-05-23 23:29:18

标签: haskell gtk glib gtk2hs

我想使用 Graphics.UI.Gtk.OpenGL

我有:

  • OS X 10.11
  • cabal版本1.22.0.0
  • 已安装gtk

我得到的错误:

Could not find module ‘Graphics.UI.Gtk.OpenGL’
  Perhaps you meant
    Graphics.UI.Gtk.Gdk.GC (from gtk-0.14.2)
    Graphics.UI.Gtk.Cairo (from gtk-0.14.2)
    Graphics.UI.Gtk.Gdk.Gdk (from gtk-0.14.2)
  Use -v to see a list of the files searched for.`

我尝试使用以下方法安装gtkglext:

cabal install gtkglext 

但后来我得到了:

Resolving dependencies...
Configuring glib-0.12.5.4...
Building glib-0.12.5.4...
Failed to install glib-0.12.5.4
Build log ( /Users/Martin/.cabal/logs/glib-0.12.5.4.log ):
[1 of 2] Compiling SetupWrapper     (         /var/folders/4p/yw17gzsd4554drxtxmbdd24c0000gn/T/glib-0.12.5.4-1526/glib-   0.12.5.4/SetupWrapper.hs, /var/folders/4p/yw17gzsd4554drxtxmbdd24c0000gn/T/glib-0.12.5.4-1526/glib-0.12.5.4/dist/setup/SetupWrapper.o )
[2 of 2] Compiling Main             ( /var/folders/4p/yw17gzsd4554drxtxmbdd24c0000gn/T/glib-0.12.5.4-1526/glib-0.12.5.4/dist/setup/setup.hs, /var/folders/4p/yw17gzsd4554drxtxmbdd24c0000gn/T/glib-0.12.5.4-1526/glib-0.12.5.4/dist/setup/Main.o )
Linking /var/folders/4p/yw17gzsd4554drxtxmbdd24c0000gn/T/glib-0.12.5.4-1526/glib-0.12.5.4/dist/setup/setup ...
[1 of 2] Compiling Gtk2HsSetup      ( Gtk2HsSetup.hs, dist/setup-wrapper/Gtk2HsSetup.o )
[2 of 2] Compiling Main             ( SetupMain.hs, dist/setup-wrapper/Main.o )
Linking dist/setup-wrapper/setup ...
Configuring glib-0.12.5.4...
Building glib-0.12.5.4...
Preprocessing library glib-0.12.5.4...
gtk2hsC2hs: Error in C header file.

/usr/include/dirent.h:150: (column 10) [FATAL] 
  \>>> Syntax error!
  The symbol `^' does not fit here.

cabal: Error: some packages failed to install:
gio-0.12.5.3 depends on glib-0.12.5.4 which failed to install.
glib-0.12.5.4 failed during the building phase. The exception was:
ExitFailure 1
gtk-0.12.5.7 depends on glib-0.12.5.4 which failed to install.
gtkglext-0.12.5.0 depends on glib-0.12.5.4 which failed to install.
pango-0.12.5.3 depends on glib-0.12.5.4 which failed to install.`

所以我发现的是,gtkglext具有依赖性glib(> = 0.12.5.0&&< 0.13), 我不能在这个范围内安装glib版本,因为这个错误,是否意味着我不能使用gtkglext?

修改:------------------------------------------ -------------------------

使用

安装
cabal install gtkglext  --with-gcc=gcc-4.8

产生另一个错误,即:

Graphics/UI/Gtk/General/Structs.hsc:660:3: Couldn't match type ‘CInt’ with ‘Ptr a0’ Expected type: IO (Ptr a0) Actual type: IO CInt In the second argument of ‘($)’, namely ‘(\ (Drawable drawable) -> withForeignPtr drawable gdk_x11_drawable_get_xid) (toDrawable d)’ In the expression: liftM toNativeWindowId $ (\ (Drawable drawable) -> withForeignPtr drawable gdk_x11_drawable_get_xid) (toDrawable d)

谷歌搜索产生的内容很少: https://github.com/gtk2hs/gtk2hs/issues/27

但是我不知道他是如何完全禁用drawableGetID的,这似乎工作正常。"

任何帮助都会有用。

1 个答案:

答案 0 :(得分:2)

关键是此错误消息:

/usr/include/dirent.h:150: (column 10) [FATAL] >>> Syntax error! The symbol `^' does not fit here.

谷歌搜索该消息导致他在github上的问题:

https://github.com/gtk2hs/gtk2hs/issues/1

建议的解决方法是使用以下命令运行cabal:

cabal install --with-gcc=gcc-4.8

所以 - 如果需要,可以升级您的gcc版本并使用--with-gcc=标记。