Project

General

Profile

Actions

Bug #2982

closed

Failed compile due to fetch.h and MAXHOSTNAMELEN

Added by noloader almost 8 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
-
Target version:
Start date:
02/19/2017
Due date:
% Done:

0%

Estimated time:

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 #1

Updated by noloader almost 8 years ago

noloader wrote:

...
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.

<unistd.h> did not help. <sys/param.h> was needed to clear the issue.

Actions #2

Updated by tuxillo over 2 years ago

  • Description updated (diff)
Actions #3

Updated by tuxillo over 2 years ago

  • Status changed from New to Closed
  • Assignee set to tuxillo

Just include sys/param.h before including fetch.h, as you yourself mentioned :)
Closing this one!

Actions

Also available in: Atom PDF