Tuesday, June 9, 2009

how to cross compile lighttpd with pcre support

1. download lighttpd and pcre from
http://www.lighttpd.net/download (the current version is 1.4.22)
http://www.pcre.org/ (the current versioin is 7.9)

2. cross compile pcre at first.

a. setup the environment. I use ELDK as the cross compile tools.
#!/bin/sh

export ROOTFOLDER=/home/hongfeng/PhoenixWebUI/ELDK
export PATH=$ROOTFOLDER/bin:$ROOTFOLDER/usr/bin:$PATH
export CC=arm-linux-gcc
export AR=arm-linux-ar
export LD=arm-linux-ld
export RANLIB=arm-linux-ranlib
export STRIP=arm-linux-strip
export AS=arm-linux-as
export NM=arm-linux-nm
export ARCH=arm
export CROSS_COMPILE=arm-linux-

b. cross compile pcre and install it.
./configure --host=arm --prefix=/home/hongfeng/PhoenixWebUI/usr
make
make install

3. cross compile lighttpd and install it.
./configure --with-pcre --host=arm-linux --without-bzip2 PCRECONFIG=pcre-config PCRE_LIB=/home/hongfeng/PhoenixWebUI/usr/lib/libpcre.a CFLAGS="$CFLAGS -DHAVE_PCRE_H=1 -DHAVE_LIBPCRE=1 -I/home/hongfeng/PhoenixWebUI/usr/include" LDFLAGS="$LDFLA
GS" --without-zlib --prefix=/home/hongfeng/PhoenixWebUI/usr/
make
make install

After that, everything is in /home/hongfeng/PhoenixWebUI/usr

copy them to the device and run it in the device
/usr/sbin/lighttpd -D -f /usr/lighttpd.conf -m /usr/lib &

it works.

No comments: