tonywut / git-core

Automatically exported from code.google.com/p/git-core
Other
0 stars 0 forks source link

tests for inet_{ntop,pton} are incorrect for modern Solaris #7

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

Attempt to build git 1.7.9.4 on Solaris 10

What is the expected output? What do you see instead?

What I see during configure is this:

checking for socket in -lc... no
checking for inet_ntop... no
checking for inet_ntop in -lresolv... no
checking for inet_pton... no
checking for inet_pton in -lresolv... no
checking for hstrerror... no
checking for hstrerror in -lresolv... yes

and then after gmake, I eventually get this:

    CC builtin/apply.o
"./git-compat-util.h", line 421: identifier redeclared: inet_ntop
    current : function(int, pointer to const void, pointer to char, unsigned
lon
g) returning pointer to const char
    previous: function(int, pointer to const void, pointer to char, unsigned
int
) returning pointer to const char : "/usr/include/arpa/inet.h", line 68
"git-compat-util.h", line 421: identifier redeclared: inet_ntop
    current : function(int, pointer to const void, pointer to char, unsigned
lon
g) returning pointer to const char
    previous: function(int, pointer to const void, pointer to char, unsigned
int
) returning pointer to const char : "/usr/include/arpa/inet.h", line 68
"git-compat-util.h", line 421: identifier redeclared: inet_ntop
    current : function(int, pointer to const void, pointer to char, unsigned
lon
g) returning pointer to const char
    previous: function(int, pointer to const void, pointer to char, unsigned
int
) returning pointer to const char : "/usr/include/arpa/inet.h", line 68
cc: acomp failed for builtin/annotate.c

What version of the product are you using? On what operating system?

git 1.7.9.4 on x86_64-sun-solaris2.10.  Building with the no-cost Oracle Studio
12.2 compiler toolchain

Please provide any additional information below.

Solaris does need "-lsocket" to get socket() and related functions, as the
comment in configure.ac indicates.  However, you almost never link just
-lsocket.  Instead, you link "-lsocket -lnsl", which contains a number of
related functions, including the inet_ntop, inet_pton, etc.  The man pages for
socket(), inet_ntop(), inet_pton(), and others all list "-lsocket -lnsl" as the
libraries to link.

The comments in configure.ac about inet_ntop & inet_pton being in libresolv on
Solaris appear to be for versions that 10+ years out of date.

With the attached patch, configure instead outputs:

checking for socket in -lc... no
checking for socket in -lsocket... yes
checking for inet_ntop in -lnsl... yes
checking for inet_ntop... yes
checking for inet_pton... yes
checking for hstrerror... no
checking for hstrerror in -lresolv... yes

There are a couple other build issues, but I'll report those separately.

Original issue reported on code.google.com by Timothy....@gmail.com on 22 Mar 2012 at 10:58

Attachments:

GoogleCodeExporter commented 9 years ago
Hi Timothy,

Nobody relevant actually looks at this bugtracker, as far as I
know.  It just got set up automatically as a side effect of putting
a git mirror and tarballs here.

Please report this and any other build bugs to the git list at
git@vger.kernel.org.  No subscription needed, since the convention
is to always reply-to-all there.

Thanks,
Jonathan

Original comment by jrnieder on 21 May 2012 at 3:05