0

我已经设置了 rvm 并想做教程http://zetcode.com/gui/rubygtk/

它需要gtk2所以我跑了:

gem install gtk2

它要求我授权安装 libglib2.0-dev

最后它因错误而失败。

 This is the log
    /home/max/.rvm/rubies/ruby-2.0.0-p0/bin/ruby extconf.rb
    checking for -Wall option to compiler... yes
    checking for -Waggregate-return option to compiler... yes
    checking for -Wcast-align option to compiler... yes
    checking for -Wextra option to compiler... yes
    checking for -Wformat=2 option to compiler... yes
    checking for -Winit-self option to compiler... yes
    checking for -Wlarger-than-65500 option to compiler... yes
    checking for -Wmissing-declarations option to compiler... yes
    checking for -Wmissing-format-attribute option to compiler... yes
    checking for -Wmissing-include-dirs option to compiler... yes
    checking for -Wmissing-noreturn option to compiler... yes
    checking for -Wmissing-prototypes option to compiler... yes
    checking for -Wnested-externs option to compiler... yes
    checking for -Wold-style-definition option to compiler... yes
    checking for -Wpacked option to compiler... yes
    checking for -Wp,-D_FORTIFY_SOURCE=2 option to compiler... yes
    checking for -Wpointer-arith option to compiler... yes
    checking for -Wswitch-default option to compiler... yes
    checking for -Wswitch-enum option to compiler... yes
    checking for -Wundef option to compiler... yes
    checking for -Wunsafe-loop-optimizations option to compiler... yes
    checking for -Wwrite-strings option to compiler... yes
    checking for rb_define_alloc_func() in ruby.h... yes
    checking for rb_block_proc() in ruby.h... yes
    checking for new allocation framework... yes
    checking for attribute assignment... no
    checking for rb_errinfo()... yes
    checking for cairo... yes
    checking for rb_cairo.h... yes
    checking for Win32 OS... no
    checking for gtk+-2.0... yes
    checking for st.h... yes
    checking for ruby/st.h... yes
    checking for target... x11
    checking for gtk_plug_get_type() in gtk/gtk.h... yes
    checking for gtk_socket_get_type() in gtk/gtk.h... yes
    checking for pango_render_part_get_type() in gtk/gtk.h... yes
    checking for gtk/gtkfilesystem.h... no
    checking for X11/Xlib.h... yes
    checking for main() in -lX11... yes
    checking for XReadBitmapFileData() in X11/Xlib.h... yes
    checking for XGetErrorText() in X11/Xlib.h... yes
    checking for gtk+-unix-print-2.0... yes
    creating ruby-gtk2.pc
    creating Makefile

    make
    compiling rbgtkfilesel.c
    In file included from /home/max/.rvm/gems/ruby-2.0.0-p0/gems/glib2-1.2.1/ext/glib2/rbgobject.h:28:0,
                     from rbgtk.h:28,
                     from global.h:28,
                     from rbgtkfilesel.c:25:
    /home/max/.rvm/gems/ruby-2.0.0-p0/gems/glib2-1.2.1/ext/glib2/rbglib.h:67:0: Warnung: »rb_str_new_cstr« redefiniert [standardmäßig aktiviert]
    /home/max/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby/intern.h:747:0: Anmerkung: dies ist die Stelle der vorherigen Definition
    compiling rbgtkvruler.c

[a lot of further errors that variable »rb_str_new_cstr« is being redefined]

    rbgdkevent.c: In Funktion »gdkevent_s_setting_get«:
    rbgdkevent.c:390:8: Fehler: expected »(« before »!« token
    rbgdkevent.c:390:8: Warnung: Anweisung ohne Effekt [-Wunused-value]
    rbgdkevent.c:391:9: Fehler: expected »;« before »gtype«
    rbgdkevent.c: In Funktion »gdkeventexpose_set_area«:
    rbgdkevent.c:468:20: Warnung: Variable »event« gesetzt, aber nicht verwendet [-Wunused-but-set-variable]
    make: *** [rbgdkevent.o] Fehler 1

请问有什么想法吗?谢谢

4

1 回答 1

0

编译 ruby​​ 时,这些错误看起来像是clangOSX 上的问题,但它可能只是与 不兼容ruby-2.0.0-p0,请确保您拥有gcc不是LLVM基于的:

gcc -v | grep -i llvm

输出应该是空的,然后得到旧的红宝石:

rvm use 1.9.3 --install --default

并再次安装 gem:

gem install gtk2

如果可行,则为 gem 打开一个错误,以提高与任一clang和/或的兼容性ruby-2.0.0

于 2013-03-06T21:00:04.837 回答