Project

General

Profile

How to make from source lighttpd for raspbian (my saga)

Added by braselectron about 4 years ago

As the title implies I've tried to installed lighttpd on a Raspberry Pi, but not successful.

Initial considerations:

  1. Most wiki's and blog information online are misleading.
  2. Building from source is not a simple task from the user perpective, which did not develop the code, and does not have well documented information about the source.
  3. Dependencies should be well documented on in the tar ball, but usually is not.
  4. There are many key options in the configure and make processes that should be better documented, at least for main Linux distributions and avoid rework (ie. reverse engineering) when you need to build from source.
  5. Some times, upgrading to newer unstable, bleeding edge release, is not the answer, especially if you spent many days/months right tuning your install.

Why did I embark in this "work"

I needed a feature that is not available in deb package repository of the version of raspbian I am using, which is the proxy_mod - proxy.header("map-urlpath") feature.

sysinfo

Distributor ID: Raspbian
Description   : Raspbian GNU/Linux 9.11 (stretch)
Release       : 9.11
Codename      : stretch
Arch          : armv6l 
Model         : Raspberry Pi Model B Rev 2 
Kernel        : 4.19.66+ 
Shell         : bash 4.4.12 
CPU           : ARMv6-compatible rev 7 (v6l) (1) @ 0.7GHz 
Memory        : 512MB

Initial download

I have a 'Downloads' folder, so I did this:

cd ~/Downloads

Once there I can download the following tar ball:

wget https://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-1.4.55.tar.gz

Than you must extract the tar ball:

tar -xvf lighttpd-1.4.55.tar.gz

Finally go to the folder created with:

cd ~/Downloads/lighttpd-1.4.55/

