My main idea...
As quoted from " https://sites.google.com/a/droboports.com/www/app-repository/lighttpd-1-4-30" lighttpd could be build "statically" for ARM. I dont own any hardware material for this architecture
You can do almost the same for arch=i386. By "almost the same" I mean that lighttpd 1.4.36 will be built with
Package |
Version |
Zlib | 1.2.8 |
Bzip2 | 1.0.6 |
Pcre | 8.37 |
OpenSSL | 1.0.1p |
Lua | 5.1.5 |
LibXML2 | 2.9.2 |
SQLite | 3081101 |
UUID library (from e2fsprogs) | 1.42.13 |
and using
ldd
you will get
root@amdgaming:~# ldd /opt/lighttpd/1.4.36/sbin/lighttpd
linux-gate.so.1 => (0xb7794000)
libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb7764000)
libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb7747000)
libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb7599000)
/lib/ld-linux.so.2 (0x8001e000)
Recent kernel/Old kernel for a deployment ?
Let suppose that you want to build lighttpd somewhere on on machine with a recent kernel and you want to deploy it on a machine with a kernel older
Before going ahead if your main goal is to deploy this on a machine and if all packages listed above are enough for your own uses then use file
before
In my case lighttpd was built on a Kernel 4.1.6 with gcc-4.9.1 on Ubuntu 14.10 32 Bits
root@amdgaming:~# file /opt/lighttpd/1.4.36/sbin/lighttpd
/opt/lighttpd/1.4.36/sbin/lighttpd: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=9f2b11764c80ecfb2063116eae0e8c5f6a6ab5bb, stripped
As shown above lighttpd binary can work only with any kernel greater than 2.6.32. If your kernel on -- which lighttpd binary will be deployed -- is older than 2.6.32 then you will get the well-known error
FATAL: Kernel too old
So it means that for my own uses I can deploy it only on a machine with kernel >= 2.6.32.
Example: For a machine with a kernel like 2.6.20 on which lighttpd is supposed to be deployed then
- set up a VM with Ubuntu Lucid 10.04 or Ubuntu 8.04 -- Use a tool like Qemu or VMWare -- your favorite tool
- Build lighttpd on this VM.
Have a look on this page for binary deployement
" https://sites.google.com/a/droboports.com/www/app-repository/lighttpd-1-4-30"
Build lighttpd
Here are my own commands for lighttpd 1.4.36 with the latest packages I could find. Commands are taken from " https://sites.google.com/a/droboports.com/www/app-repository/lighttpd-1-4-30"
export DEST=/opt/lighttpd/1.4.36/
export SRC=/opt/Sources/All_sources_for_lighttpd
# Create folders
mkdir -pv $DEST
mkdir -pv $DEST $SRC
# Build zlib
cd $SRC
wget wget http://zlib.net/zlib-1.2.8.tar.gz
tar xvzf zlib-1.2.8.tar.gz
cd zlib-1.2.8
CFLAGS=" -O3" ./configure --prefix=$DEST --static
make clean
make
ZLIB=`pwd`
cd ..
# Build bzip2
wget http://bzip.org/1.0.6/bzip2-1.0.6.tar.gz
tar zxf bzip2-1.0.6.tar.gz
cd bzip2-1.0.6/
make clean
make libbz2.a CFLAGS=" -Wall -Winline -O3 -g -D_FILE_OFFSET_BITS=64"
BZIP=`pwd`
cd ..
# Build pcre
wget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.37.tar.bz2
tar xvjf pcre-8.37.tar.bz2
cd pcre-8.37
CFLAGS=" -O3 -I$ZLIB -I$BZIP" CXXFLAGS="$CFLAGS" LDFLAGS="-L$ZLIB -L$BZIP" ./configure \
--prefix=$DEST --enable-pcregrep-libz --enable-pcregrep-libbz2 --enable-unicode-properties --disable-shared
make clean
make
PCRE=`pwd`
cd ..
# Build OpenSSL
wget http://openssl.org/source/openssl-1.0.1p.tar.gz
tar xvzf openssl-1.0.1p.tar.gz
cd openssl-1.0.1p
./Configure linux-generic32 -DL_ENDIAN --prefix=$DEST \
--openssldir=$DEST/etc/ssl no-shared no-zlib-dynamic --with-zlib-include=$ZLIB --with-zlib-lib=$ZLIB
sed -i -e "s/CFLAG= /CFLAG=${CFLAGS} /g" Makefile
make clean && make && make install_sw
rm -fr $DEST/include
rm -fr $DEST/lib
OPENSSL=`pwd`
cd ..
# Build Lua
wget http://www.lua.org/ftp/lua-5.1.5.tar.gz
tar xvzf lua-5.1.5.tar.gz
cd lua-5.1.5
make clean
make PLAT=linux INSTALL_TOP=$DEST CFLAGS=" -O3 -Wall " LIBS="-lm "
LUA=`pwd`
cd ..
# Build LibXML2
wget ftp://xmlsoft.org/libxml2/libxml2-2.9.2.tar.gz
tar xvzf libxml2-2.9.2.tar.gz
cd libxml2-2.9.2
CFLAGS=" -O3 -I$ZLIB" LDFLAGS=" -L$ZLIB -lz -lm" ./configure --prefix=$DEST --with-zlib --without-python --disable-shared
make clean && make
LIBXML=`pwd`
cd ..
# Build SQLite
wget http://www.sqlite.org/2015/sqlite-autoconf-3081101.tar.gz
tar xvzf sqlite-autoconf-3081101.tar.gz
cd sqlite-autoconf-3081101
CFLAGS=" -O3" LIBS="-ldl -lpthread" ./configure --prefix=$DEST --enable-shared=no
make clean && make
SQLITE=`pwd`
cd ..
# Build UUID
wget http://prdownloads.sourceforge.net/e2fsprogs/e2fsprogs-1.42.13.tar.gz
tar xvzf e2fsprogs-1.42.13.tar.gz
cd e2fsprogs-1.42.13
CFLAGS=" -O3" ./configure --prefix=$DEST --disable-elf-shlibs
cd lib/uuid/
make clean && make
LIBUUID=`pwd`
cd ../../..
# Build and install lighttpd 1.4.36
wget http://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-1.4.36.tar.gz
tar xvzf lighttpd-1.4.36.tar.gz
cd lighttpd-1.4.36
CFLAGS=" -O3 -I$ZLIB -I$BZIP -I$PCRE -DPCRE_STATIC -I$OPENSSL/include -I$LIBUUID/.." \
LDFLAGS=" -L$ZLIB -L$BZIP -L$PCRE/.libs -L$OPENSSL -L$LIBUUID" LIBS="-lz -lbz2 -lpcre -luuid -lssl -lcrypto -ldl -lm -lpthread" \
LUA_CFLAGS="-I$LUA/src" LUA_LIBS="-L$LUA/src" XML_CFLAGS="-I$LIBXML/include" XML_LIBS="-L$LIBXML/.libs -lxml2 -lm" \
SQLITE_CFLAGS="-I$SQLITE" SQLITE_LIBS="-L$SQLITE/.libs -lsqlite3" ac_cv_path_PCRECONFIG=$PCRE/pcre-config \
./configure --prefix=$DEST --with-openssl --with-pcre --with-zlib --with-bzip2 --with-lua --with-webdav-props --with-webdav-locks
make clean
make
make install
Remember that
strip
is your friend
strip $DEST/sbin/lighttpd