Not logged inGosu Forums
Forum back to libgosu.org Help Search Register Login
Up Topic Gosu / Gosu Exchange / OS X error: 'no such file to load'
- - By ? Date 2010-11-22 10:14
Surely I'm overlooking something trivial?
I'll go step by step...

I'm running OS X -v 10.6.5

$ ruby -v
version is: ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin9.7.0]

$ which ruby
/usr/local/bin/ruby

$ gem -v
1.3.7

$ which gem
/usr/local/bin/gem

$ sudo gem install gosu

$ gem which gosu
/usr/local/lib/ruby/gems/1.8/gems/gosu-0.7.25-universal-darwin/lib/gosu.rb

I create  gosutest.rb with the following:

require 'rubygems' # Remove this line if you aren't using RubyGems
require 'gosu'

class MyWindow < Gosu::Window
  def initialize
    super(640, 480, false)
    self.caption = 'Hello World!'
  end
end

w = MyWindow.new
w.show

$ ruby gosutest.rb

/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in gem_original_require': no such file to load -- /usr/local/lib/ruby/gems/1.8/gems/gosu-0.7.25-universal-darwin/lib/gosu.bundle (LoadError)
  from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
require'
  from /usr/local/lib/ruby/gems/1.8/gems/gosu-0.7.25-universal-darwin/lib/gosu.rb:12
  from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in gem_original_require'
  from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in
require'
  from gosutest.rb:2

What am I missing here?

Regards,
Chris
Parent - - By ? Date 2010-11-22 10:18
Also, I've tried running Tutorial.rb in the examples directory with the same error.
Parent - - By jlnr (dev) Date 2010-11-22 10:24
Gosu tries to load "gosu.bundle" (which you shouldn't have) if loading "gosu.for_1_8.bundle" fails. See lib/gosu.rb:


  require "#{File.dirname(__FILE__)}/gosu.for_#{version}.#{Config::CONFIG['DLEXT']}"
  require "#{File.dirname(__FILE__)}/gosu/swig_patches.rb"
rescue LoadError => e
  require "#{File.dirname(__FILE__)}/gosu.#{Config::CONFIG['DLEXT']}"
  require "#{File.dirname(__FILE__)}/gosu/swig_patches.rb"


If you comment the whole rescue portion out, you should get the original exception. Can you post its message? (I should really change that part in gosu.rb)
Parent - By ? Date 2010-11-22 21:01
Thanks for the quick reply, Julian! As it turns out, my Ruby.framework is missing...

I commented out the rescue block like so:

require 'rbconfig'

begin
  if defined? RUBY_VERSION and RUBY_VERSION[0..2] == '1.9' then
    version = '1_9'
  else
    version = '1_8'
  end
  require "#{File.dirname(__FILE__)}/gosu.for_#{version}.#{Config::CONFIG['DLEXT']}"
  require "#{File.dirname(__FILE__)}/gosu/swig_patches.rb"
#rescue LoadError => e
#  require "#{File.dirname(__FILE__)}/gosu.#{Config::CONFIG['DLEXT']}"
#  require "#{File.dirname(__FILE__)}/gosu/swig_patches.rb"

end

require "#{File.dirname(__FILE__)}/gosu/patches.rb"


And get the following error:

/usr/local/lib/ruby/gems/1.8/gems/gosu-0.7.25-universal-darwin/lib/gosu.for_1_8.bundle: dlopen(/usr/local/lib/ruby/gems/1.8/gems/gosu-0.7.25-universal-darwin/lib/gosu.for_1_8.bundle, 9): Library not loaded: /usr/lib/libruby.1.dylib (LoadError)
  Referenced from: /usr/local/lib/ruby/gems/1.8/gems/gosu-0.7.25-universal-darwin/lib/gosu.for_1_8.bundle
  Reason: image not found - /usr/local/lib/ruby/gems/1.8/gems/gosu-0.7.25-universal-darwin/lib/gosu.for_1_8.bundle
  from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in require'
  from /usr/local/lib/ruby/gems/1.8/gems/gosu-0.7.25-universal-darwin/lib/gosu.rb:9
  from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in
gem_original_require'
  from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
  from x.rb:8


Here is the contents of my /usr/local/lib/ruby/gems/1.8/gems/gosu-0.7.25-universal-darwin/lib directory:

gosu     
gosu.for_1_8.bundle 
gosu.for_1_9.bundle 
gosu.rb


So yeah, no gosu.bundle.

I looked for /usr/lib/libruby.1.dylib and saw that it was a broken alias. After some further investigation I learned that it should point to ../../System/Library/Frameworks/Ruby.framework/Versions/Current/usr/lib/libruby.1.dylib. Somehow, I'm not sure how or why, my /System/Library/Frameworks/Ruby.framework doesn't exist. I'll correct this.

Thanks for the help in hunting this down.
Up Topic Gosu / Gosu Exchange / OS X error: 'no such file to load'

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill