Subject: Re: tnftp Build Failure
To: None <tech-pkg@NetBSD.org>
From: Bruce J.A. Nourish <bjan@bjan.freeshell.org>
List: tech-pkg
Date: 02/02/2004 22:59:38
On Mon, Feb 02, 2004 at 04:44:07PM -0800, Randy Beaudreault wrote:
> ftp.c: In function `empty':
> ftp.c:557: warning: variable `pfd' is implicitly extern
> ftp.c:560: invalid use of undefined type `struct pollfd'
> ftp.c:561: invalid use of undefined type `struct pollfd'
> ftp.c:561: `POLLIN' undeclared (first use in this function)
> ftp.c:561: (Each undeclared identifier is reported only once
> ftp.c:561: for each function it appears in.)
> ftp.c:565: invalid use of undefined type `struct pollfd'
> ftp.c:566: invalid use of undefined type `struct pollfd'
> ftp.c:575: invalid use of undefined type `struct pollfd'
> ftp.c:577: invalid use of undefined type `struct pollfd'

I've never used OS X, but it looks like the problem is a missing
include file, namely poll.h. The simple solution is to add

#include <poll.h>

to all the other #include files in ftp.c. A more general solution will
require involvement from the maintainer.

As a rule of thumb, whenever you encounter errors that look like this,
try grepping the system headers for the offending type, in this case,
"struct pollfd". Here's what I get:

$ grep 'struct pollfd' /usr/include/*.h 
/usr/include/poll.h:struct pollfd {
/usr/include/poll.h:int	poll __P((struct pollfd *, nfds_t, int));

(You'll need to replace /usr/include with whatever funky directory OS X
uses for headers.)

With this technique, you can fix a suprisingly large number of compile
problems while knowing a suprisingly small amount of C :-)
-- 
Bruce J.A. Nourish <bjan@bjan.freeshell.org> http://bjan.freeshell.org
SDF Public Access UNIX System - http://sdf.lonestar.org