Cross compiling libEXIF for ARM on Ubutnu

libexif is a software library that allows you to add EXIF tags to JPEG images, for example when saving JPEG images via libJPEG.

The following is a log of the steps taken to cross compile libexif on ubuntu for an ARM IoT device, you will need the arm-linux-gnueabi tool-chain installed on your build machine:

1.) Download the latest libexif source code from:

2.) uzip & untar the software:

3.) Execute the following from bash or similar:

cd libexif-0.6.21
./configure --host=arm-linux-gnueabi CC=arm-linux-gnueabi-gcc AR=arm-linux-gnueabi-ar \ 
make install

This should put the output files into /home/me/build_exif/_install ready for copying onto your ARM device.

Integrating Intercom to cloud App keeps me out of trouble… (ARM NEON)

I have been busy over the last few days integrating Intercom into a client’s cloud app. I have integrated quite a few SaaS systems of late (and written not a few REST interfaces myself) and I am quite enjoying this integration as the data model is good and the REST interface is reasonably easy to use!

So far so good, and at least it keeps me out of trouble, the specific trouble I have in mind is to attempt to implement a visual programming front-end for the ARM NEON SIMD instructions using the very exciting noFlo Javascript library!!

The ARM NEON instructions are very powerful SIMD instructions that are very useful for optimising image processing and computer vision tasks on ARM devices. They are however quite difficult to use as each instruction has so many variants for the different input and output element types. I reckon it could be a problem well suited to visual/graph flow programming and as far as I can see the most capable people at those races are those in the noFlo team – I am getting seriously excited about their work!

Anyway back to Intercom for the moment!

Cross compiling libpng for ARM Linux with Neon and Zlib

libpng is the standard software library for creating .png image files. It can be built for arm with NEON SIMD support. Cross compiling it for ARM is reasonably straight forward. Its only dependency is zlib which configure can have problems finding.

Before building libpng you will first need to compile zlib.

Then download the libpng source from here, un-zip it etc. and then run confgure as follows:

./configure --host=arm-linux-gnueabi CC=arm-linux-gnueabi-gcc \
    AR=arm-linux-gnueabi-ar STRIP=arm-linux-gnueabi-strip RANLIB=arm-linux-gnueabi-ranlib \
   CPPFLAGS="-mfpu=neon -I/path/to/zlib/include/files" LDFLAGS="-L/path/to/zlib/lib/files"  \

In the above command replace:

a.) the path to your zlib include files (probably inside the install directory the the zlib build installed to)
b.) the path to your zlib lib files
c.) The path to the directory into which you want all of the output files installed
d.) change the compiler names (if different from arm-linux-gnueabi-gcc etc.)

Once configure completes you make & install:

make install

Now copy the files from the output directory to your ARM device.

Cross compiling libjpeg-turbo targeting ARM for software jpeg compression

In a quest to get faster software jpeg compression on ARM I cross compiled libjpeg-turbo 1.3.0 and pitted it against standard libjpeg (libjpeg-turbo can be used as a drop in replacement for libjpeg). For 24bit rbg images of size 4096×2000, libjpeg-turbo was about twice as fast as libjpeg. Here’s how I compiled libjpeg-turbo:

First get the source:


Then un-tar it and cd into the main source directory. Then configure for ARM:

 ./configure --host=arm-linux-gnueabi CC=arm-linux-gnueabi-gcc AR=arm-linux-gnueabi-ar \
          STRIP=arm-linux-gnueabi-strip RANLIB=arm-linux-gnueabi-ranlib \

And make:

make install

The output files will be put under the directory that you specified when you configured, copy them onto your ARM device as appropriate.

Build / Cross Compile lighttpd for ARM Linux with pcre

This is a record of how I built lighttpd with pcre for ARM. Most examples of cross compiling lighttpd for ARM do not include pcre, but to get the best out of lighttpd you really do need pcre built in. So we first need to get and cross compile pcre and then lighttpd.

Build pcre for ARM

In this example I assume that you create the build directories in you home directory, e.g. /home/youruser/ , you will need to change this in the following commands to match your actual directory set-up.

cd /home/youruser
mkdir buid_pcre
cd build_pcre
tar -xzf pcre-8.21.tar.gz
cd pcre-8.21
./configure --host=arm-linux-gnueabi CC=arm-linux-gnueabi-gcc \
AR=arm-linux-gnueabi-ar STRIP=arm-linux-gnueabi-strip \
RANLIB=arm-linux-gnueabi-ranlib \
make install

This should build pcre and install the output files into the following directory:


Change this path to suit your own needs.

Build lighttpd for ARM

Now that we have build pcre we can build lighttpd as follows, there is a bit of trickery involved for getting it to build with pcre, but happily this article showed me the way (thanks)!

