Help installing fxruby on osx

Hi,

A few weeks ago I tried to install fxruby, went grey, ended up
installing fink and darwinports, lost more hair and ended up
completely trashing Ruby on my (wife’s) system here.
Thanks to some good advice on this list (yes, I brought 'Learning
unix on OSX Tiger - good book btw), I was able to get ruby up again.

Which brings us to today, when I decided to try fxruby again.
Agghhh… still no joy, but this time, before I mess thing up I
though I’d ask for some advice.

All I’ve tried this far is installing via gem. Here’s the result:

mac:~/Documents sharon$ sudo gem install fxruby
Select which gem to install for your platform (universal-darwin8.0)

  1. fxruby 1.6.11 (ruby)
  2. fxruby 1.6.11 (mswin32)
  3. fxruby 1.6.10 (mswin32)
  4. fxruby 1.6.10 (ruby)
  5. Skip this gem
  6. Cancel installation

1
Building native extensions. This could take a while…
ERROR: While executing gem … (Gem::Installer::ExtensionBuildError)
ERROR: Failed to build gem native extension.

ruby extconf.rb install fxruby
checking for sys/time.h… yes
checking for signal.h… yes
checking for png_create_read_struct() in -lpng… yes
checking for deflate() in -lz… yes
checking for jpeg_mem_init() in -ljpeg… yes
checking for TIFFSetErrorHandler() in -ltiff… no
checking for XShmQueryVersion() in -lXext… yes
checking for XFindContext() in -lX11… yes
checking for glXCreateContext() in -lGL… yes
checking for gluNewQuadric() in -lGLU… yes
creating Makefile

make
gcc -I. -I. -I/usr/local/lib/ruby/1.8/universal-darwin8.0 -I. -
DHAVE_SYS_TIME_H -DHAVE_SIGNAL_H -I/usr/local/include/fxscintilla -I/
usr/local/include/fox-1.6 -I/opt/local/include/fox-1.6 -I/opt/local/
include/fxscintilla -fno-common -g -O2 -fno-common -pipe -fno-common
-O0 -Iinclude -DWITH_FXSCINTILLA -DHAVE_FOX_1_6 -arch i386 -c librb.c

cc -dynamic -bundle -undefined suppress -flat_namespace -arch i386 -
L"/usr/local/lib" -L"/usr/local/lib" -L"/usr/X11R6/lib" -o
fox16.bundle librb.o core_wrap.o dc_wrap.o dialogs_wrap.o
frames_wrap.o fx3d_wrap.o FXRbApp.o FXRbDataTarget.o FXRbGLViewer.o
FXRuby.o iconlist_wrap.o icons_wrap.o image_wrap.o impl.o
label_wrap.o layout_wrap.o list_wrap.o markfuncs.o mdi_wrap.o
menu_wrap.o scintilla_wrap.o table_wrap.o text_wrap.o treelist_wrap.o
ui_wrap.o unregisterOwnedObjects.o -lruby -lfxscintilla -lFOX-1.6 -
lGLU -lGL -lX11 -lXext -ljpeg -lz -lpng -lstdc++ -lpthread -ldl -lobjc
/usr/bin/ld: can’t locate file for: -lfxscintilla
collect2: ld returned 1 exit status
make: *** [fox16.bundle] Error 1

Where do I go from here?

Cheers,
Dave

On Jul 15, 2007, at 6:29 AM, Sharon P. wrote:

A few weeks ago I tried to install fxruby, went grey, ended up
installing fink and darwinports, lost more hair and ended up
completely trashing Ruby on my (wife’s) system here.
Thanks to some good advice on this list (yes, I brought 'Learning
unix on OSX Tiger - good book btw), I was able to get ruby up again.

Congratulations!

Which brings us to today, when I decided to try fxruby again.
Agghhh… still no joy, but this time, before I mess thing up I
though I’d ask for some advice.

All I’ve tried this far is installing via gem. Here’s the result:

cc -dynamic -bundle -undefined suppress -flat_namespace -arch i386 -
collect2: ld returned 1 exit status
make: *** [fox16.bundle] Error 1

