# mail/postfix build fails



## jef (Apr 19, 2012)

I ran into this after upgrading openssl and working to recompile dependent ports.

It appears to be very similar to the previously resolved ports/136599: [PATCH] mail/postfix patch for closefrom() in 8.0

On a freebsd-update-ed version of 7.4, with the currents ports tree (portsnap) over the last couple days, the compile fails with 


```
cc -DDEF_CONFIG_DIR=\"/usr/local/etc/postfix\" -DDEF_DAEMON_DIR=\"/usr/local/libexec/postfix\" -DDEF_COMMAND_DIR=\"/usr/local/sbin\" -DDEF_SENDMAIL_PATH=\"/usr/local/sbin/sendmail\" -DDEF_NEWALIAS_PATH=\"/usr/local/bin/newaliases\" -DDEF_MAILQ_PATH=\"/usr/local/bin/mailq\" -DDEF_MANPAGE_DIR=\"/usr/local/man\" -DDEF_README_DIR=\"/usr/local/share/doc/postfix\" -DDEF_HTML_DIR=\"/usr/local/share/doc/postfix\" -DDEF_QUEUE_DIR=\"/var/spool/postfix\" -DDEF_DATA_DIR=\"/var/db/postfix\" -DDEF_MAIL_OWNER=\"postfix\" -DDEF_SGID_GROUP=\"maildrop\" -DHAS_PCRE -I/usr/local/include -DUSE_SASL_AUTH -DDEF_SERVER_SASL_TYPE=\"dovecot\" -DUSE_TLS -I/usr/include -DHAVE_NS_TYPE -DHAS_SPF -I/usr/local/include  -O2 -fno-strict-aliasing -pipe -I. -DFREEBSD7 -c attr_print64.c
In file included from attr_clnt.c:77:
/usr/include/unistd.h:329: error: conflicting types for 'closefrom'
./sys_defs.h:1495: error: previous declaration of 'closefrom' was here
In file included from ./vstream.h:22,
                 from attr_print0.c:96:
/usr/include/unistd.h:329: error: conflicting types for 'closefrom'
./sys_defs.h:1495: error: previous declaration of 'closefrom' was here
*** Error code 1
*** Error code 1
In file included from ./vstream.h:22,
                 from attr_print64.c:96:
/usr/include/unistd.h:329: error: conflicting types for 'closefrom'
./sys_defs.h:1495: error: previous declaration of 'closefrom' was here
```
The following are set in make config:

PCRE
DOVECOT2
TLS
TEST
SPF


```
[root@test-compile /usr/ports/mail/postfix]# cat /var/db/ports/postfix/options
# This file is auto-generated by 'make config'.
# No user-servicable parts inside!
# Options for postfix-2.9.1,1
_OPTIONS_READ=postfix-2.9.1,1
WITH_PCRE=true
WITHOUT_SASL2=true
WITHOUT_DOVECOT=true
WITH_DOVECOT2=true
WITHOUT_SASLKRB5=true
WITHOUT_SASLKMIT=true
WITH_TLS=true
WITHOUT_BDB=true
WITHOUT_MYSQL=true
WITHOUT_PGSQL=true
WITHOUT_SQLITE=true
WITHOUT_OPENLDAP=true
WITHOUT_LDAP_SASL=true
WITHOUT_CDB=true
WITHOUT_NIS=true
WITHOUT_VDA=true
WITH_TEST=true
WITH_SPF=true
WITHOUT_INST_BASE=true
```


```
[root@test-compile /usr/ports/mail/postfix]# uname -a
FreeBSD test-compile 7.4-RELEASE-p3 FreeBSD 7.4-RELEASE-p3 #0: Tue Sep 27 14:47:23 UTC 2011     root@i386-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  i386
```

I've tried it in both the host machine (i386), as well as in jails, including a "fresh" jail (shown above) and it fails in the same way in all cases.

It succeeds on FreeBSD 9 (amd64)


```
[jeff@port3 /usr/ports/mail/postfix]$ uname -a
FreeBSD port3.pn.wagsky.com 9.0-STABLE FreeBSD 9.0-STABLE #0: Mon Apr 16 23:48:11 PDT 2012     root@port3.pn.wagsky.com:/usr/obj/usr/src/sys/VIMAGE  amd64
```

Is anyone else seeing this? Any suggestions for resolution?


----------



## jef (Apr 19, 2012)

The patched version of src/util/sys_defs.h in the FreeBSD 7 jail seems to have a HAS_CLOSEFROM hook in place (that is the same that I see on the FreeBSD 9 build:

```
111 #if __FreeBSD_version >= 420000
    112 #define HAS_DUPLEX_PIPE                 /* 4.1 breaks with kqueue(2) */
    113 #endif
    114 
    115 #if (__FreeBSD_version >= 702104 && __FreeBSD_version <= 800000) \
    116     || __FreeBSD_version >= 800100
    117 #define HAS_CLOSEFROM
    118 #endif
    119 
    120 /* OpenBSD version is year+month */
    121
```

Edit -- Interesting, /usr/include/sys/param.h shows

```
/* 
 * __FreeBSD_version numbers are documented in the Porter's Handbook.
 * If you bump the version for any reason, you should update the documentation
 * there.
 * Currently this lives here:
 *
 *      doc/en_US.ISO8859-1/books/porters-handbook/book.sgml
 *
 * scheme is:  <major><two digit minor>Rxx
 *              'R' is 0 if release branch or x.0-CURRENT before RELENG_*_0
 *              is created, otherwise 1.
 */
#undef __FreeBSD_version
#define __FreeBSD_version 701000        /* Master, propagated to newvers */
```

I would have expected 704100.


```
[jeff@port16 /usr/jails/test-compile]$ sudo freebsd-update fetch
Looking up update.FreeBSD.org mirrors... 4 mirrors found.
Fetching metadata signature for 7.4-RELEASE from update5.FreeBSD.org... done.
Fetching metadata index... done.
Inspecting system... done.
Preparing to download files... done.

No updates needed to update system to 7.4-RELEASE-p6.
```

Hmmm...


----------



## jef (Apr 19, 2012)

At least this issue resolved by a version of /usr/include/sys/param.h for both the jail host and the jail with 


```
__FreeBSD_version 704000
```
No idea as to what went wrong in the freebsd-update process, but the good news is that the box is planned for a re-build on 9.0


----------

