Install question on Mac

View: New views
8 Messages — Rating Filter:   Alert me  

Install question on Mac

by Pito Salas :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

This question has come through before, but I can't come up with a
solution based on reading many threads etc so please bear with me with
a simple question. I am on Mac, and manage my installs via port and
gems. Here's the state of things:

... I seem to have Fox itself properly installed:

$ port info foxfox @1.6.34, Revision 1 (x11)
Variants:    universal

FOX is a C++ based Toolkit for developing Graphical User Interfaces
easily and effectively.
Homepage:    http://www.fox-toolkit.org/

Build Dependencies:   pkgconfig
Library Dependencies: tiff, libpng, jpeg, xorg-libXcursor, Xft2,
xorg-libXrandr, freetype
Platforms:            darwin
Maintainers:          lyle@...

... I also seem to have the gem properly installed:

$gem list fxruby

*** LOCAL GEMS ***

fxruby (1.6.19)
$

... and yet when I run this hello world example:

require 'fox16'
include Fox
theApp = FXApp.new
theMainWindow = FXMainWindow.new(theApp, "Hello")
theApp.create
theMainWindow.show
theApp.run

... I get this obnoxious error

$ ruby play1.rb
/opt/local/lib/ruby/gems/1.8/gems/fxruby-1.6.19-universal-darwin-9/ext/fox16/fox16.bundle:
dlopen(/opt/local/lib/ruby/gems/1.8/gems/fxruby-1.6.19-universal-darwin-9/ext/fox16/fox16.bundle,
9): Library not loaded:
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/libruby.1.dylib
(LoadError)
  Referenced from:
/opt/local/lib/ruby/gems/1.8/gems/fxruby-1.6.19-universal-darwin-9/ext/fox16/fox16.bundle
  Reason: image not found -
/opt/local/lib/ruby/gems/1.8/gems/fxruby-1.6.19-universal-darwin-9/ext/fox16/fox16.bundle
        from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in
