bugFreeciv - Bugs: bug #20476, netdb.h conflict

 
 
Show feedback again

bug #20476: netdb.h conflict

Submitted by:  Hugo van der Sanden <hugo>
Submitted on:  Sun 03 Feb 2013 01:04:36 PM UTC  
 
Category: generalSeverity: 2 - Minor
Priority: 5 - NormalStatus: None
Assigned to: Marko Lindqvist <cazfi>Open/Closed: Open
Release: Operating System: GNU/Linux
Planned Release: 

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Sun 10 Feb 2013 11:36:50 PM UTC, comment #4:

So the question is if we should drop that -lbind in general, or do we need some magic to sometimes include it and sometimes not (I have no good ideas what what we should be testing to make the decision)

> I suspect that the libbind4 package is my main problem, and I
> plan to remove it (but I'll wait in case there's more you'd like
> me to test);


In case this takes some time (I have higher priorities elsewhere at the moment), it should be sufficient for you to list important bits of your system here (Lucid, libbind4-package installed, anything else?) so I can setup it to virtual machine for testing later.

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Sun 10 Feb 2013 02:25:17 AM UTC, comment #3:

> Can you confirm if I got this right.


Yes, header that is included is /usr/include/netdb.h which does define AI_NUMERICSERV.

> Meanwhile you can test if manually setting
> CPPFLAGS="-I/usr/include/bind" for configure produces working
> build.


It failed, this time on functions such as inet_ntoa, I think due to conflicts between arpa/inet.h and bind/arpa/inet.h - the latter redefines inet_ntoa to __inet_ntoa, but then __inet_ntoa can't be found at link time.

I tried instead going the other way, to try to convince configure that I didn't need libbind at all:

With that change, -lbind is no longer included in LIBS or SERVER_LIBS; for some reason it is still included in GUI_sdl_LIBS, and I wasn't able to find what introduces it there. But I can build successfully with --enable-client=gtk2 (previously gtk2,sdl), start a server and a client and have them talk to each other.

I suspect that the libbind4 package is my main problem, and I plan to remove it (but I'll wait in case there's more you'd like me to test); I believe that on this OS libc contains everything I'm likely to need from libbind, and quite likely in more modern and featureful fashion.

Here's my full configure invocation now:

./configure --prefix=/opt/freeciv --enable-fcdb=mysql --enable-client=gtk2 --enable-svnrev --enable-aimodules=yes --disable-nls --enable-debug=some --with-readline --with-x --enable-shared --disable-ipv6

Hugo

Hugo van der Sanden <hugo>
Thu 07 Feb 2013 10:43:20 PM UTC, comment #2:

First attempt for a fix. I could only test that it didn't break it for me. Can you test if it fixes it for you?

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Thu 07 Feb 2013 10:29:40 PM UTC, comment #1:

Can you confirm if I got this right.

Header that gets included does define AI_NUMERICSERV, so freeciv FC_AI_NUMERICSERV gets to set value 0x0400 despite fix to but the library used runtime does not support AI_NUMERICSERV.

The bug is in somewhat grey area what comes to whose fault it is. For freeciv, I checked configure, and it explicitly links against libbind, and when doing that it should take care that it uses also libbind headers. There's no way to make this idiot-proof for all possible configurations, but I think I could improve your specific case (which is one case we know for sure to exist).
Meanwhile you can test if manually setting CPPFLAGS="-I/usr/include/bind" for configure produces working build.

---

Setting FC_AI_NUMERICSERV depending on what's available was introduced in bug #18871.

Marko Lindqvist <cazfi>
Project AdministratorIn charge of this item.
Sun 03 Feb 2013 01:04:36 PM UTC, original submission:

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:

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:

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

Hugo van der Sanden <hugo>

 

(Note: upload size limit is set to 1024 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by cazfi (Posted a comment)
  • -unavailable- added by hugo (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 25 Mar 2013 09:00:45 AM UTCcazfiStatusReady For Test=>None
    Thu 07 Feb 2013 10:43:20 PM UTCcazfiStatusIn Progress=>Ready For Test
    Thu 07 Feb 2013 10:29:40 PM UTCcazfiStatusNone=>In Progress
      Assigned toNone=>cazfi
    Show feedback again

    Back to the top


    Powered by Savane 3.1-cleanup