How to compile Apache-2.2.11 to ARM

By following these steps you have great chances to compile a recent Apache to your ARM system. This is how I made it.


My big-endian ARM toolchain was made with Buildroot. uClibc-0.9.30, binutils-2.18, gcc-4.2.1.

Determine the so called "triplet" of your toolchain. The easiest way is to locate the cross compiler (gcc) in your toolchain directory and see prefix of gcc. In my case this is armeb-linux-uclibc. Some packages refuse this long triplet, they prefer something more traditional, or no one knows what, but armeb-linux is usually adequate to them too. In my case armeb-linux-gcc is just a symlink to armeb-linux-uclibc-gcc, but for the choosy configure scripts this also suits. Triplet is referenced as TRIPLET (armeb-linux-uclibc) in this document.


Apache depends on pcre, Perl Compatible Regular Expressions. In the httpd package you can find a package of pcre amongst others (Apache Portable Runtime), in case of a default compile (e.g. on x86) this package is perfect for compiling Apache. In this case of ARM we neglect this builtin package, rather use an external package.

Apache relies on APR libraries and utils. APR is the abbreviation of Apache Portable Runtime. These packages must be compiled before the final webserver can be built. In a default case they would be built automatically during the build process of Apache, but this is not the default case, so we'll handle this also manually.

Other relevant dependencies are not known by me.

Compile target directories

The target directory you intend to put the compiled libraries and binaries is depending on you highly. In this article two important directories will be used.

The first one is a development directory for development packages. Into this directory those packages (dynamic and static libraries, headers and so on) will be put that are needed to compile an other package. Typically this target directory is the usr/ subpath of your toolchain's directory, since the toolchain is capable of finding headers and libraries located under its directory structure without any additional compile flag. And in most cases the toolchain is the best place to collect all the files that are essential in compiling other packages. Toolchain directory will be referred as TOOLCHAIN_DIR.

The second directory is the location where you want to put the compiled package. This will typically consist of executables, configuration files, man pages and libraries. This is usually a path in your root filesystem. Under a regular x86 system when you compile native programs, this can be for example either /usr or /usr/local. In case of cross-compiling, something like this is possible: /home/user/arm-project/rootfs. This directory will be referred as ROOTFS_DIR.


Download package.

Nothing special, this can be cross-compiled to ARM easily.

cd pcre-7.9; /

./configure /

--host=$TRIPLET /

--prefix=$TOOLCHAIN_DIR/usr; /

make; /

make install

httpd-2.2.18 (Apache)

Download e.g. from here (Hungarian server, locate an other mirror if slow).


Autoconf variables may have other values depending on your toolchain/machine.

cd httpd-2.2.18/srclib/apr; /

ac_cv_file__dev_zero="yes" /

ac_cv_func_setpgrp_void="yes" /

apr_cv_tcp_nodelay_with_cork="yes" /

ac_cv_sizeof_struct_iovec="8" /

./configure /

--host=$TRIPLET /

--prefix=$ROOTFS_DIR/usr/apache; /

make; /

make install


APR util

Autoconf variable may have other value depending on your toolchain/machine.

cd httpd-2.2.18/srclib/apr-util; /

./configure /

--host=$TRIPLET /

--prefix=ROOTFS_DIR/usr/apache /

--with-apr=$ROOTFS_DIR/usr/apache; /

make; /

make install



Autoconf variables may have other values depending on your toolchain/machine. They have to be set manually, because configure script is unable to guess their values.

cd httpd-2.2.18; /

ap_cv_void_ptr_lt_long=no /

LDFLAGS="-lpthread" /

./configure /

--host=$TRIPLET /

--prefix=/usr/apache /

--with-apr=$ROOTFS_DIR/usr/apache /

--with-apr-util=$ROOTFS_DIR/usr/apache /

--with-pcre=$TOOLCHAIN_DIR/usr /

--enable-so /

--enable-cgi; /

make; /

DESTDIR=$ROOTFS_DIR make install

Last steps

To check the runtime library dependencies of httpd, use the $TRIPLET-ldd program. libpcre is obviously needed:

cp $TOOLCHAIN_DIR/usr/lib/* $ROOTFS_DIR/usr/lib

Don't forget to configure your new httpd (httpd.conf).

Have fun!