我已经设置了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
有什么想法吗?感谢
答案 0 :(得分:0)
在编译ruby时,错误看起来像OSX上的clang
问题,但它可能与ruby-2.0.0-p0
不兼容,请确保gcc
不是基于LLVM
的{{1}} :
gcc -v | grep -i llvm
输出应为空,然后使用旧版的红宝石:
rvm use 1.9.3 --install --default
再次安装gem:
gem install gtk2
如果这样可以为gem打开一个错误,以改善与clang
和/或ruby-2.0.0
的兼容性