How to compile Apache-2.2.11 to ARM

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.

Toolchain

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.

Dependencies

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.

pcre-7.9

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).

APR

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

 

httpd

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/libpcre.so* $ROOTFS_DIR/usr/lib

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

Have fun!

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值