Building and configuring apr-util and httpd to use apr-iconv on Linux

ogradyjd picture ogradyjd · Nov 18, 2011 · Viewed 13.7k times · Source

I'm a glutton for punishment, and to prove it, I got myself a server and tried to build the entire LAMP stack myself. Then I ran into a problem where during a configure/make/install of httpd, I found that my compiled apr-util seemed to be not picking up apr-iconv properly. The sequence is:

  1. configure/make/install apr-1.4.5.
  2. configure/make/install apr-iconv-1.2.1
  3. configure/make/install apr-util-1.3.12
  4. configure/make/install httpd-2.2.21

All the apr's built fine, but when I tried to "make" httpd, I got this message:

make[3]: Leaving directory `/root/software/httpd-2.2.21/modules/mappers'
make[2]: Leaving directory `/root/software/httpd-2.2.21/modules/mappers'
make[1]: Leaving directory `/root/software/httpd-2.2.21/modules'
Making all in support
make[1]: Entering directory `/root/software/httpd-2.2.21/support'
make[2]: Entering directory `/root/software/httpd-2.2.21/support'
/usr/local/apr/build-1/libtool --silent --mode=compile gcc -g -O2 -pthread    -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE    -I/root/software/httpd-2.2.21/srclib/pcre -I. -I/root/software/httpd-2.2.21/os/unix -I/root/software/httpd-2.2.21/server/mpm/prefork -I/root/software/httpd-2.2.21/modules/http -I/root/software/httpd-2.2.21/modules/filters -I/root/software/httpd-2.2.21/modules/proxy -I/root/software/httpd-2.2.21/include -I/root/software/httpd-2.2.21/modules/generators -I/root/software/httpd-2.2.21/modules/mappers -I/root/software/httpd-2.2.21/modules/database -I/usr/local/apr/include/apr-1 -I/root/software/apr-util-1.3.12/../apr-iconv-1.2.1/include -I/usr/include -I/root/software/httpd-2.2.21/server -I/root/software/httpd-2.2.21/modules/proxy/../generators -I/usr/local/ssl/include -I/root/software/httpd-2.2.21/modules/ssl -I/root/software/httpd-2.2.21/modules/dav/main  -prefer-non-pic -static -c htpasswd.c && touch htpasswd.lo
/usr/local/apr/build-1/libtool --silent --mode=link gcc -g -O2 -pthread     -L/usr/lib -L/usr/local/ssl/lib   -o htpasswd  htpasswd.lo   -lm /root/software/httpd-2.2.21/srclib/pcre/libpcre.la /usr/local/apr/lib/libaprutil-1.la -lgdbm /root/software/apr-util-1.3.12/../apr-iconv-1.2.1/lib/libapriconv.la -lexpat /usr/local/apr/lib/libapr-1.la -lrt -lcrypt -lpthread -ldl -lcrypt
libtool: link: cannot find the library `/root/software/apr-util-1.3.12/../apr-iconv-1.2.1/lib/libapriconv.la' or unhandled argument `/root/software/apr-util-1.3.12/../apr-iconv-1.2.1/lib/libapriconv.la'
make[2]: *** [htpasswd] Error 1
make[2]: Leaving directory `/root/software/httpd-2.2.21/support'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/software/httpd-2.2.21/support'
make: *** [all-recursive] Error 1

The only part of the configuration I'm really not sure about is the with-apr-iconv setting in the apr-util configure script. It seems weird to reference another source directory instead of the shared libraries. Can anyone tell me what I'm doing wrong?

Server Info:

[root@server ~]# cat /etc/*-release
CentOS release 5.7 (Final)
[root@server ~]# uname -m
i686

Configure scripts:

apr-1.4.5

./configure --enable-shared \
            --enable-threads \
            --enable-other-child

apr-iconv-1.2.1

./configure --with-apr=/usr/local/apr

apr-util-1.3.12

./configure --with-apr=/usr/local/apr/bin/apr-1-config \
            --with-apr-iconv=../apr-iconv-1.2.1 \
            --with-mysql=/usr \
            --with-sqlite3=/usr  \
            --with-expat=/usr \
            --with-gdbm=/usr

httpd-2.2.21

./configure --enable-authn-anon \
            --enable-v4-mapped \
            --enable-authz-owner \
            --enable-auth-digest \
            --disable-imagemap \
            --enable-dav \
            --enable-dav-fs \
            --enable-dav-lock \
            --enable-deflate \
            --enable-expires \
            --enable-headers \
            --enable-info \
            --enable-mime-magic \
            --enable-proxy \
            --enable-proxy-ajp \
            --enable-proxy-http \
            --enable-proxy-ftp \
            --enable-proxy-balancer \
            --enable-proxy-connect \
            --enable-suexec \
            --enable-rewrite \
            --enable-so \
            --enable-ssl \
            --with-ssl=/usr/local/ssl \
            --disable-userdir \
            --enable-vhost-alias \
            --with-mpm=prefork \
            --enable-mods-shared=all \
            --with-apr=/usr/local/apr/bin/apr-1-config \
            --with-apr-util=/usr/local/apr/bin/apu-1-config

Answer

SlowTurtle picture SlowTurtle · Aug 1, 2012

Looks like you are almost there.

Extract the apr-util sources into a new directory. Run your ./configure replacing --with-apr-iconv= with --with-iconv= setting the option value to the prefix of where you have installed iconv. E.g. /usr/local

You will need to reconfigure and compile your httpd daemon as well. Best to start again from scratch with a clean extraction of source, your ./configure from above and the usual make, make install magic.