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.
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.
[*]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/
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/
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:
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:
…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.
Now you can use ruby on your DroboFS.
Comments, suggestions and feedback are welcome.
Sébastien Grosjean - ZenCocoon