Before I launch into the explanation of this problem, and a way to
fix it, let me put in a plug for MacPorts. I know that you
(apparently) had a bad experience with Fink. So did I. MacPorts, in
my opinion, is better. I am also, personally, the maintainer of the
FOX, FXScintilla and FXRuby ports in MacPorts and am pretty confident
in saying that that’s the easiest, lowest-hassle way to install
FXRuby at this point.

OK.

The build is failing because it can’t find the library for
FXScintilla, which is an optional component that FXRuby can use when
it’s present:

http://www.fxruby.org/doc/scintilla.html

So, for some reason, the FXRuby installation script thought that
FXScintilla was installed on your computer and it configured the
build that way. The way that FXRuby “decides” whether or not you have
FXScintilla is installed is by looking for the FXScintilla include
files; it looks for any of the following:

/usr/include/fxscintilla/fxscintilla.h
/usr/local/include/fxscintilla/fxscintilla.h
/sw/include/fxscintilla/fxscintilla.h (this is where Fink installs it)
/opt/local/include/fxscintilla/fxscintilla.h (this is where MacPorts
installs it)

Since you mentioned that you’ve experimented with Fink before, I have
a suspicion that a copy of fxscintilla.h is still hanging around in
the /sw/include/fxscintilla directory (but you should check all four
locations to be sure). Remove that, and then start over:

sudo rm -rf /sw/include/fxscintilla
sudo gem install fxruby

Hope this helps,

Lyle

I’ll let you know how things go tomorrow.

[2 weeks later…]

Thanks for the help.
I’ve used MacPorts to successfully build and install fxRuby at last,
but I’ve hit another snag.

I now get the error
FXRbApp::openDisplay: unable to open display :0.0
whenever I try to instantiate a new FXApp

irb(main):001:0> require ‘fox16’
=> true
irb(main):002:0> app= Fox::FXApp.new
FXRbApp::openDisplay: unable to open display :0.0

Google has not been my friend today, so if anyone else can help
that’d be great.
I’ve got a nice little gui running under XP, but I just can’t seem to
get underway on the Mac.

Cheers,
Dave

include files; it looks for any of the following:
around in the /sw/include/fxscintilla directory (but you should
check all four locations to be sure). Remove that, and then start
over:

sudo rm -rf /sw/include/fxscintilla
sudo gem install fxruby

Spot on. I’ve removed the dir and in the process of trying it again.
My wife’s just popped her head around the door ‘Where are you? I
though you were coming to bed?’ Better go :slight_smile:
I’ll let you know how things go tomorrow.

Cheers,
Dave

I’ve used MacPorts to successfully build and install fxRuby at
last, but I’ve hit another snag.

I now get the error
FXRbApp::openDisplay: unable to open display :0.0
whenever I try to instantiate a new FXApp

Is the X server running?

ummm…
don’t know.
Sounds like it should be and it’s not.

I’ll see if I can find it.

On Jul 27, 2007, at 8:27 PM, Sharon P. wrote:

I’ve used MacPorts to successfully build and install fxRuby at
last, but I’ve hit another snag.

I now get the error
FXRbApp::openDisplay: unable to open display :0.0
whenever I try to instantiate a new FXApp

Is the X server running?

On 28/07/2007, at 7:04 PM, Sharon P. wrote:

don’t know.
Sounds like it should be and it’s not.

I’ll see if I can find it

Found something called XDarwin and ran it ‘rootless’, but still had
the same problem. I then tried it in ‘full screen’ mode and had to
restart the Mac when I could find no other means to exit a blank
black screen w/ mouse pointer.

Sharon P. [email protected] writes:

ummm…
don’t know.
Sounds like it should be and it’s not.

I’ll see if I can find it

Found something called XDarwin and ran it ‘rootless’, but still had
the same problem. I then tried it in ‘full screen’ mode and had to
restart the Mac when I could find no other means to exit a blank
black screen w/ mouse pointer.

XDarwin shouldn’t be necessary; Apple has included an X server for a
long
while now - it’s /Applications/Utilities/X11.app. With X11.app, you can
leave full-screen mode the same way you enter it, with cmd-opt-a.

