Skip to content

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

@GoogleCodeExporter

Description

@GoogleCodeExporter
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:

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions