Error installing gtk2 under ruby 2.0

hello all,

i ran into an error while trying to install the gtk2 gem in rvm ruby
2.0.0 under ubuntu 12.04

ERROR: Error installing gtk2:
ERROR: Failed to build gem native extension.


creating ruby-gtk2.pc
creating Makefile

make
compiling rbgdkgc.c
In file included from
/…/…/.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 rbgdkgc.c:24:
/…/…/.rvm/gems/ruby-2.0.0-p0/gems/glib2-1.2.1/ext/glib2/rbglib.h:67:0:
warning: “rb_str_new_cstr” redefined [enabled by default]
/…/…/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby/intern.h:747:0:
note: this is the location of the previous definition
compiling rbgtkimcontextsimple.c


(and on and on like this…)

has anyone else come across this issue?

  • j

Hello:

jake kaiden wrote, at 03/09/2013 07:57 PM +9:00:

note: this is the location of the previous definition
compiling rbgtkimcontextsimple.c


(and on and on like this…)

These are just “warnings”, not “errors”.

However with ruby 2.0 you’ll see errors due to NIL_P
not put in parentheses like:

In file included from /usr/include/ruby.h:33:0,
from /usr/lib64/ruby/vendor_ruby/rbgobject.h:27,
from rbgtk.h:28,
from global.h:28,
from rbgdkevent.c:25:
rbgdkevent.c: In function ‘gdkevent_s_setting_get’:
rbgdkevent.c:390:8: error: expected ‘(’ before ‘!’ token
if NIL_P(type)
^
rbgdkevent.c:391:9: error: expected ‘;’ before ‘gtype’
gtype = G_TYPE_STRING;
^

and this patch is needed:

Regards,
Mamoru

thanks Mamoru,

you’re right, those are just ‘warnings,’ but something is stopping the
thing from installing… (i do get a big fat ‘ERROR’ at the top.)

i’ll try the patch you mentioned, and let you know how it works out.

thanks again,

  • j

Hello, Enrico:

Enrico Rivarola wrote, at 03/11/2013 07:37 PM +9:00:

I have a similar problem when try to install rabbit gem on ubuntu 12.04
from rbgtkcalendar.c:25:
returning non-void [-Wreturn-type]
make: *** [rbgtkcalendar.o] Error 1

there is also attached the result log

Anyone can help ?

Same error.

should fix this.

Regards,
Mamoru

Thanks for the tips.
Some minutes ago I attempt to install 1.2.2 version and the installation
work fine. Gtk2 and other related packages was installed without errors.

Bye

Enrico

Mamoru TASAKA wrote in post #1101095:

Hello, Enrico:

Enrico Rivarola wrote, at 03/11/2013 07:37 PM +9:00:

I have a similar problem when try to install rabbit gem on ubuntu 12.04
from rbgtkcalendar.c:25:
returning non-void [-Wreturn-type]
make: *** [rbgtkcalendar.o] Error 1

there is also attached the result log

Anyone can help ?

Same error.

should fix this.

Regards,
Mamoru

jake kaiden wrote in post #1100838:

thanks Mamoru,

you’re right, those are just ‘warnings,’ but something is stopping the
thing from installing… (i do get a big fat ‘ERROR’ at the top.)

i’ll try the patch you mentioned, and let you know how it works out.

thanks again,

  • j

Hello,
I have a similar problem when try to install rabbit gem on ubuntu 12.04
(64bit) with rvm, the installation break on ruby-gtk2.

The installed gems are:
*** LOCAL GEMS ***

atk (1.2.1)
bigdecimal (1.2.0)
bundler (1.2.4)
cairo (1.12.3)
diff-lcs (1.2.1)
gdk_pixbuf2 (1.2.1)
glib2 (1.2.1)
guid (0.1.1)
io-console (0.4.2)
json (1.7.7)
minitest (4.3.2)
pango (1.2.1)
pkg-config (1.1.4)
psych (2.0.0)
rake (10.0.3, 0.9.6)
rdoc (4.0.0)
rspec (2.13.0)
rspec-core (2.13.0)
rspec-expectations (2.13.0)
rspec-mocks (2.13.0)
rubygems-bundler (1.1.0)
rubygems-update (2.0.2)
rvm (1.11.3.6)
test-unit (2.0.0.0)

The final lines of gem installation are:

compiling rbgtkcalendar.c
In file included from
/home/rbtest/.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 rbgtkcalendar.c:25:
/home/rbtest/.rvm/gems/ruby-2.0.0-p0/gems/glib2-1.2.1/ext/glib2/rbglib.h:67:0:
warning: “rb_str_new_cstr” redefined [enabled by default]
/home/rbtest/.rvm/rubies/ruby-2.0.0-p0/include/ruby-2.0.0/ruby/intern.h:747:0:
note: this is the location of the previous definition
rbgtkcalendar.c: In function ‘rg_display_options’:
rbgtkcalendar.c:108:8: error: expected ‘(’ before ‘!’ token
rbgtkcalendar.c:108:8: warning: statement with no effect
[-Wunused-value]
rbgtkcalendar.c:108:20: error: expected ‘;’ before ‘{’ token
rbgtkcalendar.c:122:1: warning: no return statement in function
returning non-void [-Wreturn-type]
make: *** [rbgtkcalendar.o] Error 1

there is also attached the result log

Anyone can help ?

…just updated to 1.2.2 and everything seems to work nicely.

thanks!

  • j