14 Replies - 67328 Views - Last Post: 09 October 2012 - 02:02 AM Rate Topic: -----

#1 tools  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 68
  • Joined: 26-September 12

Can't load xwruby

Posted 06 October 2012 - 03:42 PM

Hey I have installed the ruby gem for wxruby like this:
56347d1b:~ tools$ sudo gem install wxruby
Successfully installed wxruby-1.9.3-universal-darwin
1 gem installed
Installing ri documentation for wxruby-1.9.3-universal-darwin...
Installing RDoc documentation for wxruby-1.9.3-universal-darwin...
56347d1b:~ tools$ 



And the way I test it like this:
#!/usr/bin/env ruby
require "rubygems"
require "wx"
include Wx

class MinimalApp < App

  def on_init
    Frame.new(nil, -1, "The bare Minimum").show()
  end
end

MinimalApp.new.main_loop



And I get the following error:
/Users/tools/.rvm/rubies/ruby-1.9.3-p194/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/tools/RubymineProjects/Test/Test.rb
Testing started at 12:41 AM ...
/Users/tools/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- wx (LoadError)
	from /Users/tools/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
	from /Users/tools/RubymineProjects/Test/Test.rb:4:in `<top (required)>'
	from -e:1:in `load'
	from -e:1:in `<main>'



Can anyone help me, it happens to everything I have installed since 1.9.3

Is This A Good Question/Topic? 0
  • +

Replies To: Can't load xwruby

#2 sepp2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2113
  • View blog
  • Posts: 3,234
  • Joined: 21-June 11

Re: Can't load xwruby

Posted 06 October 2012 - 04:21 PM

Is the gem tool which you used to install wxruby that of your rvm's ruby distribution or of a global ruby installation? The fact that you invoked it using sudo makes me curious (you wouldn't need sudo to use rvm's gem since that's installed in your home directory).
Was This Post Helpful? 0
  • +
  • -

#3 tools  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 68
  • Joined: 26-September 12

Re: Can't load xwruby

Posted 06 October 2012 - 04:44 PM

I use the systems, because I was told I could
Was This Post Helpful? 0
  • +
  • -

#4 sepp2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2113
  • View blog
  • Posts: 3,234
  • Joined: 21-June 11

Re: Can't load xwruby

Posted 06 October 2012 - 04:55 PM

I'm pretty sure that's not true. Rvm uses its own local ruby installation(s) which are completely separate from your system installation.
Was This Post Helpful? 0
  • +
  • -

#5 tools  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 68
  • Joined: 26-September 12

Re: Can't load xwruby

Posted 06 October 2012 - 05:02 PM

Hmm okay will try on linux instead then, to see if I can get it to work there :/
Was This Post Helpful? 0
  • +
  • -

#6 tools  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 68
  • Joined: 26-September 12

Re: Can't load xwruby

Posted 06 October 2012 - 06:05 PM

Okay I have installed RVM wrongly but it dose not work with system ruby either
Was This Post Helpful? 0
  • +
  • -

#7 NotarySojac  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 53
  • View blog
  • Posts: 428
  • Joined: 30-September 10

Re: Can't load xwruby

Posted 07 October 2012 - 01:18 PM

View Posttools, on 06 October 2012 - 06:05 PM, said:

Okay I have installed RVM wrongly but it dose not work with system ruby either


You might try testing it out in your console.

$  sudo irb
>  require 'wx'
=> true



At least that much should work for you, right? I'm not a mac person, so I don't know how one would proceed, but if you have both rvm and your mac ruby package installed... maybe remove one of the from your system and see if that clear complications up? I had a similar problem on my linux mint installation where I was trying to use a .rb file as a CGI and the root/ www-data user didn't have rvm access and so my temporary answer was actually to install the system ruby package via apt-get to conclude my testing.
Was This Post Helpful? 0
  • +
  • -

#8 tools  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 68
  • Joined: 26-September 12

Re: Can't load xwruby

Posted 07 October 2012 - 02:02 PM

when run with sudo:
>> require 'wx'
LoadError: dlopen(/Library/Ruby/Gems/1.8/gems/wxruby-1.9.3-universal-darwin/lib/wxruby2.bundle, 9): no suitable image found.  Did find:
	/Library/Ruby/Gems/1.8/gems/wxruby-1.9.3-universal-darwin/lib/wxruby2.bundle: no matching architecture in universal wrapper - /Library/Ruby/Gems/1.8/gems/wxruby-1.9.3-universal-darwin/lib/wxruby2.bundle
	from /Library/Ruby/Gems/1.8/gems/wxruby-1.9.3-universal-darwin/lib/wxruby2.bundle
	from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `require'
	from /Library/Ruby/Gems/1.8/gems/wxruby-1.9.3-universal-darwin/lib/wx.rb:12
	from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:60:in `gem_original_require'
	from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:60:in `require'
	from (irb):1
