Forum: Ruby-Gnome 2 error installing gtk2 under rvm (again.)

Posted by jake kaiden (lljk)
on 2011-07-28 14:15
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 `<main>'


  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
Posted by Simon Arnaud (sarnaud)
on 2011-08-01 11:58
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
Posted by jake kaiden (lljk)
on 2011-08-01 13:17
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
Posted by Vincent Carmona (vinc-mai)
on 2011-08-02 08:08
(Received via mailing list)
Hi.

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

---

Vincent Carmona
Posted by jake kaiden (lljk)
on 2011-08-02 14:00
Vincent Carmona 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
Posted by Vincent Carmona (vinc-mai)
on 2011-08-02 15:23
(Received via mailing list)
2011/8/2 jake kaiden <ruby-forum-incoming@andreas-s.net>:
> Vincent Carmona 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
> ruby-gnome2-devel-en@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/ruby-...
>



--
Vincent Carmona
Posted by jake kaiden (lljk)
on 2011-08-02 15:48
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
Posted by Vincent Carmona (vinc-mai)
on 2011-08-02 16:49
(Received via mailing list)
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 Carmona
Posted by jake kaiden (lljk)
on 2011-08-04 14:10
Vincent Carmona 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
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.