Base sendmail: undefined symbol in libmilter when -DLDAPMAP set in make.conf

Jonathan McKeown jonathan at
Tue Oct 17 15:15:26 UTC 2006

This summarises the conversation I have had with myself on the list over the 
last few days: I'm not sure whether this is really a question or a potential 

I am running FreeBSD-6.1-RELEASE-p5 (cvsup on 6 September).

One of the source files for a rebuild of /usr/src/contrib/sendmail/libmilter 
is /usr/src/contrib/sendmail/libsm/errstring.c.

If SENDMAIL_CFLAGS in /etc/make.conf contains -DLDAPMAP (and SENDMAIL_LDADD 
contains "-lldap -llber") when libmilter is rebuilt, LDAPMAP enables a 
conditional compilation in errstring.c of a call to ldap_err2string.

The resulting libmilter.a contains an undefined reference to that symbol, 
which prevents building some ports which use milters (at least 
mail/mimedefang as per my experience, mail/sentinel as per PR ports/95647 and 
security/amavisd-milter as per PR ports/95646).

There is a suggested fix under ports/95646, which is to ensure that when 
building libmilter, the SENDMAIL_CFLAGS and SENDMAIL_LDADD do *not* contain 
-DLDAPMAP and -lldap -llber respectively.

I have used the following in /etc/make.conf to do this:

SENDMAIL_CFLAGS  = -I/usr/local/include -DSASL=2
SENDMAIL_LDFLAGS = -L/usr/local/lib
SENDMAIL_LDADD   = -lsasl2
.if ${.CURDIR} != /usr/src/lib/libmilter
    SENDMAIL_LDADD   += -lldap -llber

It appears to work but it does seem... less than elegant.


More information about the freebsd-questions mailing list