Actions
Bug #2982
closedFailed compile due to fetch.h and MAXHOSTNAMELEN
Description
I'm trying to build pkgin for DragonFly. The compile is failing due to fetch.h and MAXHOSTNAMELEN (http://github.com/NetBSDfr/pkgin/issues/74):
$ make gcc -O -pipe -std=gnu99 -c main.c In file included from pkgin.h:45:0, from main.c:33: /usr/include/fetch.h:44:14: error: 'MAXHOSTNAMELEN' undeclared here (not in a function) char host[MAXHOSTNAMELEN+1]; ^ /usr/include/fetch.h:59:14: error: 'PATH_MAX' undeclared here (not in a function) char name[PATH_MAX]; ^
Looking at /usr/include/fetch.h, it does not include a header which defines MAXHOSTNAMELEN; and it does not define MAXHOSTNAMELEN itself:
$ cat fetch.h ... #ifndef _FETCH_H_INCLUDED #define _FETCH_H_INCLUDED #define _LIBFETCH_VER "libfetch/2.0" #define URL_SCHEMELEN 16 #define URL_USERLEN 256 #define URL_PWDLEN 256 struct url { char scheme[URL_SCHEMELEN+1]; char user[URL_USERLEN+1]; char pwd[URL_PWDLEN+1]; char host[MAXHOSTNAMELEN+1]; int port; char *doc; off_t offset; size_t length; time_t ims_time; }; ...
MAXHOSTNAMELEN is defined to 256 is a couple of other header files, but those headers are not picked up in fetch.h.
Looking at gethostname(3) (http://man.openbsd.org/gethostname.3), I can't tell if fetch.h is supposed to include <unistd.h> or <sys/param.h>. I'm guessing <unistd.h> would be a good choice.
Actions