ashbb / green_shoes

Green Shoes is one of the colorful Shoes written in pure Ruby.
Other
204 stars 37 forks source link

undefined method `create_cairo_context' #2

Closed zzak closed 13 years ago

zzak commented 13 years ago

Environment: ruby 1.9.2p0 (2010-08-18 revision 29036) [i686-linux]

atk (0.20.1)
cairo (1.10.0)
gdkpixbuf (0.20.1)
glib2 (0.20.0)
gtk2 (0.20.1)
pango (0.20.1)
pkg-config (1.0.3)
rake (0.8.7)

Linux Project1201n 2.6.32-24-generic 41-Ubuntu SMP Thu Aug 19 01:12:52 UTC 2010 i686      GNU/Linux

libcairo2-dev

Steps to reproduce: ruby shoes.rb doesn't return anything.

but

$ irb
require '/path/to/shoes.rb'
# otherwise get require error
Shoes.app width: 300, height: 300 do
  para 'Hello world!'
end

Stack trace:

/home/zak/code/green_shoes/shoes/app.rb:57:in `block in para': undefined method `create_cairo_context' for #<Gdk::Window:0x8b11ef0 ptr=0x8acb540>
from /home/zak/code/green_shoes/shoes/app.rb:39:in `call'
from /home/zak/code/green_shoes/shoes/app.rb:39:in `main'
from /home/zak/code/green_shoes/shoes/app.rb:39:in `app'
from (irb):4:in `irb_binding'
from /home/zak/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/irb/workspace.rb:80:in `eval'
from /home/zak/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/irb/workspace.rb:80:in `evaluate'
from /home/zak/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/irb/context.rb:254:in `evaluate'
from /home/zak/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/irb.rb:159:in `block (2 levels) in eval_input'
from /home/zak/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/irb.rb:273:in `signal_status'
from /home/zak/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/irb.rb:156:in `block in eval_input'
from /home/zak/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/irb/ruby-lex.rb:243:in `block (2 levels) in each_top_level_statement'
from /home/zak/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `loop'
from /home/zak/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in `block in each_top_level_statement'
from /home/zak/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/irb/ruby-lex.rb:228:in `catch'
from /home/zak/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/irb/ruby-lex.rb:228:in `each_top_level_statement'
from /home/zak/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/irb.rb:155:in `eval_input'
from /home/zak/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/irb.rb:70:in `block in start'
from /home/zak/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/irb.rb:69:in `catch'
from /home/zak/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/irb.rb:69:in `start'
from /home/zak/.rvm/rubies/ruby-1.9.2-p0/bin/irb:17:in `<main>'
ashbb commented 13 years ago

Thank you for the information. I could reproduce this issue (I got the same error). I guess this issue is due to ruby 1.9.2p0. Because Green Shoes is working well with ruby-1.9.1-p378 on Linux (VirtualBox for Windows) now.

Although on my Windows 7, Green Shoes works with ruby 1.9.2p0...

ashbb commented 13 years ago

Incorrect.
Not due to ruby 1.9.2p0, but rcairo 1.10.0.
I'm not sure this is a bug of rcairo or spec change, though.

Try the following at this time:

gem uninstall cairo
gem uninstall pango
gem uninstall gtk2
gem install cairo '=1.8.1'
gem install pango
gem install gtk2

Green Shoes will work well on Linux.

zzak commented 13 years ago

Sweet, I can get it to work now, but I have to adjust the require's a little.

# samples/sample1.rb
# require '../shoes'
require_relative '../shoes'

And the image is being included irregularly too (it doesn't show up from '../static/gshoes-icon.png'), is this because of the path change in 1.9.2?

steveklabnik commented 13 years ago

I still get this error even when I install cairo 1.8.1, on OSX. :/

steveklabnik commented 13 years ago

FWIW, I set up a Gemfile and used Bundler. Here's my Gemfile.lock.... http://gist.github.com/608281

Do any of those versions look wrong?

steveklabnik commented 13 years ago

ash, can you post what verisons of everything you're using?

ashbb commented 13 years ago

Windows 7:

I've compiled Ruby/GTK2 and rcairo by myself. Look at a note.

So, the following is not helpful, though.

C:\>ruby -v
ruby 1.9.2p0 (2010-08-18) [i386-mingw32]

C:\>gem list

*** LOCAL GEMS ***

gemcutter (0.6.1)
git (1.2.5)
jeweler (1.4.0)
json_pure (1.4.6)
minitest (1.6.0)
nokogiri (1.4.3.1 x86-mingw32)
rake (0.8.7)
rdoc (2.5.8)
rubyforge (2.0.4)

Ubuntu on Virtual Box for Windows 7:

Just only did sudo gem install cairo and pango and gtk2. Look at a note.

ashbb:~$ ruby -v
ruby 1.9.2p0 (2010-08-18 revision 29036) [i686-linux]
ashbb:~$ gem list

*** LOCAL GEMS ***

atk (0.20.1)
cairo (1.8.1)
gdkpixbuf (0.20.1)
glib2 (0.20.0)
green_shoes (0.0.1)
gtk2 (0.20.1)
minitest (1.6.0)
pango (0.20.1)
pkg-config (1.0.3)
rake (0.8.7)
rdoc (2.5.8)
zzak commented 13 years ago

This seems to be fixed with the latest version of the ruby-gtk2 bindings, 0.90.5.

ashbb commented 13 years ago

Wow, good news!