So for the newbies these are always presented as the next steps (ie. as printed in many wiki's, forum and README files):

./configure         *needs a lot of other options
make                *might need more parameters
sudo make install   *beware!!!*

You should only make install if you know what your doing and know how to uninstall.

But this does not work for most cases, since it does not include de addons needed.

I had to use this (many times to pinpoint the dependecies):

./configure --with-openssl --with-openssl-libs=/usr/include/openssl --with-lua \
 --with-attr --with-ldap --with-memcached --with-gdbm --with-webdav-props \
 --with-webdav-locks --with-fam

Now please note this: " error messages are always your cryptographic life saver! ", meaning: difficult to understand but the best clue you have to solve the problem. So take your time to understand the messages.

NOTE: the '--with-memcached' option is a annoyance (ie. pain-in-the-ass) error, since it is spelled wrong in most every blog, forum, wiki on the web. This consumed much of my time. Beware!

But, this will only work after all the dependencies were meet....follow on:

Dependency saga:

I had to interactively run ./configure many times to pinpoint each dependency package and search for the correct one needed (ie. that the compiler accepted and recognized). Many misleading, outdated information on the most blogs, wiki's, and forums.

The packages I needed to install (so far) were:

apache2-utils                 2.4.25-3+deb9u9
build-essential               12.3
libattr1-dev:armhf            1:2.4.47-2
libbz2-dev:armhf              1.0.6-8.1
libfam-dev:armhf              2.7.0-17.2
libfam0:armhf                 2.7.0-17.2
libfcgi-dev:armhf             2.4.0-8.4
libgdbm-dev:armhf             1.8.3-14
libglib2.0-dev                2.50.3-2+deb9u2
libldap2-dev:armhf            2.4.44+dfsg-5+deb9u1
liblua5.1-0-dev:armhf         5.1.5-8.1
libmemcached-dev              1.0.18-4.1
libpcre3-dev:armhf            2:8.39-3
libsqlite3-dev:armhf          3.16.2-5+deb9u1
libssl-dev:armhf              1.1.0l-1~deb9u1
libterm-readline-perl-perl    1.0303-1
libuu-dev                     0.5.20-9
libxml2-dev:armhf             2.9.4+dfsg1-2.2+deb9u2
libzip-dev:armhf              1.1.2-1.1
lsb-base                      9.20161125+rpi1
lua5.1                        5.1.5-8.1
memcached                     1.4.33-1
rrdtool                       1.6.0-1+b1
spawn-fcgi                    1.6.4-1
sqlite3                       3.16.2-5+deb9u1
uuid-dev:armhf                2.29.2-1+deb9u1

REMARK:
How I created this list:

   dpkg-query -W -f='${binary:Package} ${Version}\t${Maintainer}\n'
also note this: ${field[;width]} width negative is left align, positive is right alignment.
dpkg-query -W -f='${binary:Package;-26}\t${Version}\n' build-essential libglib2.0-dev libssl-dev libpcre3-dev libbz2-dev libzip-dev  libxml2-dev sqlite3 lua5.1 apache2-utils libsqlite3-dev libuu-dev lsb-base  libfam0 libfam-dev rrdtool spawn-fcgi libterm-readline-perl-perl  libldap2-dev libgdbm-dev uuid-dev libfcgi-dev libattr1-dev liblua5.1-0-dev  memcached libmemcached-dev libfam-dev

To install dependencies you should do this:

sudo apt-get install \
 build-essential libglib2.0-dev libssl-dev libpcre3-dev libbz2-dev libzip-dev \
 libxml2-dev sqlite3 lua5.1 apache2-utils libsqlite3-dev libuu-dev lsb-base \
 libfam0 libfam-dev rrdtool spawn-fcgi libterm-readline-perl-perl \
 libldap2-dev libgdbm-dev uuid-dev libfcgi-dev libattr1-dev liblua5.1-0-dev \
 memcached libmemcached-dev libfam-dev

And some of the above installed additional packages with them (ie. dependencies of dependences) automatically.

After many hours, finally I did 'make' it!

And this is what you get when running the binary created in de 'src' folder:

~/Downloads/lighttpd-1.4.55/src $ ./lighttpd -V
lighttpd/1.4.55 (ssl) - a light and fast webserver

Event Handlers:

    + select (generic)
    + poll (Unix)
    + epoll (Linux)
    - /dev/poll (Solaris)
    - eventports (Solaris)
    - kqueue (FreeBSD)
    - libev (generic)

Network handler:

    + linux-sendfile
    - freebsd-sendfile
    - darwin-sendfile
    - solaris-sendfilev
    + writev
    + write
    - mmap support

Features:

    + IPv6 support
    + zlib support
    + bzip2 support
    + crypt support
    + SSL support
    + PCRE support
    - MySQL support
    - PgSQL support
    - DBI support
    - Kerberos support
    + LDAP support
    - PAM support
    + memcached support
    + FAM support
    + LUA support
    + xml support
    + SQLite support
    + GDBM support

Last but not the end, yet!

Well, now you must believe we are going to the final step: sudo make install, not yet...

Here we got stuck, and I am having trouble, that is, the make install does not create the needed folders and does complain about missing pl scripts (only found one of them).

/bin/bash: /usr/share/lighttpd/use-ipv6.pl: No such file or directory
/bin/bash: /usr/share/lighttpd/create-mime.assign.pl: No such file or directory
/bin/bash: /usr/share/lighttpd/include-conf-enabled.pl: No such file or directory

So now I need help from our linux community to finish the install. Please share your thoughts/knowledge/ideas.

signing off for now.


Replies (3)

RE: How to make from source lighttpd for raspbian (my saga) - Added by gstrauss about 4 years ago

Thanks for your detailed notes, though I almost stopped reading at your generic complaints at the beginning.

Please be aware that lighttpd runs in many different distros, which use many different packaging managers, and each distribution might create packages with slightly different names for those dependencies. The lighttpd code does not maintain the packaging information for <insert your favorite distro here>. Package maintainers do for each of those packages in each of those distros. They are many different people, almost none of who work on upstream lighttpd code.

In the future, I might recommend an alternative to all the steps you took above: download an updated source package from a newer version of your distro, and try to build the package on your distro. In the case of lighttpd, this will often work without any further modification, but is not guaranteed to work. lighttpd 1.4.55 is present in Debian Sid and will hopefully soon be available in Buster backports. If you download the Debian source package for lighttpd, you'll find information about package dependencies in the debian/control and ./configure switches in the debian/rules files. If you have installed Debian build tools, you can build the package with dpkg-buildpackage -uc -us from within the expanded tree of the lighttpd debian source package.

In your case, you have built lighttpd from upstream source, and have run the lighttpd upstream make install, but your configuration files are based on Debian. If you look in debian/lighttpd.*, specifically debian/lighttpd.install (https://salsa.debian.org/debian/lighttpd/-/blob/master/debian/lighttpd.install) you'll see where Debian picks up the missing files you seek. Some of the files are part of the lighttpd source code (doc/scripts/create-mime.conf.pl) and some are part of the debian-specific package (use-ipv6.pl and include-conf-enabled.pl)

RE: How to make from source lighttpd for raspbian (my saga) - Added by braselectron about 4 years ago

First of all, thank you for taking your time and answering, and must say that I do not build from source too often.

I personally enjoy lighttpd "effort", great work! And have been using it since raspbian wheezy release.

Just to understand your instructions, please do explain:

1) when you say "look in debian/lighttpd.* ..." you mean look here: https://salsa.debian.org/debian/lighttpd/-/tree/master/debian

2) when you explain where the "perl" scripts are from, I understand too, that I can get them from a older version already made for my distribution, repository, since they are "perl" scripts and just might work in this new version.

3) when you say: "If you have installed Debian build tools, you can build the package with dpkg-buildpackage -uc -us from within the expanded tree of the lighttpd debian source package."

I understand that I can just use the command from within the my ~/Downloads/lighttpg-1.4.55/ folder and it will create the deb installer with the correct tree and files needed.

3.1) don't I need to ajust (fix) any of the configuration files to reflect raspbian stetch tree ?

Thank you.

RE: How to make from source lighttpd for raspbian (my saga) - Added by gstrauss about 4 years ago

There is a difference between the lighttpd source from lighttpd.net and the Debian source package for lighttpd.

I understand that I can just use the command from within the my ~/Downloads/lighttpg-1.4.55/ folder and it will create the deb installer with the correct tree and files needed.

No.

When I say "lighttpd Debian source package", I mean something very specific, and not the same as wget https://download.lighttpd.net/lighttpd/releases-1.4.x/lighttpd-1.4.55.tar.gz

3.1) don't I need to ajust (fix) any of the configuration files to reflect raspbian stetch tree ?

I am not familiar with the specifics of raspbian, but see that it is Debian-based, so I tried to give you some Debian-based pointers.

    (1-3/3)