cd /home/youruser
mkdir build_lighttpd
cd build_lighttpd
tar -zxvf lighttpd-1.4.32.tar.gz
cd lighttpd-1.4.32
./configure -prefix=/home/youruser/build_lighttpd/_install \ 
-host=arm-linux-gnueabi CC=arm-linux-gnueabi-gcc \
RANLIB=arm-linux-gnueabi-ranlib STRIP=arm-linux-gnueabi-strip\
--enable-shared --without-mysql --without-zlib --without-bzip2 \
--disable-ipv6 \
PCRECONFIG=/home/youruser/build_lighttpd/build_pcre/_install/bin/pcre-config \
PCRE_LIB=/home/youruser/build_lighttpd/build_pcre/_install/lib/libpcre.a \
CFLAGS="$CFLAGS -DHAVE_PCRE_H=1 -DHAVE_LIBPCRE=1 -I/home/youruser/build_lighttpd/build_pcre/_install/include"
make install

Again remember to change: /home/youruser/ in each case.

If the build succeded, all the files that you need to install lighttpd on your target ARM device should be under: /home/youruser/build_lighttpd/_install

Here is an article which talks about how to manually install lighttpd.

But at a very minimum you need to:

(a) Download and edit the config file – lighttpd.conf
(b) Copy the pcre libs to /usr/lib or similar – ,
(c) Copy on the lighttpd binary from: /home/youruser/build_lighttpd/_install/sbin
(d) Copy on the lib folder from /home/youruser/build_lighttpd/_install/lib
(e) Run lighttpd specifying the paths to config file and lib folder, for example:

lighttpd -D -f /etc/lighttpd/lighttpd.conf -m /usr/lib

Thanks to the following articles for the build info!

Building / Cross Compiling OpenCV for Linux ARM

This article outlines the steps necessary for building OpenCV for a Linux ARM target. OpenCV is an open-source, cross-platform computer vision and machine vision library.


I cross compiled OpenCV for a Xilinx Zinq ARM system yesterday by more-or-less following the steps outlined in the above document – I had to change a few things to get the build to work. I am documenting the exact steps that I took in case anybody is having trouble (probably future me!).


I started with a fairly clean Ubuntu install on a virtual machine (it already had git installed) , first I installed some build tools, feel free to skip any that you already have:

sudo apt-get install build-essential
sudo apt-get install cmake

Then I installed the GNU ARM tool-chain:

sudo apt-get install gcc-arm-linux-gnueabi
sudo apt-get install g++-arm-linux-gnueabi

This installed version 4.7 of the compilers while the build process calls for version 4.6, to get around this I modified the cmake platform file slightly, see below.


Create a build directory, cd into it and get the OpenCV source from github:

mkdir opencv_build
cd opencv_build
git clone

To fix the version problem I modified the compiler version in the platform file (this may not be the most correct way to do this but it worked for me!):


I edited this file:




I changed the GCC_COMPILER_VERSION variable’s value from 4.6 to 4.7 to match my installed compiler. I had to edit the file as I wasn’t able to override these variables from the command line.


Now create a sub-directory called build and cd into it:

mkdir build
cd build

And configure the build:

cmake -DSOFTFP=ON  -DCMAKE_TOOLCHAIN_FILE=../opencv/platforms/linux/arm-gnueabi.toolchain.cmake ../opencv

This should complete without errors if you have the compiler that it is looking for installed etc.


Now run ‘make’ and ‘make install’:

make install

Make will take a few minutes to run, make install should copy the output files to a subdirectory called ‘install’.


All being well you should now have all the include and lib files that you need to build an OpenCV app for your ARM device.


Cross compiling libjpeg for Linux on ARM

I am taking this opportunity to document a cross compilation procedure for libjpeg targeting ARM Linux mostly so that I won’t have to go searching for it again in the future!

First create a directory and cd to it: 

mkdir libjpeg_build
cd libjpeg_build

Now get the source and un-tar it:

tar -xzvf jpegsrc.v9.tar.gz

Configure the build, specifying your C compiler and cross compilation host, then make:

./configure --host=arm-xilinx-linux CC=arm-xilinx-linux-gnueabi-gcc

Here, I am using the xilinx build of the compiler, hence the reference to xilinx in the host and CC parameters, if I wasn’t using the xilinx tools the above configure command may have looked more like this:

./configure --host=arm-linux CC=arm-linux-gnueabi-gcc

Now make install, specifying a directory for the output:

make install DESTDIR=./_install

If all goes well the output of the build process should be written to the _install directory, copy the .so files to the appropriate directory on your target device (e.g. /usr/local/lib)