[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

[Mac OS X] rubygems and wxRuby

unbewusst.sein

5/10/2008 9:11:00 AM


i wanted to test wxRuby with the simplest script :
------------------------------------------------------------------------
#! /usr/bin/env ruby

# If you installed the wxruby gem, uncomment the following two lines:
require 'rubygems'
#gem 'wxruby-1.9.3-universal-darwin' #'wxruby2-preview'
# or the name of the gem you installed
#gem 'wxruby-1.9.3' #'wxruby2-preview'
gem 'wxruby'
require "wxruby" # wxruby 0.6.0
# OR
require "wx" # wxruby2
include Wx


class MinimalApp < App
def on_init
Frame.new(nil, -1, "The Bare Minimum").show()
end
end
------------------------------------------------------------------------

I've installed "wxruby-1.9.3-universal-darwin"

for the "gem" line if i use :
gem 'wxruby-1.9.3-universal-darwin' or
gem 'wxruby-1.9.3' i get an error :
/opt/local/lib/ruby/site_ruby/1.8/rubygems.rb:499:in
`report_activate_error': Could not find RubyGem wxruby-1.9.3 (>= 0)
(Gem::LoadError)
from /opt/local/lib/ruby/site_ruby/1.8/rubygems.rb:131:in
`activate'
from /opt/local/lib/ruby/site_ruby/1.8/rubygems.rb:49:in `gem'
from ./essai.rb:6


and, if i comment this line, i get an error with the following (require
"wxruby") :
/opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require': no such file to load -- wxruby (LoadError)
from
/opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require'
from ./essai.rb:8

obviously i've verified wxruby is installed :
$ gem list --local w

*** LOCAL GEMS ***

wx_sugar (0.1.20)
wxruby (1.9.3)

the installation of wxruby and wx_sugar have been done thru gem.
i didn't install anything (no dependencies)


MinimalApp.new.main_loop


--
Une Bévue
7 Answers

Alex Fenton

5/10/2008 9:46:00 AM

0

Une Bévue wrote:
> i wanted to test wxRuby with the simplest script :

As the wiki states, it's better to start with the samples bundled with
wxruby. Many of the examples on the wiki are dated.

On OS X, you can find the samples that installed with the gem at:

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/user-gems/1.8/gems/wxruby-1.9.5-universal-darwin-9/samples/


basically you want just

require "rubygems"
require "wx"

at the start of your script.

> I've installed "wxruby-1.9.3-universal-darwin"

the latest gem version is 1.9.6; I recommend you install that.

There are dedicated mailing lists for wxruby questions:
http://wxruby.rubyforge.org/wiki/wiki.pl?Ma...

alex

unbewusst.sein

5/10/2008 10:42:00 AM

0

Alex Fenton <alex@deleteme.pressure.to> wrote:

>
> the latest gem version is 1.9.6; I recommend you install that.

Thanks for all.

i've installed wxruby by gem:
$ sudo gem install wxruby
then i wonder why i didn't get the latest version...
i'll uninstall and re-install after download.

also at the time being i get :
ruby
/opt/local/lib/ruby/gems/1.8/gems/wxruby-1.9.3-universal-darwin/samples/
minimal/minimal.rb
dyld: NSLinkModule() error
dyld: Library not loaded: /usr/lib/libiconv.2.dylib
Referenced from:
/opt/local/lib/ruby/gems/1.8/gems/wxruby-1.9.3-universal-darwin/lib/wxru
by2.bundle
Reason: Incompatible library version: wxruby2.bundle requires version
7.0.0 or later, but libiconv.2.dylib provides version 5.0.0
zsh: trace trap ruby

this is because (?) my ruby install has been done thru MacPorts:
$ which ruby
/opt/local/bin/ruby

$ ruby --version
ruby 1.8.6 (2007-09-24 patchlevel 111) [powerpc-darwin8.11.0]

and the dylib is under /opt :
$ locate libiconv.2.dylib
[...]
/opt/local/lib/libiconv.2.dylib
[...]

for those reasons i think it's best for me to compile wxruby ?
--
Une Bévue

unbewusst.sein

5/10/2008 10:56:00 AM

0

Une Bévue <unbewusst.sein@weltanschauung.com.invalid> wrote:

> for those reasons i think it's best for me to compile wxruby ?

NO because the README recommends using gem, however :

~/work/Ruby/wxruby%> sudo gem install wxruby --version '>= 1.9.6'
ERROR: could not find wxruby locally or in a repository

may be the server is down, because i did it yesterday that way :
$ sudo gem install wxruby
Password:
Updating metadata for 12 gems from http://gems.ruby...
.............
complete
Successfully installed wxruby-1.9.3-universal-darwin
1 gem installed


--
Une Bévue

Alex Fenton

5/10/2008 11:07:00 AM

0

Une Bévue wrote:

> i've installed wxruby by gem:
> $ sudo gem install wxruby
> then i wonder why i didn't get the latest version...
> i'll uninstall and re-install after download.

What version of OS X are you using?

> also at the time being i get :
> ruby
> /opt/local/lib/ruby/gems/1.8/gems/wxruby-1.9.3-universal-darwin/samples/
> minimal/minimal.rb
> dyld: NSLinkModule() error
> dyld: Library not loaded: /usr/lib/libiconv.2.dylib
> Referenced from:
> /opt/local/lib/ruby/gems/1.8/gems/wxruby-1.9.3-universal-darwin/lib/wxru
> by2.bundle
> Reason: Incompatible library version: wxruby2.bundle requires version
> 7.0.0 or later, but libiconv.2.dylib provides version 5.0.0
> zsh: trace trap ruby

This may be part of the same problem.

> for those reasons i think it's best for me to compile wxruby ?

Maybe, it's not hard if you have XCode installed. Unless you want to use
advanced features like OpenGL or Scintilla, you just compile wxWidgets
(./configure; make; make install) and then wxRuby (rake; then either
rake install or rake gem)

http://wxruby.rubyforge.org/wiki/wiki.pl?Installing...
http://wxruby.rubyforge.org/wiki/wiki.pl?HowToBuil...

a

unbewusst.sein

5/10/2008 11:55:00 AM

0

Alex Fenton <alex@deleteme.pressure.to> wrote:

>
> What version of OS X are you using?

10.4.11

--
Une Bévue

Alex Fenton

5/10/2008 12:09:00 PM

0

Une Bévue wrote:
> Alex Fenton <alex@deleteme.pressure.to> wrote:
>
>> What version of OS X are you using?
>
> 10.4.11

If you're using 10.4, you'll need to use wxRuby version 1.9.4 or later.
1.9.7 is current. All recent versions are specifically built to be
compatible with 10.4 or 10.5.

Unfortunately about the same time rubygems became more pedantic about
compiler versions, which is why I guess you're not getting offered the
latest via remote gem install. I suggest you download it from here:

http://rubyforge.org/frs/?g...

and install locally ("sudo gem install wxruby" in the folder where the
downloaded gem is saved).

if you have any further problems, please follow up on the wxruby-users
mailing list.

a

unbewusst.sein

5/10/2008 12:31:00 PM

0

Alex Fenton <alex@deleteme.pressure.to> wrote:

> if you have any further problems, please follow up on the wxruby-users
> mailing list.

OK, i did subscribe to it.

right now i get a "welcome to wxRuby" from :

$> ruby
/opt/local/lib/ruby/gems/1.8/gems/wxruby-1.9.7-universal-darwin-9/sample
s/minimal/minimal.rb

thanks a lot !
--
Une Bévue