Last week I’ve had to port some software I wrote to an ARM9 development board (I’ve been working on a part of digitalSTROM for the last year). I figured that this would be a mostly painless task and learned that it is — if you know which files to adjust. Thats why I’m documenting it for you all here.
The libraries I had to compile were:
- Boost
- LibXML
- LibICAL
- gsoap++
- libjs (yeah JS on a small ARM9 board, ain’t that cool?)
Boost
Well boost was a bitch to compile. Until I found a post in a mailinglist from someone who did something similar. I might have been easier with 1.37 but I’m stuck at 1.35 for now.
export PATH=/opt/emlix/picocom1/bin:$PATH
echo "using gcc : arm : arm-linux-gnueabi-g++ ;" > user-config.jam
BOOST_BUILD_PATH=. tools/jam/src/bin.linuxx86/bjam -d2
--toolset=gcc-arm '-sBUILD=release static multi/single' link=static
--prefix=../sysroot/ --layout=system --with-filesystem
--debug-configuration install
The --debug-configuration command line switch was a life-safer. I discovered it a little late though.
LibXML2
LibXML2 was straight forward:
export PATH=/opt/emlix/picocom1/bin:$PATH
export CC=arm-linux-gnueabi-gcc
./configure --target=arm-linux-gnueabi --host=arm-linux-gnueabi \
--build=i586-linux --prefix=/home/patrick/test/sysroot/ \
--with-minimum --with-writer --with-sax1
make
make install
The only hassle was to find out that i had to include sax1 and writer for my program.
LibICAL
Straight forward as well:
export PATH=/opt/emlix/picocom1/bin:$PATH
export CC=arm-linux-gnueabi-gcc
./configure --target=arm-linux-gnueabi --host=arm-linux-gnueabi \
--build=i586-linux --prefix=/home/patrick/test/sysroot/ \
--without-bdb4
make
make install
gsoap
The problem with gsoap is that it needs to generate files to compile, but
it’s basically following the pattern:
export PATH=/opt/emlix/picocom1/bin:$PATH
export CC=arm-linux-gnueabi-gcc
export CXX=arm-linux-gnueabi-g++
./configure --target=arm-linux-gnueabi --host=arm-linux-gnueabi \
--build=i586-linux --prefix=/home/patrick/test/sysroot/
make
Then you’re greeted by this error message:
../../gsoap/src/soapcpp2: ../../gsoap/src/soapcpp2: cannot execute binary file
Which is obvious considering we’re compiling for ARM9. No you can either copy the files over to your board and execute them there or just call your native soapcpp2
cd wsdl
../soapcpp2 -SC -pwsdl -I../import ./wsdl.h
After that you’re compile-run should run smooth through until the end:
make
make install
SpiderMonkey (libjs)
Since SpiderMonkey is usually embedded in the Mozilla build-process it just has a simple Makefile. Either that or they’re just lazy at Mozilla. Here are the steps to compile that beast:
mkdir mozilla
cd mozilla
wget http://ftp.mozilla.org/pub/mozilla.org/js/js-1.7.0.tar.gz
tar xzf js-1.7.0.tar.gz
cd js
make -f Makefile.ref CC=arm-linux-gnueabi-gcc LD=arm-linux-gnueabi-ld
The build comes to a grinding halt since we’re having the “running ARM9 binaries on a x86 platform”-issue again. This time it might be a good advice to run these binaries your target-processor since it’s checking the size of various types. Copy over jscpucfg and run it like that:
./jscpucfg > jsautocfg.h
Continue the build:
make -f Makefile.ref CC=arm-linux-gnueabi-gcc LD=arm-linux-gnueabi-ld
Next stop: [...]jskwgen: cannot execute binary file. Again copy over jskwgen and run it on your target (it might work with your native copy if you’ve got one lying around, as far as I can tell it just generates parts of the parser):
./jskwgen > jsautokw.h
And continue the build:
make -f Makefile.ref CC=arm-linux-gnueabi-gcc LD=arm-linux-gnueabi-ld
Your binaries should be located in the Linux_All_DBG.OBJ sub-directory.