`require'
        from play1.rb:1
$

QUESTIONS:

- can anyone see what's wrong?
- is the fact that the port install of Fox says "X11" mean that
there's no native mac binding for fox?

Thanks!!

Pito
_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users

Re: Install question on Mac

by eddy-44 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I don't have a mac, but on my linux setups I need to require 'rubygems'
before require 'fox16'.  Maybe it's the same on macos?

Hmmm maybe I should go buy a mac and find out.

Pito Salas wrote:
> Hi all,
>
> This question has come through before, but I can't come up with a
> solution based on reading many threads etc so please bear with me with
> a simple question. I am on Mac, and manage my installs via port and
> gems. Here's the state of things:
>  

_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users

Re: Install question on Mac

by Lyle Johnson-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Apr 28, 2009, at 9:53 AM, Pito Salas wrote:

> This question has come through before, but I can't come up with a
> solution based on reading many threads etc so please bear with me with
> a simple question. I am on Mac, and manage my installs via port and
> gems. Here's the state of things:

<snip>

Based on the error messages, it looks like:

  * You're running the MacPorts version of Ruby (not the Ruby that's  
included with OS X Leopard)
  * You've installed the (binary) FXRuby gem for OS X, which is built  
against the regular OS X Leopard.

In other words: The gem that you've installed depends on the OS X  
Ruby, and since that's not the same Ruby that you're using to load it,  
it breaks. So you have a couple of options here.

One option is to drop back to using the Ruby that's included with OS  
X. In this case you just need to uninstall Ruby from your MacPorts  
installation (or at least monkey with the PATH settings so that it  
finds the OS X version of Ruby before it finds the MacPorts version),  
then install the FXRuby gem into that environment.

Since you're a MacPorts fan (as am I), I'm guessing you don't want  
that option. In that case, you should first uninstall the FXRuby  
binary gem (since that's not going to work anyways). Next, the easiest  
path is probably to install FXRuby from the MacPorts package:

        sudo port install rb-fxruby

If you'd rather install it from the sources, you'll need to make sure  
to specify the "ruby" platform when invoking the "gem install"  
command, e.g.

        sudo gem install fxruby --platform ruby

Note that this option is somewhat more fragile, since you have to take  
care of all the dependencies yourself. I'd recommend just using the  
MacPorts port since you're already set up for that anyways.

> - is the fact that the port install of Fox says "X11" mean that  
> there's no native mac binding for fox?

Correct, there's no "native" OS X port of FOX.
_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users

Re: Install question on Mac

by Lyle Johnson-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Apr 28, 2009, at 10:38 AM, eddy wrote:

> I don't have a mac, but on my linux setups I need to require  
> 'rubygems' before require 'fox16'.  Maybe it's the same on macos?

That's a separate issue, I think. If you've installed FXRuby (or  
anything else) via RubyGems, you need to ensure that the Ruby  
interpreter loads up the RubyGems runtime at startup. One way is to  
(as you discovered) always include:

        require 'rubygems'

at the top of your programs. An easier way (IMO) is to modify your  
RUBYOPT environment variable to include this, e.g.

        export RUBYOPT="-rubygems"

Note that this is a "RubyGems thing", and not an "FXRuby thing".

Hope this helps,

Lyle
_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users

Re: Install question on Mac

by Pito Salas :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Lyle

Thanks... Your diagnosis sounds correct. Indeed I would prefer to use
everything via mac ports.

One thing I don't understand though, maybe you can clarify.

If I use MacPorts to install FxRuby like you say:

$ sudo port install rb-fxruby

Am I installing a gem or installing fx ruby in some other place?

To keep my sanity I've tried to install with gem everything that's a
gem, and with ports everything else. That way when I uninstall I know
where to go and in theory I have one less possible path problem.

Thanks!

- Pito



On Tue, Apr 28, 2009 at 11:48 AM, Lyle Johnson <lyle@...> wrote:

>
> On Apr 28, 2009, at 9:53 AM, Pito Salas wrote:
>
>> This question has come through before, but I can't come up with a
>> solution based on reading many threads etc so please bear with me with
>> a simple question. I am on Mac, and manage my installs via port and
>> gems. Here's the state of things:
>
> <snip>
>
> Based on the error messages, it looks like:
>
>  * You're running the MacPorts version of Ruby (not the Ruby that's included
> with OS X Leopard)
>  * You've installed the (binary) FXRuby gem for OS X, which is built against
> the regular OS X Leopard.
>
> In other words: The gem that you've installed depends on the OS X Ruby, and
> since that's not the same Ruby that you're using to load it, it breaks. So
> you have a couple of options here.
>
> One option is to drop back to using the Ruby that's included with OS X. In
> this case you just need to uninstall Ruby from your MacPorts installation
> (or at least monkey with the PATH settings so that it finds the OS X version
> of Ruby before it finds the MacPorts version), then install the FXRuby gem
> into that environment.
>
> Since you're a MacPorts fan (as am I), I'm guessing you don't want that
> option. In that case, you should first uninstall the FXRuby binary gem
> (since that's not going to work anyways). Next, the easiest path is probably
> to install FXRuby from the MacPorts package:
>
>        sudo port install rb-fxruby
>
> If you'd rather install it from the sources, you'll need to make sure to
> specify the "ruby" platform when invoking the "gem install" command, e.g.
>
>        sudo gem install fxruby --platform ruby
>
> Note that this option is somewhat more fragile, since you have to take care
> of all the dependencies yourself. I'd recommend just using the MacPorts port
> since you're already set up for that anyways.
>
>> - is the fact that the port install of Fox says "X11" mean that there's no
>> native mac binding for fox?
>
> Correct, there's no "native" OS X port of FOX.
> _______________________________________________
> fxruby-users mailing list
> fxruby-users@...
> http://rubyforge.org/mailman/listinfo/fxruby-users
>
_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users

Re: Install question on Mac

by Lyle Johnson-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Apr 28, 2009 at 1:09 PM, Pito Salas <rps@...> wrote:

> Thanks... Your diagnosis sounds correct. Indeed I would prefer to use
> everything via mac ports.
>
> One thing I don't understand though, maybe you can clarify.
>
> If I use MacPorts to install FxRuby like you say:
>
> $ sudo port install rb-fxruby
>
> Am I installing a gem or installing fx ruby in some other place?

Ah, good question. If you install FXRuby via MacPorts, you are indeed
installing it in "some other place", namely, under:

    /opt/local/lib/ruby/site_ruby/1.8

> To keep my sanity I've tried to install with gem everything that's a
> gem, and with ports everything else. That way when I uninstall I know
> where to go and in theory I have one less possible path problem.

Sure, I understand. Well, you can cross your fingers and try
installing via the source gem, then. For some people this works very
smoothly and for others it's sort of a disaster.

    export CPPFLAGS="-I/opt/local/include"
    export ARCHFLAGS="-arch i386 -L/opt/local/lib"
    sudo gem install fxruby --platform ruby

The first two lines set up some environment variables so that the
build from source code knows to look in MacPorts for the FOX (and
related) dependencies (instead of in, say, /usr/local). By passing the
"--platform ruby" command line switch to the "gem install" command,
you're telling RubyGems to pick the source gem instead of the binary
gem (which, per my earlier e-mail, is incompatible with Ruby from
MacPorts).

Good luck, and let me know how it goes,

Lyle
_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users

Re: Install question on Mac

by Pito Salas :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Lyle

Thanks for your help. I ended up installing it via ports like you
originally suggested. Seemed the safer and easier way to go. And it
worked flawlessly and so I am up and running.

As a general rule, as a ruby developer, do you use ports instead of
gems or what is your policy?

Another question, it looks like the X Window package is launched on
Mac to display UI. Is that the way FX always works or is it just a mac
thing?

I am assessing what gui package to make the effort to learn and at
this point I have it down to WxRyby and FxRuby. Any words of advice?

Thanks!

Pito

On Tue, Apr 28, 2009 at 2:53 PM, Lyle Johnson <lyle@...> wrote:

> On Tue, Apr 28, 2009 at 1:09 PM, Pito Salas <rps@...> wrote:
>
>> Thanks... Your diagnosis sounds correct. Indeed I would prefer to use
>> everything via mac ports.
>>
>> One thing I don't understand though, maybe you can clarify.
>>
>> If I use MacPorts to install FxRuby like you say:
>>
>> $ sudo port install rb-fxruby
>>
>> Am I installing a gem or installing fx ruby in some other place?
>
> Ah, good question. If you install FXRuby via MacPorts, you are indeed
> installing it in "some other place", namely, under:
>
>    /opt/local/lib/ruby/site_ruby/1.8
>
>> To keep my sanity I've tried to install with gem everything that's a
>> gem, and with ports everything else. That way when I uninstall I know
>> where to go and in theory I have one less possible path problem.
>
> Sure, I understand. Well, you can cross your fingers and try
> installing via the source gem, then. For some people this works very
> smoothly and for others it's sort of a disaster.
>
>    export CPPFLAGS="-I/opt/local/include"
>    export ARCHFLAGS="-arch i386 -L/opt/local/lib"
>    sudo gem install fxruby --platform ruby
>
> The first two lines set up some environment variables so that the
> build from source code knows to look in MacPorts for the FOX (and
> related) dependencies (instead of in, say, /usr/local). By passing the
> "--platform ruby" command line switch to the "gem install" command,
> you're telling RubyGems to pick the source gem instead of the binary
> gem (which, per my earlier e-mail, is incompatible with Ruby from
> MacPorts).
>
> Good luck, and let me know how it goes,
>
> Lyle
> _______________________________________________
> fxruby-users mailing list
> fxruby-users@...
> http://rubyforge.org/mailman/listinfo/fxruby-users
>
_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users

Re: Install question on Mac

by Lyle Johnson-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Apr 29, 2009, at 9:12 AM, Pito Salas wrote:

> Thanks for your help. I ended up installing it via ports like you
> originally suggested. Seemed the safer and easier way to go. And it
> worked flawlessly and so I am up and running.
>
> As a general rule, as a ruby developer, do you use ports instead of
> gems or what is your policy?

No, I actually use gems most of the time. It's the more flexible  
option (in my opinion), although it occasionally requires a little  
more work on my part (in terms of tracking down dependencies and  
things like that).

> Another question, it looks like the X Window package is launched on
> Mac to display UI. Is that the way FX always works or is it just a mac
> thing?

It's a Mac thing. I'm not sure exactly when it gets triggered, but I'm  
guessing that as soon as you call XOpenDisplay(), if the X server  
isn't running yet, it gets launched.

> I am assessing what gui package to make the effort to learn and at
> this point I have it down to WxRuby and FxRuby. Any words of advice?

I am a lousy evangelist, so I'm not going to try to convince you  
either way. WxRuby is a fine GUI toolkit for Ruby (as are Shoes and  
several others). I like FOX because it's lightweight, and very fast,  
and easy to extend. I've also spent a lot of time poring over FOX's  
source code, and I know how good it is. So for various reasons, FOX is  
what clicked with me. But my advice for you is that you write one or  
two non-trivial sample applications using each (WxRuby and FXRuby) and  
then go with your gut. Which one makes more sense to you as a  
developer, that sort of thing. I mean, that's what I would do if I  
were in your shoes.
_______________________________________________
fxruby-users mailing list
fxruby-users@...
http://rubyforge.org/mailman/listinfo/fxruby-users