This is the second post on the cross-compile series for DroboFS.
Introduction: Why zlib first?
We’ll start with zlib for two reasons:
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
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
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:
Step 3: Get the source code
Make sure that you are in the folder /root/code, then type:
tar zxf zlib-1.2.5.tar.gz
Step 4: Configuration
Configuration for zlib is the basic command-line that all cross-compiling will require:
This should return no errors.
Step 5: Compiling
Within the folder /root/code/zlib-1.2.5:
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:
…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
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.