Drobo

Cross-compiling for DroboFS: zlib 1.2.5

Hi everyone,

This is the second post on the cross-compile series for DroboFS.

Introduction: Why zlib first?

We’ll start with zlib for two reasons:
[list]
[]It is a fundamental library that almost every network-related app uses
[
]It is a quite simple library to cross-compile, in the sense that it will show the basic steps that pretty much all cross-compiling will require
[/list]

Overall compiling complexity: Easy.

Step 1: Background info

To be able to make use of this post, you need a VM configured as indicated in this post: http://www.drobospace.com/forums/showthread.php?tid=1658

Step 2: Enter the cross-compiling environment

[list=1]
[]Start the cross-compiling VM
[
]Login using the VM window or SSH to it (I suggest SSH)
[*]Now enter the chroot by typing:

sudo mount -o bind /proc /var/chroot/drobofs/proc sudo schroot -c drobofs -d /root
[*]At this point you have a root prompt inside the chroot environment. Go to the source code folder:

cd /root/code

[/list]

Step 3: Get the source code

zlib’s website: http://www.zlib.net/
Version: 1.2.5
Direct link: http://zlib.net/zlib-1.2.5.tar.gz

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

wget http://zlib.net/zlib-1.2.5.tar.gz tar zxf zlib-1.2.5.tar.gz cd zlib-1.2.5

Step 4: Configuration

Configuration for zlib is the basic command-line that all cross-compiling will require:

./configure --prefix=/usr/arm

This should return no errors.

Step 5: Compiling

Within the folder /root/code/zlib-1.2.5:

make

Again, there should be no errors. If any errors are reported, make sure you performed steps 3 and 4 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 toolchain, or forgot to ‘export’ the proper compiler flags).

Step 6: Installing

Installing has to be done in two steps. First we do a:

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: http://www.drobospace.com/forums/showthread.php?tid=1658

Congratulations!

Now you can cross-compile any application that uses zlib, since the required headers are libraries are present in /usr/arm both in the VM and on the Drobo.

Installed in about 2min, feels so good. Thanks for your excellent tutorials which makes it possible.

Thanks to you I believe more apps will come to the DroboFS but also more DroboFS owners will clearly enjoy them.

Cheers,

Sebastien Grosjean - ZenCocoon