# Error installing gtk2 under rvm (again.)

**URL:** <https://www.ruby-forum.com/t/error-installing-gtk2-under-rvm-again/210017>\
**Category:** Ruby-Gnome 2\
**Created:** [July 28, 2011, 2:15pm UTC](https://www.ruby-forum.com/t/error-installing-gtk2-under-rvm-again/210017 "2011-07-28T14:15:37Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [July 28, 2011, 2:15pm UTC](https://www.ruby-forum.com/t/error-installing-gtk2-under-rvm-again/210017/1 "2011-07-28T14:15:37Z")

</div>

hey folks,

well, i’m eager to try out gtk2 1.0, but i still get errors trying to  
install - not sure what the problem is. here’s what i get with a fresh  
install of 1.9.2 patch 180 under rvm on ubuntu 10.4 lucid:

jk@jk-laptop:~$ rvm use 1.9.2  
Using /home/jk/.rvm/gems/ruby-1.9.2-p180

jk@jk-laptop:~$ gem install -r gtk2  
Fetching: glib2-1.0.0.gem (100%)  
Building native extensions. This could take a while…  
Fetching: atk-1.0.0.gem (100%)  
Building native extensions. This could take a while…  
Fetching: pango-1.0.0.gem (100%)  
Building native extensions. This could take a while…  
Fetching: gdk\_pixbuf2-1.0.0.gem (100%)  
Building native extensions. This could take a while…  
Fetching: gtk2-1.0.0.gem (100%)  
Building native extensions. This could take a while…  
Successfully installed glib2-1.0.0  
Successfully installed atk-1.0.0  
Successfully installed pango-1.0.0  
Successfully installed gdk\_pixbuf2-1.0.0  
Successfully installed gtk2-1.0.0  
5 gems installed  
Installing ri documentation for glib2-1.0.0…  
Installing ri documentation for atk-1.0.0…  
Installing ri documentation for pango-1.0.0…  
Installing ri documentation for gdk\_pixbuf2-1.0.0…  
Installing ri documentation for gtk2-1.0.0…  
Installing RDoc documentation for glib2-1.0.0…  
Installing RDoc documentation for atk-1.0.0…  
Installing RDoc documentation for pango-1.0.0…  
Installing RDoc documentation for gdk\_pixbuf2-1.0.0…  
Installing RDoc documentation for gtk2-1.0.0…

jk@jk-laptop:~$ irb  
ruby-1.9.2-p180 :001 \> require ‘gtk2’  
NameError: uninitialized constant Gdk::Drawable  
from  
/home/jk/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site\_ruby/1.9.1/rubygems/custom\_require.rb:36:in  
`require' from /home/jk/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in`require’  
from  
/home/jk/.rvm/gems/ruby-1.9.2-p180/gems/gtk2-1.0.0/lib/gtk2/base.rb:25:in  
`rescue in <top (required)>' from /home/jk/.rvm/gems/ruby-1.9.2-p180/gems/gtk2-1.0.0/lib/gtk2/base.rb:21:in`\<top (required)\>’  
from  
/home/jk/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site\_ruby/1.9.1/rubygems/custom\_require.rb:36:in  
`require' from /home/jk/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in`require’  
from  
/home/jk/.rvm/gems/ruby-1.9.2-p180/gems/gtk2-1.0.0/lib/gtk2.rb:11:in  
`<top (required)>' from /home/jk/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:58:in`require’  
from  
/home/jk/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site\_ruby/1.9.1/rubygems/custom\_require.rb:58:in  
`rescue in require' from /home/jk/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:in`require’  
from (irb):1  
from /home/jk/.rvm/rubies/ruby-1.9.2-p180/bin/irb:16:in `’

any ideas what the problem is? i’d really like to try it out, but i  
can’t seem to install gtk except version 0.19.3 through my package  
manager.

thanks,

-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:** [August 1, 2011, 11:58am UTC](https://www.ruby-forum.com/t/error-installing-gtk2-under-rvm-again/210017/2 "2011-08-01T11:58:27Z")

</div>

jake kaiden wrote in post #1013535:

> any ideas what the problem is? i’d really like to try it out, but i  
> can’t seem to install gtk except version 0.19.3 through my package  
> manager.

Take a look here for some dependencies :  
[http://packages.ubunut.com/it/natty/libgtk2-ruby1.8](http://packages.ubunut.com/it/natty/libgtk2-ruby1.8)

When I install gtk2 from a fresh rvm 1.9.2-p290, it also pulls out  
cairo. I don’t know why yours don’t. Already installed ?

Simon

---

<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:** [August 1, 2011, 1:17pm UTC](https://www.ruby-forum.com/t/error-installing-gtk2-under-rvm-again/210017/3 "2011-08-01T13:17:07Z")

</div>

hi Simon,

thanks for the input. must have had cairo already installed… i  
wiped out all the gems and started from scratch - gems install just  
fine, but i get an error installing the ri documentation for cairo:

$ rvm use 1.9.2  
Using /home/jk/.rvm/gems/ruby-1.9.2-p180

$ gem install -r gtk2  
Fetching: pkg-config-1.1.2.gem (100%)  
Fetching: glib2-1.0.0.gem (100%)  
Building native extensions. This could take a while…  
Fetching: atk-1.0.0.gem (100%)  
Building native extensions. This could take a while…  
Fetching: cairo-1.10.0.gem (100%)  
Building native extensions. This could take a while…  
Fetching: pango-1.0.0.gem (100%)  
Building native extensions. This could take a while…  
Fetching: gdk\_pixbuf2-1.0.0.gem (100%)  
Building native extensions. This could take a while…  
Fetching: gtk2-1.0.0.gem (100%)  
Building native extensions. This could take a while…  
Successfully installed pkg-config-1.1.2  
Successfully installed glib2-1.0.0  
Successfully installed atk-1.0.0  
Successfully installed cairo-1.10.0  
Successfully installed pango-1.0.0  
Successfully installed gdk\_pixbuf2-1.0.0  
Successfully installed gtk2-1.0.0  
7 gems installed  
Installing ri documentation for pkg-config-1.1.2…  
Installing ri documentation for glib2-1.0.0…  
Installing ri documentation for atk-1.0.0…  
Installing ri documentation for cairo-1.10.0…

RDoc::Parser::Ruby failure around line 131 of  
lib/cairo.rb

Before reporting this, could you check that the file you’re documenting  
compiles cleanly–RDoc is not a full Ruby parser, and gets confused  
easily if  
fed invalid programs.

The internal error was:

(RDoc::Error) Name or symbol expected (got  
#RDoc::RubyToken::TkSTAR:0xa09801c)

ERROR: While generating documentation for cairo-1.10.0  
… MESSAGE: Name or symbol expected (got  
#RDoc::RubyToken::TkSTAR:0xa09801c)  
… RDOC args: --ri --op  
/home/jk/.rvm/gems/ruby-1.9.2-p180/doc/cairo-1.10.0/ri --main README.txt  
lib --title cairo-1.10.0 Documentation --quiet

i get the same error as in the above post when requiring gtk2 -  
NameError: uninitialized constant Gdk::Drawable

frustrating…

- 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:** [August 2, 2011, 2:00pm UTC](https://www.ruby-forum.com/t/error-installing-gtk2-under-rvm-again/210017/4 "2011-08-02T14:00:09Z")

</div>

Vincent C. wrote in post #1014357:

> Hi.
> 
> Can you check which files were loaded after requiring gtk2?  
> Maybe the so file is loaded instead of the rb one.

hi Vincent -

not sure how to go about checking that…  
this line of the error:  
/home/jk/.rvm/gems/ruby-1.9.2-p180/gems/gtk2-1.0.0/lib/gtk2.rb:11:in  
`\<top (required)\>’  
…leads me to the directory indicated, where i find both a gtk2.rb  
file, and gtk2.so - am i on the right track? if so, any ideas about how  
i can check which is being loaded?

thanks,

- 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:** [August 2, 2011, 3:23pm UTC](https://www.ruby-forum.com/t/error-installing-gtk2-under-rvm-again/210017/5 "2011-08-02T15:23:10Z")

</div>

2011/8/2 jake kaiden [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> Vincent C. wrote in post #1014357:
> 
> > Hi.
> > 
> > Can you check which files were loaded after requiring gtk2?  
> > Maybe the so file is loaded instead of the rb one.
> 
> hi Vincent -
> 
> not sure how to go about checking that…

By looking at the $" variable.

> ruby-gnome2-devel-en mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en](https://lists.sourceforge.net/lists/listinfo/ruby-gnome2-devel-en)

–  
Vincent C.

---

<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:** [August 2, 2011, 8:08am UTC](https://www.ruby-forum.com/t/error-installing-gtk2-under-rvm-again/210017/6 "2011-08-02T08:08:53Z")

</div>

Hi.

Can you check which files were loaded after requiring gtk2?  
Maybe the so file is loaded instead of the rb one.

* * *

Vincent C.

---

<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:** [August 2, 2011, 4:49pm UTC](https://www.ruby-forum.com/t/error-installing-gtk2-under-rvm-again/210017/7 "2011-08-02T16:49:13Z")

</div>

I do not have ruby at the moment so I cannot help you…  
But I am guessing that you should look at gtk2/base.rb file.

–  
Vincent C.

---

<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:** [August 2, 2011, 3:48pm UTC](https://www.ruby-forum.com/t/error-installing-gtk2-under-rvm-again/210017/8 "2011-08-02T15:48:39Z")

</div>

hi,

here’s a list of what i think are the pertinent files loaded after  
requiring gtk2:  
…  
…  
“/home/jk/.rvm/gems/ruby-1.9.2-p180/gems/glib2-1.0.0/lib/glib2.so”  
“/home/jk/.rvm/gems/ruby-1.9.2-p180/gems/glib2-1.0.0/lib/glib2.rb”  
“/home/jk/.rvm/gems/ruby-1.9.2-p180/gems/atk-1.0.0/lib/atk.so”  
“/home/jk/.rvm/gems/ruby-1.9.2-p180/gems/atk-1.0.0/lib/atk.rb”  
…cairo stuff  
“/home/jk/.rvm/gems/ruby-1.9.2-p180/gems/cairo-1.10.0/lib/cairo.so”  
…cairo stuff  
“/home/jk/.rvm/gems/ruby-1.9.2-p180/gems/cairo-1.10.0/lib/cairo.rb”  
“/home/jk/.rvm/gems/ruby-1.9.2-p180/gems/pango-1.0.0/lib/pango.so”  
“/home/jk/.rvm/gems/ruby-1.9.2-p180/gems/pango-1.0.0/lib/pango.rb”  
“/home/jk/.rvm/gems/ruby-1.9.2-p180/gems/gdk\_pixbuf2-1.0.0/lib/gdk\_pixbuf2.so”  
“/home/jk/.rvm/gems/ruby-1.9.2-p180/gems/gdk\_pixbuf2-1.0.0/lib/gdk\_pixbuf2.rb”

i don’t see anything loaded for gtk2 (neither .rb, nor .so,) though my  
gem list shows it as installed. i imagine this is because the require  
failed, and gtk2 was never loaded?

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:** [August 4, 2011, 2:10pm UTC](https://www.ruby-forum.com/t/error-installing-gtk2-under-rvm-again/210017/9 "2011-08-04T14:10:49Z")

</div>

Vincent C. wrote in post #1014500:

> … I am guessing that you should look at gtk2/base.rb file.

thanks for the tip - when i looked at the base.rb file, line 25 was  
“require ‘gtk2.so’,” which i changed to “require ‘gtk2.rb’…”

i now get this error when i require ‘gtk2’ in irb:

ruby-1.9.2-p180 :001 \> require ‘gtk2’  
NoMethodError: undefined method `cairo_available?' for Gdk:Module from /home/jk/.rvm/gems/ruby-1.9.2-p180/gems/gtk2-1.0.0/lib/gtk2/base.rb:32:in `\<top (required)\>’  
…

a look at Gdk’s methods with “Gdk.methods.sort.each{|m| p m}” shows no  
#cairo\_available? method, nor anything similar.

at least it’s a different error… is this progress? any ideas about  
what’s going on here?

thanks again,

j
