# Error installing gtk2 under ruby 2.0

**URL:** <https://www.ruby-forum.com/t/error-installing-gtk2-under-ruby-2-0/227263>\
**Category:** Ruby-Gnome 2\
**Created:** [March 9, 2013, 11:57am UTC](https://www.ruby-forum.com/t/error-installing-gtk2-under-ruby-2-0/227263 "2013-03-09T11:57:25Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![lljk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/a9a28c/32.png) [@lljk](https://www.ruby-forum.com/u/lljk)\
**Post date:** [March 9, 2013, 11:57am UTC](https://www.ruby-forum.com/t/error-installing-gtk2-under-ruby-2-0/227263/1 "2013-03-09T11:57:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![lljk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/a9a28c/32.png) [@lljk](https://www.ruby-forum.com/u/lljk)\
**Post date:** [March 9, 2013, 1:08pm UTC](https://www.ruby-forum.com/t/error-installing-gtk2-under-ruby-2-0/227263/2 "2013-03-09T13:08:49Z")

</div>

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:

> <https://github.com/ruby-gnome/ruby-gnome/commit/03be2d663730119036c9d70d4fc7b52523ae40df>

Regards,  
Mamoru

---

<div class="post-metadata">

**Author:** ![lljk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/a9a28c/32.png) [@lljk](https://www.ruby-forum.com/u/lljk)\
**Post date:** [March 9, 2013, 2:26pm UTC](https://www.ruby-forum.com/t/error-installing-gtk2-under-ruby-2-0/227263/3 "2013-03-09T14:26:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![lljk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/a9a28c/32.png) [@lljk](https://www.ruby-forum.com/u/lljk)\
**Post date:** [March 11, 2013, 2:28pm UTC](https://www.ruby-forum.com/t/error-installing-gtk2-under-ruby-2-0/227263/4 "2013-03-11T14:28:43Z")

</div>

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.

> <https://github.com/ruby-gnome/ruby-gnome/commit/03be2d663730119036c9d70d4fc7b52523ae40df>

should fix this.

Regards,  
Mamoru

---

<div class="post-metadata">

**Author:** ![lljk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/a9a28c/32.png) [@lljk](https://www.ruby-forum.com/u/lljk)\
**Post date:** [March 11, 2013, 4:47pm UTC](https://www.ruby-forum.com/t/error-installing-gtk2-under-ruby-2-0/227263/5 "2013-03-11T16:47:21Z")

</div>

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.

> <https://github.com/ruby-gnome/ruby-gnome/commit/03be2d663730119036c9d70d4fc7b52523ae40df>

> should fix this.
> 
> Regards,  
> Mamoru

---

<div class="post-metadata">

**Author:** ![lljk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/a9a28c/32.png) [@lljk](https://www.ruby-forum.com/u/lljk)\
**Post date:** [March 11, 2013, 11:37am UTC](https://www.ruby-forum.com/t/error-installing-gtk2-under-ruby-2-0/227263/6 "2013-03-11T11:37:42Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![lljk](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/a9a28c/32.png) [@lljk](https://www.ruby-forum.com/u/lljk)\
**Post date:** [March 14, 2013, 2:24pm UTC](https://www.ruby-forum.com/t/error-installing-gtk2-under-ruby-2-0/227263/7 "2013-03-14T14:24:49Z")

</div>

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

thanks!

- j
