URL:
  <http://gna.org/bugs/?20476>

                 Summary: netdb.h conflict
                 Project: Freeciv
            Submitted by: hugo
            Submitted on: Sun 03 Feb 2013 01:04:36 PM GMT
                Category: general
                Severity: 2 - Minor
                Priority: 5 - Normal
                  Status: None
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
                 Release: 
         Discussion Lock: Any
        Operating System: GNU/Linux
         Planned Release: 

    _______________________________________________________

Details:

After building against SVN @22265 on Ubuntu Ubuntu 10.04.4 LTS ("Lucid"),
attempting to start the server immediately bailed out with the error "Server:
bad address: <(none):5556>."

After some digging, this turned out to be a conflict between two different
netdb.h files - /usr/include/netdb.h comes from libc6 (Ubuntu package libc-dev
version 2.11.1-0ubuntu7.11 from the eglibc project), and includes a
definition:

# define AI_NUMERICSERV 0x0400  /* Don't use name resolution.  */


I also have /usr/include/bind/netdb.h, which comes from libbind (Ubuntu
package libbind4, version 6.0-1, from the libbind project). This is the
library that actually provides getaddrinfo(3), and does *not* define or
support NUMERICSERV; attempting to pass ai_flags with 0x400 set always returns
EAI_BADFLAGS.

I don't know whether the error here is mine, Ubuntu's, Freeciv's, or that of
one of the two source projects.

1) It was made harder to track down the problem because net_lookup_getaddrinfo
in utility/netintf.c does not report or return the actual error. It would be
useful if it could be modified to log the error, eg with:

  ... else {
    printf("getaddrinfo: error '%s' (%d)\n", gai_strerror(err), err); 
  }


2) I do not know if the configure probes could be enhanced to check for both
<netdb.h> and <bind/netdb.h> and make an intelligent choice between them. For
now I've just hacked my netintf.c, which has got me a little further; I've not
yet checked if I also need to change the other uses of netdb.h.

3) An alternative would be to support a build hint HAVE_AI_NUMERICSERV, but I
suspect it will generally be hard for someone building freeciv to discover
they should override this to false.

Hope this helps,

Hugo




    _______________________________________________________

Reply to this item at:

  <http://gna.org/bugs/?20476>

_______________________________________________
  Message sent via/by Gna!
  http://gna.org/


_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to