[PHP-DEV] Bug #420: Compile failure on FreeBSD (fudged headers) From: brian <email protected>
Date: 05/30/98

From: brian <email protected>
Operating system: FreeBSD 2.2.6
PHP version: 3.0 Release Candidate 5
PHP Bug Type: Compile Failure
Bug description:
I just installed FreeBSD 2.2.6 - someting I pretty new to (been
using mostly Linux before). When compiling PHP, I got a failure
on the file mysql.c due to what appears to be a fudged configuration
or pre-processor directive.
My configuration:

./configure --with-apache=/usr/local/httpd --with-gd=no
--with-pgsql --enable-debug=no --enable-track-vars=yes

(Note that I'm _not_ configuring mysql)

For some reason the HAVE_SYS_TYPES_H macro is not defined - even
though I definitely have sys/types.h on my system. The simple fix was to
change

#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include <netdb.h>
#include <netinet/in.h>
#endif

to

#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#include <sys/types.h>
#include <netdb.h>
#include <netinet/in.h>
#endif

I'm not sure what the "real" fix is. I could find no other sources that relied
on HAVE_SYS_TYPES_H, so I wonder if it's even necessary.

Here's the make error:
gcc -O2 -fpic -I. -I. -I/usr/local/httpd/src -I/usr/local/pgsql/include -c functions/mysql.c
In file included from functions/mysql.c:58:
/usr/include/netinet/in.h:212: parse error before `u_long'
/usr/include/netinet/in.h:212: warning: no semicolon at end of struct or union
/usr/include/netinet/in.h:263: parse error before `u_char'
/usr/include/netinet/in.h:263: warning: no semicolon at end of struct or union
/usr/include/netinet/in.h:264: warning: data definition has no type or storage class
/usr/include/netinet/in.h:265: parse error before `sin_port'
/usr/include/netinet/in.h:265: warning: data definition has no type or storage class
/usr/include/netinet/in.h:268: parse error before `}'
/usr/include/netinet/in.h:278: field `ip_dst' has incomplete type
/usr/include/netinet/in.h:325: field `imr_multiaddr' has incomplete type
/usr/include/netinet/in.h:326: field `imr_interface' has incomplete type
In file included from /usr/local/httpd/src/conf.h:580,
                 from /usr/local/httpd/src/httpd.h:59,
                 from php.h:182,
                 from functions/mysql.c:61:
/usr/include/arpa/inet.h:71: warning: parameter has incomplete type
/usr/include/arpa/inet.h:74: warning: parameter has incomplete type
/usr/include/arpa/inet.h:78: warning: parameter has incomplete type
In file included from php.h:182,
                 from functions/mysql.c:61:
/usr/local/httpd/src/httpd.h:571: field `local_addr' has incomplete type
/usr/local/httpd/src/httpd.h:572: field `remote_addr' has incomplete type
/usr/local/httpd/src/httpd.h:603: field `host_addr' has incomplete type
/usr/local/httpd/src/httpd.h:659: field `local_addr' has incomplete type
/usr/include/netinet/in.h:266: storage size of `sin_addr' isn't known
*** Error code 1

Stop.

Although at first glance it may appear related to apache - it's not. It's
simply a missing header file.

-Brian Schaffner-