Error installing gtk2 under rvm (again.)

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:inrequire’
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:inrequire’
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:inrequire’
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:inrequire’
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

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

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

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

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

2011/8/2 jake kaiden [email protected]:

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
[email protected]
ruby-gnome2-devel-en List Signup and Options


Vincent C.

Hi.

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


Vincent C.

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.

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

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