A Ruby nuby's adventure, 2005 May 1st
BeOS, that beloved operating system that everone wishes they were using instead of (mumble), seems to run Ruby 1.8.2 - the latest stable release as of this writing - just fine, based on superficial testing. However, to compile from source i had to do some minor hacks. This page describes what i did, for what few compile-from-source nuts may be visiting this wiki.
Warning: i am a Ruby Nuby, and have yet to write any Ruby code beyond short one-liners. print "Hello World" is an frightening monstrosity; so i'm sticking with my simpler print "Hey" program ;-)
Another warning: My BeOS is version 5.03 with BONE added. For a long time i avoided BONE, but one day had to get it to run SSH so i could work from home. (Yeah, that was a bright idea.) I do not know if a pure Netserver installation will behave the same way, but i guess it would. Someone please fix this page if i'm wrong.
First, after untarring the 1.8.2 tarball, i ran
Then i discovered that several source files try to #include <net/socket.h> but my machine has no such thing. Most POSIX-compliant systems use <sys/socket.h> I did find a socket.h deeper in the hierarchy of headers, in /boot/develop/headers/be/bone/sys. I created symbolic link
Next, based on a previous fiasco trying to compile Ruby, i edited the file ext/Setup? and removed the '#' from most lines. This causes the extenstions to be static-linked instead of dynamically.
For reasons i couldn't figure out, dynamic link wouldn't compile, but failed for nearly every module due to lack of linking a library. I had tried hacking the ld command as built in lib/mkmf.rb, but like i said, i'm a Ruby Nuby though most of it was delightfully easy to grok. I also tried editing each and every Makefile under ext/ but yikes, that got tedious, not to mention blown away if i did something silly like "make clean". Anyway, whatever hacking i did ended in ruin. If you know Tarot cards, "The Tower" is the card for this adventure.
With Setup fixed, just type "make" and it all built fine, up to the stringio extension. Oddly, it didn't compile the first time, but when i put the "#" back in the Setup file for stringio, ran make, let it fail again then took the "#" out again, then it compiled fine. Odd, but then again, i have six bottles of beer, none on any wall, and they're currently not all full of liquid, if you know what i mean.
With no more trouble, make finished without complaint, and i typed "make test" This failed miserably, until i realized i had an old 1.6.x Ruby alread installed (taken from BeBits?.com) so i boldly bonked it out of existence, overwriting it with the newer Ruby with "make install". Now, "ruby -v" tells me it's 1.8.2, and the first several examples in the pickaxe book work. Now, my life is complete and i have everything i could ever want. Really.
-- darenw@ciclops.org
(I'll just put my comments here.)
With ruby 1.8.3 dynamic linking works using the same configure line as above. Yay! I had no luck with 1.8.4.
I've began a bit of work writing a Be module for ruby. So far, an app with a window and a view can easily be created from ruby. I love ruby for it being so simple to extend. I think that this project should be hosted somewhere. I'm probably not the only one having fiddled a bit on this. Discuss it at [ScriptingBeosRuby].
-- manik@nospam-home.se