I had the same problem with Ubuntu 12.04 and postfix 2.9.3 with vda-patch 2.9.1
Code:
gcc -Wmissing-prototypes -Wformat -DDEBIAN -DMAX_DYNAMIC_MAPS -DHAS_PCRE -DHAS_LDAP -DHAS_SQLITE -DMYORIGIN_FROM_FILE -DNO_NIS -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAS_CDB -DHAS_MYSQL -I/usr/include/mysql -DHAS_PGSQL -I/usr/include/postgresql -DHAS_SQLITE -I/usr/include -DHAS_SSL -I/usr/include/openssl -DUSE_SASL_AUTH -I/usr/include/sasl -DUSE_CYRUS_SASL -DUSE_TLS -O2 -I. -I../../include -DLINUX3 -o smtpd smtpd.o smtpd_token.o smtpd_check.o smtpd_chat.o smtpd_state.o smtpd_peer.o smtpd_sasl_proto.o smtpd_sasl_glue.o smtpd_proxy.o smtpd_xforward.o smtpd_dsn_fix.o smtpd_milter.o smtpd_resolve.o smtpd_expand.o ../../lib/libmaster.a ../../lib/libtls.a ../../lib/libdns.a ../../lib/libxsasl.a ../../lib/libmilter.a ../../lib/libglobal.a ../../lib/libutil.a -lssl -lcrypto -lsasl2 -lpthread -L/usr/src/postfix-2.9.3/debian -ldb
../../lib/libdns.a: undefined reference to `__res_search'
../../lib/libdns.a: undefined reference to `__dn_expand'
collect2: ld gab 1 als Ende-Status zurück
make: *** [smtpd] Fehler 1
The reason of this error: missing -lresolv
I found a problem in Postfix
makedefs file. Let's check the source:
Code:
Linux.3*) SYSTYPE=LINUX3
if [ -f /usr/include/db.h ]
then
: we are all set
elif [ -f /usr/include/db/db.h ]
then
CCARGS="$CCARGS -I/usr/include/db"
else
# On a properly installed system, Postfix builds
# by including <db.h> and by linking with -ldb
echo "No <db.h> include file found." 1>&2
echo "Install the appropriate db*-devel package first." 1>&2
echo "See the RELEASE_NOTES file for more information." 1>&2
exit 1
fi
SYSLIBS="-ldb"
SEARCHDIRS=$(${CC-gcc} -print-search-dirs 2>/dev/null |
sed -n '/^libraries: =/s/libraries: =//p' |
sed -e 's/:/\n/g' | xargs -n1 readlink -f |
grep -v 'gcc\|/[0-9.]\+$' | sort -u)
if [ -z "$SEARCHDIRS" ]; then
SEARCHDIRS="/usr/lib64 /lib64 /usr/lib /lib /usr/lib/i386-linux-gnu"
fi
for name in nsl resolv
do
for lib in $SEARCHDIRS
do
test -e $lib/lib$name.a -o -e $lib/lib$name.so && {
SYSLIBS="$SYSLIBS -l$name"
break
}
done
done
;;
The explanation:
gcc -print-search-dirs | sed -n '/^libraries: =/s/libraries: =//p' didn't work for me, because i have Ubuntu in german language.
The
gcc -print-search-dirs output is "Bibliotheken", german word of "libraries".
After changing the sed command the SYSLIBS variable filled in correctly and Postfix compiles fine.