Forum: wxRuby OS X Snow Leopard + wxRuby 2.0.1 gem - WORKING

06f6780c99d4a8dd71f2b474082ea9ce?d=identicon&s=25 Alex Fenton (Guest)
on 2010-07-07 11:40
(Received via mailing list)
Hi

It is possible to use the standard wxRuby 2.0.1 gem with the standard
system ruby in /usr/bin/ruby in OS X 10.6

1) download the gem

http://rubyforge.org/frs/download.php/63386/wxruby...

2) install it from the downloaded file

sudo gem install wxruby-2.0.1-universal-darwin-9.gem

3) run ruby like this, forcing 32-bit mode

arch -i386 ruby -rubygems <scriptfile.rb>


Have tested with a couple of samples and this works fine. Appreciate any
feedback. Of course, we are still aiming to get full compatibility, but
for various reasons this is quite difficult.

Thanks to some advice on this page (comment #4)
http://weblog.rubyonrails.org/2009/8/30/upgrading-...

alex
01a68e65c05c8751d75dbf957ea4fa23?d=identicon&s=25 Zhimin Zhan (zzhan)
on 2010-07-08 00:00
Thanks Alex.

Tested it with my app on Snow Leopard, it started OK until "require
'nokogiri'"

Here is output:

/Library/Ruby/Gems/1.8/gems/nokogiri-1.4.2/lib/nokogiri/nokogiri.bundle:
dlopen(/Library/Ruby/Gems/1.8/gems/nokogiri-1.4.2/lib/nokogiri/nokogiri.bundle,
9): no suitable image found.  Did find: (LoadError)
        /Library/Ruby/Gems/1.8/gems/nokogiri-1.4.2/lib/nokogiri/nokogiri.bundle:
mach-o, but wrong architecture -
/Library/Ruby/Gems/1.8/gems/nokogiri-1.4.2/lib/nokogiri/nokogiri.bundle


I guess that's because Nokogiri is built with 64-bit.

Zhimin
3396e4a3df8a840faec520af8555a400?d=identicon&s=25 Mario Steele (Guest)
on 2010-07-08 01:27
(Received via mailing list)
That would be correct, you would need a 32 bit copy of nokogiri, in
order
for it to work properly.
01a68e65c05c8751d75dbf957ea4fa23?d=identicon&s=25 Zhimin Zhan (zzhan)
on 2010-07-08 14:40
Alex & Mario,

Yes, My app now works on Snow Leopard (after using 32-bit nokogiri),
Thanks!

Regards,
Zhimin
2d352e436babbf3d80d4a6171220cd5b?d=identicon&s=25 Chloro Form (tony44)
on 2010-09-13 14:13
Sweet. Runs perfectly on my 10.6.4 machine.

Did anyone manage to launch the 32bit ruby environment from Netbeans?

Thanks,
Tony
2885208195c6ed44170cd47d97113503?d=identicon&s=25 Ridge McGhee (rmcghee)
on 2010-12-22 07:28
Some good news...

Alex, your method didn't work for me immediately but I found a method
that works for me and may help others.

I have a MacBook Pro (64-bit) running OS X 10.6.
Like others, I wanted to run Ruby 1.9.2 (latest) and wxRuby 2.0.1
(latest).

I use RVM to install Ruby 1.9.2 (and manage my ruby versions).
(See http://pragmaticstudio.com/blog/2010/9/23/install-...)

By default, RVM builds the Ruby 64-bit version (only).
I finally found a post that indicates how to build both 32-bit and
64-bit versions of Ruby.

Briefly, here's how users can get both built:
rvm install ruby-1.9.2-head -C --with-arch=x86_64,i386

Here's how to check what you have:
file `which ruby` | perl -pe 's|^.*/||'

(Which will produce output like this:)
ruby: Mach-O universal binary with 2 architectures
ruby (for architecture x86_64): Mach-O 64-bit executable x86_64
ruby (for architecture i386):   Mach-O executable i386

Visit:
http://rubyforge.org/frs/?group_id=35

And, download this gem:
wxruby-ruby19-2.0.1-x86-darwin-9.gem

Now, install the gem (no sudo required):
(Note, you may want to cd to your Downloads folder.)
gem install wxruby-ruby19-2.0.1-x86-darwin-9
Successfully installed wxruby-ruby19-2.0.1-x86-darwin-9

Create a wxruby test script (wxtest.rb):
------------------------------------
#!/usr/bin/env arch -i386 ruby

require 'wx'
include Wx

App.run do
  frame = Frame.new(nil, :title => 'So far, so good...')
  frame.show
end
------------------------------------

And run it:
> ruby wxtest.rb


Ok, so this particular working set produced a window.
So, we (or I anyway) have a way to proceed.

Alex - I hope this somehow helps you find out what the problem
(32-bit vs 64-bit) might be.  Any thoughts?

Cheers,
Ridge
06f6780c99d4a8dd71f2b474082ea9ce?d=identicon&s=25 Alex Fenton (Guest)
on 2010-12-22 13:40
(Received via mailing list)
Hi Ridge

On 22/12/2010 06:28, Ridge McGhee wrote:
> I have a MacBook Pro (64-bit) running OS X 10.6.
> Like others, I wanted to run Ruby 1.9.2 (latest) and wxRuby 2.0.1
> (latest).
That sounds similar to my setup.

> I use RVM to install Ruby 1.9.2 (and manage my ruby versions).
> (See http://pragmaticstudio.com/blog/2010/9/23/install-...)
>
> By default, RVM builds the Ruby 64-bit version (only).
> I finally found a post that indicates how to build both 32-bit and
> 64-bit versions of Ruby.

I hadn't come across RVM - this looks great.

> Ok, so this particular working set produced a window.
> So, we (or I anyway) have a way to proceed.
>
> Alex - I hope this somehow helps you find out what the problem
> (32-bit vs 64-bit) might be.  Any thoughts?

I'm just headed off for xmas so won't have a go at this til new year -
but it sounds very promising as a way to restart development on the
stable branch with 10.6. What I'll need to test is that I can use this
ruby to compile against wxWidgets 2.8 - which is what has been the
headache so far.

best wishes
alex
2a3c1db984fb35451ac7a8487113d48c?d=identicon&s=25 tiger zen (puti313)
on 2012-11-28 08:13
bad news
the output is:
/Users/rubyzen/rubymineprojects/wxruby/first_window.rb
arch: posix_spawnp: ruby: Bad CPU type in executable

kouheimatoMacBook-Air:wxruby rubyzen$ arch -i386 ruby -rubygems
/Users/rubyzen/rubymineprojects/wxruby/first_window.rb
arch: posix_spawnp: ruby: Bad CPU type in executable

xiong-kouheimatoMacBook-Air:wxruby rubyzen$ arch
i386

xiong-kouheimatoMacBook-Air:wxruby rubyzen$ ruby -v
ruby 1.9.2p320 (2012-04-20 revision 35421) [x86_64-darwin10.8.0]
xiong-kouheimatoMacBook-Air:wxruby rubyzen$ which ruby
/Users/rubyzen/.rvm/rubies/ruby-1.9.2-p320/bin/ruby
xiong-kouheimatoMacBook-Air:wxruby rubyzen$ gem q -d -n wxruby
/Users/rubyzen/.rvm/rubies/ruby-1.9.2-p320/bin/gem:4: warning: Insecure
world writable dir /usr in PATH, mode 040777

*** LOCAL GEMS ***

wxruby (2.0.1)
    Platform: universal-darwin-9
    Author: wxRuby development team
    Rubyforge: http://rubyforge.org/projects/wxruby
    Homepage: http://wxruby.org/
    Installed at: /Users/rubyzen/.rvm/gems/ruby-1.9.2-p320

    Ruby interface to the wxWidgets GUI library
xiong-kouheimatoMacBook-Air:wxruby rubyzen$ file
/Users/rubyzen/.rvm/rubies/ruby-1.9.2-p320/bin/ruby
/Users/rubyzen/.rvm/rubies/ruby-1.9.2-p320/bin/ruby: Mach-O 64-bit
executable x86_64

xiong-kouheimatoMacBook-Air:lib rubyzen$ file wxruby2.bundle
wxruby2.bundle: Mach-O universal binary with 2 architectures
wxruby2.bundle (for architecture ppc):  Mach-O bundle ppc
wxruby2.bundle (for architecture i386):  Mach-O bundle i386


Alex Fenton wrote in post #923756:
> Hi
>
> It is possible to use the standard wxRuby 2.0.1 gem with the standard
> system ruby in /usr/bin/ruby in OS X 10.6
>
> 1) download the gem
>
> http://rubyforge.org/frs/download.php/63386/wxruby...
>
> 2) install it from the downloaded file
>
> sudo gem install wxruby-2.0.1-universal-darwin-9.gem
>
> 3) run ruby like this, forcing 32-bit mode
>
> arch -i386 ruby -rubygems <scriptfile.rb>
>
>
> Have tested with a couple of samples and this works fine. Appreciate any
> feedback. Of course, we are still aiming to get full compatibility, but
> for various reasons this is quite difficult.
>
> Thanks to some advice on this page (comment #4)
> http://weblog.rubyonrails.org/2009/8/30/upgrading-...
>
> alex
7039143c5e41c8abdb2ed53499897ee8?d=identicon&s=25 jerome jerome (un_autre_jerome)
on 2013-08-07 05:22
Alex Fenton wrote in post #923756:
> Hi
>
> It is possible to use the standard wxRuby 2.0.1 gem with the standard
> system ruby in /usr/bin/ruby in OS X 10.6
>
> 1) download the gem
>
> http://rubyforge.org/frs/download.php/63386/wxruby...
>
> 2) install it from the downloaded file
>
> sudo gem install wxruby-2.0.1-universal-darwin-9.gem
>
> 3) run ruby like this, forcing 32-bit mode
>
> arch -i386 ruby -rubygems <scriptfile.rb>
>
>
> Have tested with a couple of samples and this works fine. Appreciate any
> feedback. Of course, we are still aiming to get full compatibility, but
> for various reasons this is quite difficult.
>
> Thanks to some advice on this page (comment #4)
> http://weblog.rubyonrails.org/2009/8/30/upgrading-...
>
> alex

Hello,

I tried this and for me, that's not works.

I install ruby-1.9.3-p448 with rvm
and then, install wxruby-2.0.1-darwin from gem source
and then, call ruby on i386 (wich is my arch) for my hello.rb file (who
use wx code)

but this said my that it is the bad cpu...

do you have an idea ?
89f9acdcbc663e41e45ce590cd746d6e?d=identicon&s=25 Fabio Petrucci (biospank)
on 2013-08-07 10:22
(Received via mailing list)
install ruby 1.9

rvm install 1.9.3 -C --with-arch=i386

switch to ruby 1.9.3 (rvm use...)

install this version:
http://rubyforge.org/frs/download.php/63385/wxruby...

and run your script:

ruby <yourscript.rb>

it works for me.

Cheers,

fabio.
7039143c5e41c8abdb2ed53499897ee8?d=identicon&s=25 jerome jerome (un_autre_jerome)
on 2013-08-07 14:06
Fabio Petrucci wrote in post #1117980:
> install ruby 1.9
>
> rvm install 1.9.3 -C --with-arch=i386
>
> switch to ruby 1.9.3 (rvm use...)
>
> install this version:
> http://rubyforge.org/frs/download.php/63385/wxruby...
>
> and run your script:
>
> ruby <yourscript.rb>
>
> it works for me.
>
> Cheers,
>
> fabio.

Thanks Fabio, now the server seems to works great and i can have my
ruby-1.9.3-p448 universal (because, the ruby package from githurb is
not... i give him, and try this before for change the arch compilation
for install , but it is not the same package... github on the site talk
about no have implementation down to osx-10.7 for his GUI software and
said that it is because fo some tools that is not in osx-10.6.8 ... so
maybe that is why also they don't have the complete ruby package
universal... i'm really sorry with this segregation from github.com
....) and that's works great for me also.

But... do you have the same warning about libyaml ?
I try to install this from rvm (rvm install yaml... rvm install libyaml,
etc...) without any success. (it is really difficult to have something
good on osx-10.6.8... but i don't want to change for osx-10.7... and i
don't like the new politic and practice of apple for lot of thinks...

if you find solution for libyaml warning, i give it so...
if i find before, i take it so.

thanks Fabio
7039143c5e41c8abdb2ed53499897ee8?d=identicon&s=25 jerome jerome (un_autre_jerome)
on 2013-08-07 15:07
ok, i find this:
http://stackoverflow.com/questions/10724983/libyam...

they talk about doing an i386 install of libyaml with this code:

CONFIGURE_OPTS="--with-arch=i386" CFLAGS="-arch i386" LDFLAGS="-arch
i386" rvm pkg install libyaml

and so, reinstall the ruby (same code, but reinstall in place of install
not works for me: error -j2) with exactly same procedure from rvm
install -C again...

I just do it, and so...

not works, error -j2.

i will see again tomorrow.
7039143c5e41c8abdb2ed53499897ee8?d=identicon&s=25 jerome jerome (un_autre_jerome)
on 2013-08-08 01:48
ok, hello again, i find it:

0 with the jewerlybox i update rvm to the nex last version (can do by
terminal)
1 remove all ruby-1.9.3 sources from Users/"HOME"/.rvm/src and
/Users/"HOME"/.rvm/archive
2 rvm get head
3 rvm reload
4 rvm install 1.9.3 -C --with-arch=i386  (again)
5 rvm use 1.9.3

that's works for me, no more libyaml warnings (so, irb can be use to).

thanks to everybody for read and help, and have a good day.
7039143c5e41c8abdb2ed53499897ee8?d=identicon&s=25 jerome jerome (un_autre_jerome)
on 2013-08-31 03:17
also, i find something maybe i,nterest you about osx-10.6.X
you can change your arch from boot (push buttons "6" and "4" in the same
time) for x86_64.
And then, try it and if of, you can also change definitively for this
arch (go for a look on apple site about "change arch from 32 to 64
bits"), it is really simple (don't follow other link where all is more
complicate for nothing more).

after that, install will be more easy for all dependencies.

(so... if you have some virtual machines, maybe take care about
necessity to reinstall them again...)
This topic is locked and can not be replied to.