sherm–

XDarwin shouldn’t be necessary; Apple has included an X server for
a long
while now - it’s /Applications/Utilities/X11.app. With X11.app,
you can
leave full-screen mode the same way you enter it, with cmd-opt-a.

O.P. may not have it installed. X11.app is an optional install on
the OS X install DVD. Here’s Apple’s web page on X11: http://
developer.apple.com/opensource/tools/runningx11.html.

Thanks. I do have X11 and my fox app up and running now. Except it
looks like a Win98 app. ugh! It looks that way under XP too, but who
cares, that Windows.

The app I wrote using wx looked like a native Mac app and didn’t
require X11, but fxRuby has nicer bindings. Both looked pretty much
the same on XP.

I’d use the Ruby-Cocoa bindings, but I need something that will run
on Win2000/XP as well.
What have others used?

Cheers,
Dave

Sherm P. wrote:

XDarwin shouldn’t be necessary; Apple has included an X server for a
long while now - it’s /Applications/Utilities/X11.app. With X11.app,
you can leave full-screen mode the same way you enter it, with cmd-opt-a.
O.P. may not have it installed. X11.app is an optional install on the OS
X install DVD. Here’s Apple’s web page on X11:
http://developer.apple.com/opensource/tools/runningx11.html.

On Jul 28, 2007, at 7:40 AM, Sharon P. wrote:

What have others used?
If you want “native” widgets on whatever OS your application is
running on, wxWidgets may be your only choice. Maybe also RubyQt?

On Jul 28, 2007, at 8:06 AM, Lyle J. wrote:

I’d use the Ruby-Cocoa bindings, but I need something that will
run on Win2000/XP as well.
What have others used?

If you want “native” widgets on whatever OS your application is
running on, wxWidgets may be your only choice. Maybe also RubyQt?

Native UI widgets is an elusive goal when trying to build cross
platform.
Take a look at VLC player, see how they do it. Granted, their core
program is in C, but they support lots of systems with native
interfaces…!

program is in C, but they support lots of systems with native
interfaces…!

I spent many enjoyable years using Delphi to develop desktop
application for small businesses, and I’m interested in (amongst many
other things) gearing up my skills to use Ruby for this. I’ve got a
reasonable handle on the language, but I’m severely lacking in the
gui department. Nothing fancy, just the basics (although a report
preview would be nice).
I’m happy to use wxWidgets and I see a big future in Ruby.

Cheers
Dave

Before I launch into the explanation of this problem, and a way to
fix it, let me put in a plug for MacPorts. I know that you
(apparently) had a bad experience with Fink. So did I. MacPorts, in
my opinion, is better. I am also, personally, the maintainer of the
FOX, FXScintilla and FXRuby ports in MacPorts and am pretty confident
in saying that that’s the easiest, lowest-hassle way to install
FXRuby at this point.

I had the same problem with fxscintilla but I solved it by downloading
the source for fxscintilla and building and installing it. Here is the
full story. I got everything installed but it still doesn’t work.

This blog entry says that others are having this problem.
http://davidrupp.blogspot.com/2008/01/installing-fox-and-fxruby-on-mac-os-x.html

He proposes a solution, giving detailed instructions with particular
special flags for:

(1) Building Fox from source, and
(2) Installing the FXRuby gem.

Step (1) worked for me.

Then I hit the fxscintilla bug again when I tried to do step (2).

cc -arch i386 -pipe -bundle -undefined dynamic_lookup -o fox16.bundle
librb.o core_wrap.o dc_wrap.o dialogs_wrap.o frames_wrap.o fx3d_wrap.o
FXRbApp.o FXRbDataTarget.o FXRbGLViewer.o FXRuby.o iconlist_wrap.o
icons_wrap.o image_wrap.o impl.o label_wrap.o layout_wrap.o
list_wrap.o markfuncs.o mdi_wrap.o menu_wrap.o scintilla_wrap.o
table_wrap.o text_wrap.o treelist_wrap.o ui_wrap.o
unregisterOwnedObjects.o -L"."
-L"/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib"
-L"/usr/local/lib" -L"/usr/X11R6/lib" -L. -arch i386 -lruby
-lfxscintilla -lFOX-1.6 -lGLU -lX11 -lXext -lz -lstdc++ -lpthread
-ldl -lm
ld: library not found for -lfxscintilla