>> 



Was This Post Helpful? 0
  • +
  • -

#9 NotarySojac  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 53
  • View blog
  • Posts: 428
  • Joined: 30-September 10

Re: Can't load xwruby

Posted 07 October 2012 - 07:22 PM

That exact error message is a little over my head, but I think if you're not using rvm, then you really should get it operational if you intend to do any serious ruby coding. One theory is that maybe something about your last ruby install is conflicting with the latest install of 1.9.3 you did.

You should google removing ruby in osx, and then either have this command just work

$  bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)



Or figure out what Wayne is currently suggest as to how to install rvm in OSX.

This post has been edited by NotarySojac: 07 October 2012 - 07:28 PM

Was This Post Helpful? 0
  • +
  • -

#10 sepp2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2113
  • View blog
  • Posts: 3,234
  • Joined: 21-June 11

Re: Can't load xwruby

Posted 08 October 2012 - 02:49 AM

The error message is because you're running a 64-bit ruby, but the gem only contains 32-bit binaries.

You'll need to run ruby in 32-bit mode to work with that wxruby gem. If you want to use rvm's ruby, you might also have to compile it in 32-bit mode to make that work though.

Also you're running ruby 1.8 and the gem is for ruby 1.9.

View PostNotarySojac, on 08 October 2012 - 04:22 AM, said:

You should google removing ruby in osx, and then either have this command just work


Why should he go through all that trouble instead of just installing the gem using rvm's gem command instead of the system's?

Either way that wouldn't fix his 32-bit vs. 64-bit issue.

This post has been edited by sepp2k: 08 October 2012 - 02:53 AM

Was This Post Helpful? 0
  • +
  • -

#11 tools  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 68
  • Joined: 26-September 12

Re: Can't load xwruby

Posted 08 October 2012 - 04:17 AM

Get same error using RVM
But thanks for the info about 64 bit didn't know
Was This Post Helpful? 0
  • +
  • -

#12 sepp2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2113
  • View blog
  • Posts: 3,234
  • Joined: 21-June 11

Re: Can't load xwruby

Posted 08 October 2012 - 04:19 AM

As another note: When you do want to invoke your system's irb, you don't need to use sudo to do so (in fact you shouldn't). Just invoke it using its full path (i.e. /usr/bin/irb or /usr/local/bin/irb or whatever ruby's path is on OSX).
Was This Post Helpful? 0
  • +
  • -

#13 NotarySojac  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 53
  • View blog
  • Posts: 428
  • Joined: 30-September 10

Re: Can't load xwruby

Posted 08 October 2012 - 02:10 PM

View Postsepp2k, on 08 October 2012 - 02:49 AM, said:

View PostNotarySojac, on 08 October 2012 - 04:22 AM, said:

You should google removing ruby in osx, and then either have this command just work


Why should he go through all that trouble instead of just installing the gem using rvm's gem command instead of the system's?


Because as far as I understand, ruby developers should setup their development platforms with rvm and not distribution packages for the added versatility and control. I don't use mac, I use windows and linux and so I find that on my systems, if the ruby package is installed it just complicates debugging matters so I simply remove it as that it is clutter compared to working RVM ruby versions.

You're right about that not impacting 32bit vs 64bit problems though. I did a quick search because I didn't even realise ruby had a 64bit mode and sure enough I found this page:

https://rvm.io/workflow/rvmrc/

Quote

Have RVM compile rubies and libraries as x86_64 on *Mac OS X*.
rvm_archflags="-arch x86_64"



Would putting that line in his ~/.rvmrc file fix his problems?
Was This Post Helpful? 0
  • +
  • -

#14 sepp2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2113
  • View blog
  • Posts: 3,234
  • Joined: 21-June 11

Re: Can't load xwruby

Posted 09 October 2012 - 01:53 AM

The way I understood it the problem is that the wx gem only comes with 32-bit binaries, so compiling ruby as 64-bit is what he doesn't want. If RVM compiles Ruby as 32-bit by default on OSX, the gem should actually work fine using RVM's ruby.
Was This Post Helpful? 0
  • +
  • -

#15 tools  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 68
  • Joined: 26-September 12

Re: Can't load xwruby

Posted 09 October 2012 - 02:02 AM

That is true @sepp2k, my ruby compiler is compiling to 32bit
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1