Drobo

Cross-compiling for DroboFS: ruby 1.8.7-p302

Hi everyone,

Here is another post on the cross-compile series for DroboFS continuing the amazing work from ricardo sharing it’s process to cross-compile apps for the DroboFS.

Thanks ricardo for starting this series, it’s now time for me to contribute as well.

Introduction: Why ruby?

Take your pick: loving the language, it just make it comfortable for scripting.

Overall compiling complexity: Medium.

Requirement:

zlib, ncurses and openssl are required to cross-compile ruby.

Step 1: Background info

To be able to make use of this post, you need a VM configured as indicated in this post.

Step 2: Install Ruby 1.8.7 on the VM

This is the unusual part, to compile ruby, it’s most of the time necessary to have a ruby interpreter installed. Copying an ubuntu 10.4 version to our chroot seems good enough to make us cross-compile our arm-none-linux-gnueabi one.

[list=1]
[*]install ruby 1.8.7

apt-get install ruby-full

[*]copy ruby to the chroot

cp /usr/bin/ruby* /var/chroot/drobofs/usr/bin/
cp -r /usr/lib/ruby /var/chroot/drobofs/usr/lib/
cp /usr/lib/libruby1.8* /var/chroot/drobofs/usr/lib/
cp /usr/bin/rdoc1.8 /var/chroot/drobofs/usr/bin/

[/list]

Step 3: Enter the cross-compiling environment

See step 2 of this post to see instructions on how to enter the chroot environment.

Step 4: Link to the ruby header file

To compile ruby, we’ll need the ruby header in a different location than the one we have, therefore in simple symlink while solve this issue.

cd /usr/lib/ruby/
ln -s 1.8/i486-linux/ruby.h ruby.h

Step 5: Get the source code

ruby’s website: http://www.ruby-lang.org/en/
Version: 1.8.7-p302
Direct link: ftp://ftp.ruby-lang.org//pub/ruby/1.8/ruby-1.8.7-p302.tar.gz

Make sure that you are in the folder /root/code, then type:

wget ftp://ftp.ruby-lang.org//pub/ruby/1.8/ruby-1.8.7-p302.tar.gz
tar zxf ruby-1.8.7-p302.tar.gz
cd ruby-1.8.7-p302

Step 6: Configuration

Configuration for ruby is a bit more complex than for ncurses, but nothing crazy:

export ac_cv_func_setpgrp_void=yes
./configure --host=arm-none-linux-gnueabi --prefix=/usr/arm

This should return no errors.

Step 7: Compiling

Within the folder /root/code/ruby-1.8.7-p302:

make

Again, there should be no errors. If any errors are reported, make sure you performed steps 2, 4 and 6 correctly. If you still have errors, make sure that the VM is properly configured (e.g. like I did the first time around, when I got the wrong ruby version, or forgot to ‘export’ the proper compiler flags).

Step 8: Installing

Installing is simple:

make install

…which will place the compiled library under /usr/arm.

Then we package the whole /usr/arm and copy it over to the DroboFS, as indicated on step 9 here.

Congratulations!

Now you can use ruby on your DroboFS.

Comments, suggestions and feedback are welcome.

Sébastien Grosjean - ZenCocoon

Awesome and thanks for this! Whenever I get around to getting my DroboFS one day I’ll definitely be looking into getting Ruby on there for some hackery :wink:

Hi,

Glad you like the tutorial.
I found that rubygem doesn’t work so far, I’ll need to find time to solve this issue and will update the tutorial with the solution.

Sébastien Grosjean - ZenCocoon