So I downloaded and built and installed it from source. That seemed to
work.

Then I tried step (2) again and it seemed to work.

So everything should work. Except when I try “require ‘fox16’” in a
ruby program, I still get an error.

./fxruby1.rb:7:in `require’: no such file to load – fox16 (LoadError)

However there are now fox16 files in my system.

Macintosh-2:ruby dsw$ find /Library/Ruby -iname “fox16
/Library/Ruby/Gems/1.8/doc/fxruby-1.6.13/rdoc/files/lib/fox16
/Library/Ruby/Gems/1.8/gems/fxruby-1.6.13/ext/fox16
/Library/Ruby/Gems/1.8/gems/fxruby-1.6.13/ext/fox16/fox16.bundle
/Library/Ruby/Gems/1.8/gems/fxruby-1.6.13/lib/fox16
Macintosh-2:ruby dsw$

Yet no combinations of adding them to my path seem to work.

Macintosh-2:ruby dsw$ ruby -I
/Library/Ruby/Gems/1.8/gems/fxruby-1.6.13/ext/fox16/ ./fxruby1.rb
“the load path”
["/Library/Ruby/Gems/1.8/gems/fxruby-1.6.13/ext/fox16/",
“/Library/Ruby/Site/1.8”, “/Library/Ruby/Site/1.8/powerpc-darwin9.0”,
“/Library/Ruby/Site/1.8/universal-darwin9.0”, “/Library/Ruby/Site”,
“/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8”,
“/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/powerpc-darwin9.0”,
“/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0”,
“.”]
/Library/Ruby/Gems/1.8/gems/fxruby-1.6.13/ext/fox16/fox16.bundle:0:in
`require’: no such file to load – fox16/core (LoadError)
Macintosh-2:ruby dsw$

Though you will notice I get a slightly different error.

Now, please note that ports doesn’t work either:

Macintosh-2:ruby dsw$ sudo port install rb-fxruby
Password:
Skipping org.macports.activate (rb-fxruby ) since this port is already
active
—> Cleaning rb-fxruby
Macintosh-2:ruby dsw$ cat fxruby1.rb && echo && ruby ./fxruby1.rb
#!/usr/bin/ruby -w
print “the load path:\n”
p $:
require ‘fox16’

the load path:
["/Library/Ruby/Site/1.8", “/Library/Ruby/Site/1.8/powerpc-darwin9.0”,
“/Library/Ruby/Site/1.8/universal-darwin9.0”, “/Library/Ruby/Site”,
“/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8”,
“/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/powerpc-darwin9.0”,
“/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.0”,
“.”]
./fxruby1.rb:4:in `require’: no such file to load – fox16 (LoadError)
from ./fxruby1.rb:4
Macintosh-2:ruby dsw$

So I have it installed with fink, gems, and ports and it still doesn’t
work. Why do both fink and ports fail so often? They fail more often
than they work.

Anyway, I was enthusiastic about using FXRuby but I would be a lot more
enthusiastic if it would actually work.

Daniel Wilkerson wrote:

I had the same problem with fxscintilla but I solved it by downloading
the source for fxscintilla and building and installing it. Here is the
full story. I got everything installed but it still doesn’t work.

So I have it installed with fink, gems, and ports and it still doesn’t
work. Why do both fink and ports fail so often? They fail more often
than they work.

You might be able to get help on the fxruby-users mailing list:

http://rubyforge.org/mail/?group_id=300
http://www.ruby-forum.com/forum/35

Anyway, I was enthusiastic about using FXRuby but I would be a lot more
enthusiastic if it would actually work.

Since you’re on OS X and mention needing fxscintilla, you could try
wxRuby, which provides Scintilla as the “StyledTextCtrl” widget. It’s a
much simpler one-step install, no compilation required, and to some
eyes is more aesthetically pleasing on OS X.

sudo gem install wxruby

And select the latest (currently 1.9.5) -darwin gem.

alex

On Wed, Mar 26, 2008 at 9:40 PM, Daniel Wilkerson
[email protected] wrote:

So everything should work. Except when I try “require ‘fox16’” in a
ruby program, I still get an error.

./fxruby1.rb:7:in `require’: no such file to load – fox16 (LoadError)

OK, just so I understand it, at this point you’ve built both FOX and
FXScintilla from scratch (not via MacPorts), and then installed FXRuby
via RubyGems. And you’re using the built-in Ruby that comes with Mac
OS 10.5, not a Ruby that you built yourself.

The error message suggests, then, that you don’t have your RUBYOPT
environment variable set so that it automatically loads up RubyGems.
For that, see the instructions under “Using RUBYOPT” at this page:

http://www.rubygems.org/read/chapter/3

However there are now fox16 files in my system.

Macintosh-2:ruby dsw$ find /Library/Ruby -iname “fox16
/Library/Ruby/Gems/1.8/doc/fxruby-1.6.13/rdoc/files/lib/fox16
/Library/Ruby/Gems/1.8/gems/fxruby-1.6.13/ext/fox16
/Library/Ruby/Gems/1.8/gems/fxruby-1.6.13/ext/fox16/fox16.bundle
/Library/Ruby/Gems/1.8/gems/fxruby-1.6.13/lib/fox16
Macintosh-2:ruby dsw$

Right, this looks plausible.

Yet no combinations of adding them to my path seem to work…

No, it wouldn’t. You need to do this the right way, going through
RubyGems’ load mechanism.

Now, please note that ports doesn’t work either:

Macintosh-2:ruby dsw$ sudo port install rb-fxruby
Password:
Skipping org.macports.activate (rb-fxruby ) since this port is already
active
—> Cleaning rb-fxruby
Macintosh-2:ruby dsw$ cat fxruby1.rb && echo && ruby ./fxruby1.rb

You’re mixing up two different Ruby installations. The “ruby” that’s
installed in /usr/bin is the one you’re running here, and it’s the one
that came with Mac OS X, so this is just another manifestation of the
previous problem. The “ruby” that MacPorts installed along with the
“rb-fxruby” port is found in /opt/local/bin, and it has an entirely
separate library of gems and what-not.

So I have it installed with fink, gems, and ports and it still doesn’t
work. Why do both fink and ports fail so often? They fail more often
than they work.

MacPorts worked really well before OS 10.5, and it still works well in
general, but the introduction of a built-in ruby alongside the
MacPorts ruby has really complicated things. To make matters worse,
many (most?) Rubyists will just download the Ruby source code and
build their own version, which gets installed in yet another location
(usually, /usr/local). It has turned into a real maintenace and
support nightmare.

Anyway, I was enthusiastic about using FXRuby but I would be a lot more
enthusiastic if it would actually work.

Please let me know how it goes after you get RUBYOPT set for using
RubyGems with your built-in Ruby. It sounds like you’re closer than
you think.

Thanks,

Lyle

On Thu, Mar 27, 2008 at 4:49 PM, Daniel Wilkerson
[email protected] wrote:

Why doesn’t Apple just make one way to install things? Their strength
seems to be system integration, and yet they really fall down here.

Well, technically, they’re only responsible for the Ruby that comes
with OS X, the one that you find in /usr/bin. MacPorts, though
sponsored (I think?) in part by Apple, is an independent effort to
bring more free and open source software to Mac users.

So you mean put this into my .profile:
export RUBYOPT=rubygems

Yes, right.

Doing that and then also running /Applications/Utilities/X11.app (NOT
XDarwin!) works.

Great!

And gems is not just “built-in” to ruby? Why do I have to tell ruby
about ruby gems?

RubyGems is officially part of Ruby 1.9, but no, it wasn’t integrated
with Ruby 1.8.

See above comment about the stupidity of there being more than one
“namespace” in which applications can be installed.

Tell me about it. It gets very confusing (for me, anyways) trying to
support all of these configurations.

Again, Apple should try to coordinate all of these software distribution
/ installation mechanisms. How do we suggest it to them?

