Building FXRuby on Leopard with MacPorts

A number of people are having interesting problems trying to build FXRuby on Leopard (Mac OS 10.5) and so I’m trying to pin down exactly where the problems are. Last month, I wrote about some of the fundamental problems that you might run into building FXRuby “from scratch”, without the help of MacPorts. One problem has to do with an apparent bug in the latest release of the Xcode Developer Tools, and another has to do with the buggy X11 server that ships with Leopard. Putting those issues aside, I thought that the MacPorts build was working fine.

Turns out it wasn’t fine after all. Sorry about that.

In an attempt to get to the bottom of things, I began by completely wiping out the /opt directory on my iMac (which is running Mac OS 10.5.1). Next, I reinstalled the MacPorts 1.6.0 base package. Finally, I fired off an install of the rb-fxruby port:

$ sudo port -v install rb-fxruby
Then I went to bed, because I knew that this fresh install of MacPorts was going to need to download and build a bunch of dependencies before it ever got anywhere near FXRuby.

When I checked on the progress the next morning, I saw that, sure enough, the build failed for FXRuby. Some of the last gasps of that attempted build included lines like:

i686-apple-darwin9-gcc-4.0.1: corewrap.o: No such file or directory i686-apple-darwin9-gcc-4.0.1: dcwrap.o: No such file or directory i686-apple-darwin9-gcc-4.0.1: dialogswrap.o: No such file or directory
which suggests that those object files were either never compiled, or that they were compiled and subsequently blown away before the linker could get to them. Turns out it was the former case. When I scrolled a little further up in the build log, I could see lines like:
I. -I. -I/opt/local/lib/ruby/1.8/i686-darwin9.1.0 -I/opt/local/var/macports/build/optlocalvarmacportssourcesrsync.macports.orgreleaseportsrubyrb-fxruby/work/FXRuby-1.6.13/ext/fox16 -DHAVESYSTIMEH -DHAVESIGNALH -I/opt/local/include/fxscintilla -I/opt/local/include/fox-1.6 -I/opt/local/include -fno-common -O2 -fno-common -pipe -fno-common -O0 -Iinclude -DWITHFXSCINTILLA -DHAVEFOX16 -c corewrap.cpp make: I.: Command not found make: [corewrap.o] Error 127 (ignored)
If you’re not used to scouring build logs looking for strange errors, it may not be obvious what’s wrong: there ought to be a compiler command (such as gcc or g++) at the beginning of the line that starts out “I. -I. -I/opt/local/...“.

What’s even more interesting to me is that when I typed (again):

$ sudo port -v install rb-fxruby
This time, the build went through fine. Those lines that previously didn’t show a compiler command were now invoking the C++ compiler (g++), and so those object files (like core_wrap.o) that were missing in action the last time around got created after all, and everyone lived happily ever after.

So the next part of the investigation is for me to figure out what was broken during the first pass, and why the C++ compiler wasn’t being picked up properly by FXRuby’s extconf.rb script. More to come…

Update: Problem seems to be resolved as of the latest update to Ruby in MacPorts.

Posted January 24th, 2008 in FXRuby.

One comment:

  1. Austin Ziegler:

    You can actually make a lot of it work by doing:

    % sudo port install fxscintilla
    % sudo env CPPFLAGS=”-I/opt/local/include” ARCHFLAGS=”-arch i386 -L/opt/local/lib” gem install fxruby

    There’s a possible bug in RubyGems or in the extconf.rb that isn’t respecting LDFLAGS or DLDFLAGS so I added it to ARCHFLAGS and FXRuby finally built just right.