Postfix compile error

Discussion in 'Server Operation' started by WilyeECoyote, Jan 16, 2012.

  1. WilyeECoyote

    WilyeECoyote New Member

    Figured it out. Needed a couple of -lresolv in the a couple of places.


    I got this problem when compiling postfix 2.8.5 on Ubuntu 11.10

    ../../lib/libdns.a: error: undefined reference to '__dn_expand'
    ../../lib/libdns.a: error: undefined reference to '__res_search'

    Anyone know how to fix this??

    Lars Fisker
    Last edited: Jan 16, 2012
  2. Icon

    Icon New Member

    Got same problem, but don't know howto do "a couple of -lresolv in the a couple of places". Can anyone tell what exactly must be done to fix, please?
  3. Icelake

    Icelake New Member HowtoForge Supporter

    Re. building error: Postfix VDA 2.9.1

    Can anyone with the right knowledge please describe the process of fixing the above problem,

    ../../lib/libdns.a: undefined reference to `__res_search'
    ../../lib/libdns.a: undefined reference to `__dn_expand'

    that makes the building process with the VDA 2.9.1 patch end in error?
    I think it might be useful for many members.

    Best regards/Icelake
    Last edited: May 17, 2012
  4. medved

    medved New Member

    Postfix VDA 2.9.1

    make: *** [maildir.o] Error 1
    make: Leaving directory `/usr/src/postfix-2.9.1/src/virtual'
    make[1]: *** [update] Error 1
    make[1]: Leaving directory `/usr/src/postfix-2.9.1'
    make: *** [build] Error 2
    dpkg-buildpackage: error: debian/rules build gave error exit status 2

    somebody knows as to solve a problem?
  5. falko

    falko Super Moderator ISPConfig Developer

    Did you use the correct VDA patch for your Postfix version?

    Which distribution do you use?
  6. Icelake

    Icelake New Member HowtoForge Supporter

    Hi, Falko!

    On my behalf I tested as you suggested and got the answer:
    mail_version = 2.9.1
    milter_macro_v = $mail_name $mail_version
    so I fetched the patch: postfix-vda-v11-2.9.1.patch with wget as you described in your Howto.

    I use Ubuntu 12.04 swedish version.

  7. falko

    falko Super Moderator ISPConfig Developer

    Not sure if this helps, but you can try to install the package binutils-gold. Then try to build Postfix again.
  8. Icelake

    Icelake New Member HowtoForge Supporter

    Thanks, Falko!
    I erased everething and downloaded the files fresh (just in case).
    It didn't work out with the new linker either.
    So I just sit on the problem for the moment.
    Wonders however...
    Is it possible to use the resulting mailserver without the qutoa patch?
    Or will it kick back at you, if it not finds the quota information in the database?

  9. gaborojo

    gaborojo New Member

    Hi Falko!!

    When I try to build package got the same error, I´ve been following your how to from this web site. Is it posible use mail server without patch?

    I tried with Ubuntu 12.04 LTS (64 bits and 32 bits)

    Best Regards!
  10. falko

    falko Super Moderator ISPConfig Developer

    Yes, but quota won't work then.
  11. gaborojo

    gaborojo New Member


    Ok Falco, I will be following your how to and I´ll be trying to fix this problem.

    I have installed binutils-gold getting the same message log. :(

    Thank you very much.
  12. Juu8888

    Juu8888 New Member

    German language breaks postfix compilation

    I had the same problem with Ubuntu 12.04 and postfix 2.9.3 with vda-patch 2.9.1

    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:

    Linux.3*)   SYSTYPE=LINUX3
                if [ -f /usr/include/db.h ]
                    : we are all set
                elif [ -f /usr/include/db/db.h ]
                    CCARGS="$CCARGS -I/usr/include/db"
                    # 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
                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"
                for name in nsl resolv
                    for lib in $SEARCHDIRS
                        test -e $lib/lib$name.a -o -e $lib/lib$ && {
                            SYSLIBS="$SYSLIBS -l$name"

    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.

Share This Page