He may kill me for mentioning his name, but Laurent S. seems
to be in charge (as much as anyone) of the Ruby stuff in Mac OS X.
Google will lead you to him.

So, as above, it works now. Thank you for your help.

One question though: Suppose I build a GUI app using Fox and FXRuby and
I want to distribute it for all 3 platforms. How do I package it up?

I see you’ve started a new thread on this topic (good idea), so we’ll
pick it up there.

Lyle J. wrote:

On Wed, Mar 26, 2008 at 9:40 PM, Daniel Wilkerson
[email protected] wrote:

So everything should work. Except when I try “require ‘fox16’” in a
ruby program, I still get an error.

./fxruby1.rb:7:in `require’: no such file to load – fox16 (LoadError)

OK, just so I understand it, at this point you’ve built both FOX and
FXScintilla from scratch (not via MacPorts), and then installed FXRuby
via RubyGems. And you’re using the built-in Ruby that comes with Mac
OS 10.5, not a Ruby that you built yourself.

Why doesn’t Apple just make one way to install things? Their strength
seems to be system integration, and yet they really fall down here.

The error message suggests, then, that you don’t have your RUBYOPT
environment variable set so that it automatically loads up RubyGems.
For that, see the instructions under “Using RUBYOPT” at this page:

http://www.rubygems.org/read/chapter/3

So you mean put this into my .profile:
export RUBYOPT=rubygems

Doing that and then also running /Applications/Utilities/X11.app (NOT
XDarwin!) works.

However there are now fox16 files in my system.

Macintosh-2:ruby dsw$ find /Library/Ruby -iname “fox16
/Library/Ruby/Gems/1.8/doc/fxruby-1.6.13/rdoc/files/lib/fox16
/Library/Ruby/Gems/1.8/gems/fxruby-1.6.13/ext/fox16
/Library/Ruby/Gems/1.8/gems/fxruby-1.6.13/ext/fox16/fox16.bundle
/Library/Ruby/Gems/1.8/gems/fxruby-1.6.13/lib/fox16
Macintosh-2:ruby dsw$

Right, this looks plausible.

Yet no combinations of adding them to my path seem to work…

No, it wouldn’t. You need to do this the right way, going through
RubyGems’ load mechanism.

And gems is not just “built-in” to ruby? Why do I have to tell ruby
about ruby gems?

Now, please note that ports doesn’t work either:

Macintosh-2:ruby dsw$ sudo port install rb-fxruby
Password:
Skipping org.macports.activate (rb-fxruby ) since this port is already
active
—> Cleaning rb-fxruby
Macintosh-2:ruby dsw$ cat fxruby1.rb && echo && ruby ./fxruby1.rb

You’re mixing up two different Ruby installations. The “ruby” that’s
installed in /usr/bin is the one you’re running here, and it’s the one
that came with Mac OS X, so this is just another manifestation of the
previous problem. The “ruby” that MacPorts installed along with the
“rb-fxruby” port is found in /opt/local/bin, and it has an entirely
separate library of gems and what-not.

See above comment about the stupidity of there being more than one
“namespace” in which applications can be installed.

So I have it installed with fink, gems, and ports and it still doesn’t
work. Why do both fink and ports fail so often? They fail more often
than they work.

MacPorts worked really well before OS 10.5, and it still works well in
general, but the introduction of a built-in ruby alongside the
MacPorts ruby has really complicated things. To make matters worse,
many (most?) Rubyists will just download the Ruby source code and
build their own version, which gets installed in yet another location
(usually, /usr/local). It has turned into a real maintenace and
support nightmare.

Again, Apple should try to coordinate all of these software distribution
/ installation mechanisms. How do we suggest it to them?

Anyway, I was enthusiastic about using FXRuby but I would be a lot more
enthusiastic if it would actually work.

Please let me know how it goes after you get RUBYOPT set for using
RubyGems with your built-in Ruby. It sounds like you’re closer than
you think.

So, as above, it works now. Thank you for your help.

One question though: Suppose I build a GUI app using Fox and FXRuby and
I want to distribute it for all 3 platforms. How do I package it up?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs