git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git-compat-util.h:798:13: error: conflicting types for ‘inet_ntop’

From
JWJeffrey Walton <noloader@gmail.com>
Date
Feb 1, 2020, 12:12 UTC
Message-ID
<CAH8yC8mh0gysNz3Dbrph0f8KZ8DEWaH-6rWg6fSOD-_aGh3=3A@mail.gmail.com>
In-Reply-To
<CAH8yC8m3JFvEcfFF3z1rrRnEPK-adHGObmkOhNZiph7QJKUWqA@mail.gmail.com>
On Sat, Feb 1, 2020 at 6:39 AM Jeffrey Walton <noloader@gmail.com> wrote:
Show 31 quoted lines
>
> I'm building the 2.25 release tarball on Solaris 11.3 i86pc. I'm
> catching an error:
>
> $ gmake
>     CC fuzz-commit-graph.o
> In file included from commit-graph.h:4:0,
>                  from fuzz-commit-graph.c:1:
> git-compat-util.h:798:13: error: conflicting types for ‘inet_ntop’
>  const char *inet_ntop(int af, const void *src, char *dst, size_t size);
>              ^
> In file included from git-compat-util.h:226:0,
>                  from commit-graph.h:4,
>                  from fuzz-commit-graph.c:1:
> /usr/include/arpa/inet.h:43:20: note: previous declaration of
> ‘inet_ntop’ was here
>  extern const char *inet_ntop(int, const void *_RESTRICT_KYWD,
>                     ^
> gmake: *** [fuzz-commit-graph.o] Error 1
>
> And:
>
> $ cat -n /usr/include/arpa/inet.h
> ...
>     41  #if !defined(_XPG4_2) || defined(_XPG6) || defined(__EXTENSIONS__)
>     42  extern int inet_pton(int, const char *_RESTRICT_KYWD, void
> *_RESTRICT_KYWD);
>     43  extern const char *inet_ntop(int, const void *_RESTRICT_KYWD,
>     44                          char *_RESTRICT_KYWD, socklen_t);
>     45  #endif /* !defined(_XPG4_2) || defined(_XPG6) ||
> defined(__EXTENSIONS__) */
According to Sun's man pages:
inet(3SOCKET)              Sockets Library Functions             inet(3SOCKET)
NAME
       inet,  inet6, inet_ntop, inet_pton, inet_aton, inet_addr, inet_network,
       inet_makeaddr, inet_lnaof, inet_netof,  inet_ntoa  -  Internet  address
       manipulation
SYNOPSIS
       cc [ flag... ] file... -lsocket  -lnsl  [ library... ]
       #include <sys/socket.h>
       #include <netinet/in.h>
       #include <arpa/inet.h>
Maybe the include should be <arpa/inet.h> on Sun systems?
I was able to hack around it with the following after configure:
    # Solaris 11.3 work-around. The OS has inet_ntop and inet_pton
    for file in $(find "$PWD" -name 'Makefile')
    do
        sed '/ifdef NO_INET_NTOP/,+3 d' "$file" > "$file.fixed"
        mv "$file.fixed" "$file"
        sed '/ifdef NO_INET_PTON/,+3 d' "$file" > "$file.fixed"
        mv "$file.fixed" "$file"
    done
Jeff
Previous: Jeffrey WaltonNext: Jeffrey Walton
Message 2 of 8 in “git-compat-util.h:798:13: error: conflicting types for ‘inet_ntop’”
  1. Jeffrey WaltonFeb 1, 2020
  2. Jeffrey WaltonFeb 1, 2020
  3. Jeffrey WaltonFeb 1, 2020
  4. Jeff KingFeb 3, 2020
  5. Jeffrey WaltonFeb 3, 2020
  6. Jeff KingFeb 3, 2020
  7. Jeffrey WaltonFeb 3, 2020
  8. Jeff KingFeb 3, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.