threads / discuss / 45535

git-compat-util.h:735:13: error: conflicting types for 'inet_ntop'

Subject: git-compat-util.h:735:13: error: conflicting types for 'inet_ntop'

## tl;dr

6 messages between Mar 29, 2017 and Mar 30, 2017.

replies: 5people: 2as markdown or json

Jeffrey Walton· Mar 29, 2017, 09:19 UTC · lore
Some more 2.12.2 testing on Solaris 11.3 x86_64:
$ make V=1
gcc -o credential-store.o -c -MF ./.depend/credential-store.o.d -MQ
credential-store.o -MMD -MP -I/usr/local/include -m64 -m64 -I.
-D__EXTENSIONS__ -D__sun__ -DUSE_LIBPCRE -I/usr/local/include
-DHAVE_ALLOCA_H -I/usr/local/include -DUSE_CURL_FOR_IMAP_SEND
-I/usr/local/include -I/usr/local/include -DNO_D_TYPE_IN_DIRENT
-DNO_INET_NTOP -DNO_INET_PTON  -DHAVE_PATHS_H -DHAVE_LIBCHARSET_H
-DHAVE_STRINGS_H -DHAVE_DEV_TTY -DHAVE_CLOCK_GETTIME
-DHAVE_CLOCK_MONOTONIC -DHAVE_GETDELIM -DSHA1_HEADER='<openssl/sha.h>'
 -Icompat/regex -DSHELL_PATH='"/bin/bash"' -DPAGER_ENV='"LESS=FRX
LV=-c"'  credential-store.c
In file included from cache.h:4:0,
                 from credential-store.c:1:
git-compat-util.h:735: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:209:0,
                 from cache.h:4,
                 from credential-store.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,
                    ^
make: *** [credential-store.o] Error 1
Looking at git-compat-util.h around line 730:

#ifdef NO_INET_PTON int inet_pton(int af, const char *src, void *dst); #endif

#ifdef NO_INET_NTOP const char *inet_ntop(int af, const void *src, char *dst, size_t size); #endif

When I grep config.log, I don't see a test that results in NO_INET_*:
    $ grep NO_INET config.log
    $
According to Solaris' man page for inet_ntop:
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>
       const char *inet_ntop(int af, const void *addr, char *cp,
            socklen_t size);
       int inet_pton(int af, const char *cp, void *addr);
       int inet_aton(const char *cp, struct in_addr *addr);
       in_addr_t inet_addr(const char *cp);
       in_addr_t inet_network(const char *cp);
       ...
Jeff
Junio C Hamano· Mar 29, 2017, 17:11 UTC · re: Jeffrey Walton · lore

Re: git-compat-util.h:735:13: error: conflicting types for 'inet_ntop'

Jeffrey Walton <noloader@gmail.com> writes:
Show 9 quoted lines
> Some more 2.12.2 testing on Solaris 11.3 x86_64:
>
> $ make V=1
> gcc -o credential-store.o -c -MF ./.depend/credential-store.o.d -MQ
> credential-store.o -MMD -MP -I/usr/local/include -m64 -m64 -I.
> -D__EXTENSIONS__ -D__sun__ -DUSE_LIBPCRE -I/usr/local/include
> -DHAVE_ALLOCA_H -I/usr/local/include -DUSE_CURL_FOR_IMAP_SEND
> -I/usr/local/include -I/usr/local/include -DNO_D_TYPE_IN_DIRENT
> -DNO_INET_NTOP -DNO_INET_PTON  -DHAVE_PATHS_H -DHAVE_LIBCHARSET_H

Looking at config.mak.uname, nothing in SunOS section seems to set NO_INET_NTOP or NO_INET_PTON. Why is your build setting them?

Jeffrey Walton· Mar 30, 2017, 20:06 UTC · re: Junio C Hamano · lore

Re: git-compat-util.h:735:13: error: conflicting types for 'inet_ntop'

On Wed, Mar 29, 2017 at 1:11 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 14 quoted lines
> Jeffrey Walton <noloader@gmail.com> writes:
>
>> Some more 2.12.2 testing on Solaris 11.3 x86_64:
>>
>> $ make V=1
>> gcc -o credential-store.o -c -MF ./.depend/credential-store.o.d -MQ
>> credential-store.o -MMD -MP -I/usr/local/include -m64 -m64 -I.
>> -D__EXTENSIONS__ -D__sun__ -DUSE_LIBPCRE -I/usr/local/include
>> -DHAVE_ALLOCA_H -I/usr/local/include -DUSE_CURL_FOR_IMAP_SEND
>> -I/usr/local/include -I/usr/local/include -DNO_D_TYPE_IN_DIRENT
>> -DNO_INET_NTOP -DNO_INET_PTON  -DHAVE_PATHS_H -DHAVE_LIBCHARSET_H
>
> Looking at config.mak.uname, nothing in SunOS section seems to set
> NO_INET_NTOP or NO_INET_PTON.  Why is your build setting them?

Thanks. It looks like the following is the culprit (from config.log). Am I supposed to specify the socket library, or is Autotools supposed to specify it?

To date, I've been specify the libraries I request, like IDN2, PCRE, cURL and OpenSSL.

I don't recall specifying a socket library in the past, so I'm not sure what is supposed to happen here.

Thanks in advance.
**********

It was created by git configure 2.12.2, which was generated by GNU Autoconf 2.68. Invocation command line was

  $ ./configure --enable-pthreads --with-lib=/usr/local/lib64
--with-openssl=/usr/local --with-curl=/usr/local
--with-libpcre=/usr/local --with-zlib=/usr/local
--with-perl=/usr/local/bin/perl --prefix=/usr/local
...
configure:5552: checking for inet_ntop
configure:5552: gcc -o conftest -m64 -I/usr/local/include -m64
-Wl,-rpath,/usr/local/lib64 -L/usr/local/lib64 conftest.c -lidn2
-lcurl -lssl -lcrypto -lz -ldl -lpthread -lsocket >&5
Undefined            first referenced
 symbol                  in file
inet_ntop                           /var/tmp//cc2WaWwg.o  (symbol
belongs to implicit dependency /lib/amd64/libnsl.so.1)
ld: fatal: symbol referencing errors
collect2: error: ld returned 1 exit status
configure:5552: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "git"
| #define PACKAGE_TARNAME "git"
| #define PACKAGE_VERSION "2.12.2"
| #define PACKAGE_STRING "git 2.12.2"
| #define PACKAGE_BUGREPORT "git@vger.kernel.org"
| #define PACKAGE_URL ""
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_ALLOCA_H 1
| #define HAVE_ALLOCA 1
| /* end confdefs.h.  */
| /* Define inet_ntop to an innocuous variant, in case <limits.h>
declares inet_ntop.
|    For example, HP-UX 11i <limits.h> declares gettimeofday.  */
| #define inet_ntop innocuous_inet_ntop
|
| /* System header to define __stub macros and hopefully few prototypes,
|     which can conflict with char inet_ntop (); below.
|     Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|     <limits.h> exists even on freestanding compilers.  */
|
| #ifdef __STDC__
| # include <limits.h>
| #else
| # include <assert.h>
| #endif
|
| #undef inet_ntop
|
| /* Override any GCC internal prototype to avoid an error.
|    Use char because int might match the return type of a GCC
|    builtin and then its argument prototype would still apply.  */
| #ifdef __cplusplus
| extern "C"
| #endif
| char inet_ntop ();
| /* The GNU C library defines this for functions which it implements
|     to always fail with ENOSYS.  Some functions are actually named
|     something starting with __ and the normal name is an alias.  */
| #if defined __stub_inet_ntop || defined __stub___inet_ntop
| choke me
| #endif
|
| int
| main ()
| {
| return inet_ntop ();
|   ;
|   return 0;
| }
configure:5552: result: no
configure:5556: checking for inet_ntop in -lresolv
configure:5581: gcc -o conftest -m64 -I/usr/local/include -m64
-Wl,-rpath,/usr/local/lib64 -L/usr/local/lib64 conftest.c -lresolv
-lidn2 -lcurl -lssl -lcrypto -lz -ldl -lpthread -lsocket >&5
Undefined            first referenced
 symbol                  in file
inet_ntop                           /var/tmp//ccZYayyg.o  (symbol
belongs to implicit dependency /lib/amd64/libnsl.so.1)
ld: fatal: symbol referencing errors
collect2: error: ld returned 1 exit status
configure:5581: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "git"
| #define PACKAGE_TARNAME "git"
| #define PACKAGE_VERSION "2.12.2"
| #define PACKAGE_STRING "git 2.12.2"
| #define PACKAGE_BUGREPORT "git@vger.kernel.org"
| #define PACKAGE_URL ""
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_ALLOCA_H 1
| #define HAVE_ALLOCA 1
| /* end confdefs.h.  */
|
| /* Override any GCC internal prototype to avoid an error.
|    Use char because int might match the return type of a GCC
|    builtin and then its argument prototype would still apply.  */
| #ifdef __cplusplus
| extern "C"
| #endif
| char inet_ntop ();
| int
| main ()
| {
| return inet_ntop ();
|   ;
|   return 0;
| }
configure:5590: result: no
configure:5607: checking for inet_pton
configure:5607: gcc -o conftest -m64 -I/usr/local/include -m64
-Wl,-rpath,/usr/local/lib64 -L/usr/local/lib64 conftest.c -lidn2
-lcurl -lssl -lcrypto -lz -ldl -lpthread -lsocket >&5
Undefined            first referenced
 symbol                  in file
inet_pton                           /var/tmp//ccW0aaAg.o  (symbol
belongs to implicit dependency /lib/amd64/libnsl.so.1)
ld: fatal: symbol referencing errors
collect2: error: ld returned 1 exit status
configure:5607: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "git"
| #define PACKAGE_TARNAME "git"
| #define PACKAGE_VERSION "2.12.2"
| #define PACKAGE_STRING "git 2.12.2"
| #define PACKAGE_BUGREPORT "git@vger.kernel.org"
| #define PACKAGE_URL ""
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_ALLOCA_H 1
| #define HAVE_ALLOCA 1
| /* end confdefs.h.  */
| /* Define inet_pton to an innocuous variant, in case <limits.h>
declares inet_pton.
|    For example, HP-UX 11i <limits.h> declares gettimeofday.  */
| #define inet_pton innocuous_inet_pton
|
| /* System header to define __stub macros and hopefully few prototypes,
|     which can conflict with char inet_pton (); below.
|     Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|     <limits.h> exists even on freestanding compilers.  */
|
| #ifdef __STDC__
| # include <limits.h>
| #else
| # include <assert.h>
| #endif
|
| #undef inet_pton
|
| /* Override any GCC internal prototype to avoid an error.
|    Use char because int might match the return type of a GCC
|    builtin and then its argument prototype would still apply.  */
| #ifdef __cplusplus
| extern "C"
| #endif
| char inet_pton ();
| /* The GNU C library defines this for functions which it implements
|     to always fail with ENOSYS.  Some functions are actually named
|     something starting with __ and the normal name is an alias.  */
| #if defined __stub_inet_pton || defined __stub___inet_pton
| choke me
| #endif
|
| int
| main ()
| {
| return inet_pton ();
|   ;
|   return 0;
| }
configure:5607: result: no
configure:5611: checking for inet_pton in -lresolv
configure:5636: gcc -o conftest -m64 -I/usr/local/include -m64
-Wl,-rpath,/usr/local/lib64 -L/usr/local/lib64 conftest.c -lresolv
-lidn2 -lcurl -lssl -lcrypto -lz -ldl -lpthread -lsocket >&5
Undefined            first referenced
 symbol                  in file
inet_pton                           /var/tmp//ccG2aOBg.o  (symbol
belongs to implicit dependency /lib/amd64/libnsl.so.1)
ld: fatal: symbol referencing errors
collect2: error: ld returned 1 exit status
configure:5636: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "git"
| #define PACKAGE_TARNAME "git"
| #define PACKAGE_VERSION "2.12.2"
| #define PACKAGE_STRING "git 2.12.2"
| #define PACKAGE_BUGREPORT "git@vger.kernel.org"
| #define PACKAGE_URL ""
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_STDINT_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_ALLOCA_H 1
| #define HAVE_ALLOCA 1
| /* end confdefs.h.  */
|
| /* Override any GCC internal prototype to avoid an error.
|    Use char because int might match the return type of a GCC
|    builtin and then its argument prototype would still apply.  */
| #ifdef __cplusplus
| extern "C"
| #endif
| char inet_pton ();
| int
| main ()
| {
| return inet_pton ();
|   ;
|   return 0;
| }
configure:5645: result: no
Jeffrey Walton· Mar 30, 2017, 20:28 UTC · re: Jeffrey Walton · lore

Re: git-compat-util.h:735:13: error: conflicting types for 'inet_ntop'

On Thu, Mar 30, 2017 at 4:06 PM, Jeffrey Walton <noloader@gmail.com> wrote:
Show 25 quoted lines
> On Wed, Mar 29, 2017 at 1:11 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> Jeffrey Walton <noloader@gmail.com> writes:
>>
>>> Some more 2.12.2 testing on Solaris 11.3 x86_64:
>>>
>>> $ make V=1
>>> gcc -o credential-store.o -c -MF ./.depend/credential-store.o.d -MQ
>>> credential-store.o -MMD -MP -I/usr/local/include -m64 -m64 -I.
>>> -D__EXTENSIONS__ -D__sun__ -DUSE_LIBPCRE -I/usr/local/include
>>> -DHAVE_ALLOCA_H -I/usr/local/include -DUSE_CURL_FOR_IMAP_SEND
>>> -I/usr/local/include -I/usr/local/include -DNO_D_TYPE_IN_DIRENT
>>> -DNO_INET_NTOP -DNO_INET_PTON  -DHAVE_PATHS_H -DHAVE_LIBCHARSET_H
>>
>> Looking at config.mak.uname, nothing in SunOS section seems to set
>> NO_INET_NTOP or NO_INET_PTON.  Why is your build setting them?
>
> Thanks. It looks like the following is the culprit (from config.log).
> Am I supposed to specify the socket library, or is Autotools supposed
> to specify it?
>
> To date, I've been specify the libraries I request, like IDN2, PCRE,
> cURL and OpenSSL.
>
> I don't recall specifying a socket library in the past, so I'm not
> sure what is supposed to happen here.
It looks like adding -lnsl and -lsocket clears the issue.

Maybe Git on Solaris should test with both of the libraries, and not just -lsockets.

Jeff
Junio C Hamano· Mar 30, 2017, 20:30 UTC · re: Jeffrey Walton · lore

Re: git-compat-util.h:735:13: error: conflicting types for 'inet_ntop'

Jeffrey Walton <noloader@gmail.com> writes:
Show 25 quoted lines
> On Wed, Mar 29, 2017 at 1:11 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> Jeffrey Walton <noloader@gmail.com> writes:
>>
>>> Some more 2.12.2 testing on Solaris 11.3 x86_64:
>>>
>>> $ make V=1
>>> gcc -o credential-store.o -c -MF ./.depend/credential-store.o.d -MQ
>>> credential-store.o -MMD -MP -I/usr/local/include -m64 -m64 -I.
>>> -D__EXTENSIONS__ -D__sun__ -DUSE_LIBPCRE -I/usr/local/include
>>> -DHAVE_ALLOCA_H -I/usr/local/include -DUSE_CURL_FOR_IMAP_SEND
>>> -I/usr/local/include -I/usr/local/include -DNO_D_TYPE_IN_DIRENT
>>> -DNO_INET_NTOP -DNO_INET_PTON  -DHAVE_PATHS_H -DHAVE_LIBCHARSET_H
>>
>> Looking at config.mak.uname, nothing in SunOS section seems to set
>> NO_INET_NTOP or NO_INET_PTON.  Why is your build setting them?
>
> Thanks. It looks like the following is the culprit (from config.log).
> Am I supposed to specify the socket library, or is Autotools supposed
> to specify it?
>
> To date, I've been specify the libraries I request, like IDN2, PCRE,
> cURL and OpenSSL.
>
> I don't recall specifying a socket library in the past, so I'm not
> sure what is supposed to happen here.

I'd be hated for saying this by many people, but my suspicion is that those who build Git are often better off ignoring the autoconf part of the build procedure, as it is my impression that ./configure we ship is not as well maintained as the Makefile.

Looking through the first part of Makefile, I notice that INET_NTOP and INET_PTON bits are not described; we probably should add these two close to where we say "Define NO_IPV6 if you lack IPv6 support".

Jeffrey Walton· Mar 30, 2017, 20:48 UTC · re: Junio C Hamano · lore

Re: git-compat-util.h:735:13: error: conflicting types for 'inet_ntop'

On Thu, Mar 30, 2017 at 4:30 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 36 quoted lines
> Jeffrey Walton <noloader@gmail.com> writes:
>
>> On Wed, Mar 29, 2017 at 1:11 PM, Junio C Hamano <gitster@pobox.com> wrote:
>>> Jeffrey Walton <noloader@gmail.com> writes:
>>>
>>>> Some more 2.12.2 testing on Solaris 11.3 x86_64:
>>>>
>>>> $ make V=1
>>>> gcc -o credential-store.o -c -MF ./.depend/credential-store.o.d -MQ
>>>> credential-store.o -MMD -MP -I/usr/local/include -m64 -m64 -I.
>>>> -D__EXTENSIONS__ -D__sun__ -DUSE_LIBPCRE -I/usr/local/include
>>>> -DHAVE_ALLOCA_H -I/usr/local/include -DUSE_CURL_FOR_IMAP_SEND
>>>> -I/usr/local/include -I/usr/local/include -DNO_D_TYPE_IN_DIRENT
>>>> -DNO_INET_NTOP -DNO_INET_PTON  -DHAVE_PATHS_H -DHAVE_LIBCHARSET_H
>>>
>>> Looking at config.mak.uname, nothing in SunOS section seems to set
>>> NO_INET_NTOP or NO_INET_PTON.  Why is your build setting them?
>>
>> Thanks. It looks like the following is the culprit (from config.log).
>> Am I supposed to specify the socket library, or is Autotools supposed
>> to specify it?
>>
>> To date, I've been specify the libraries I request, like IDN2, PCRE,
>> cURL and OpenSSL.
>>
>> I don't recall specifying a socket library in the past, so I'm not
>> sure what is supposed to happen here.
>
> I'd be hated for saying this by many people, but my suspicion is
> that those who build Git are often better off ignoring the autoconf
> part of the build procedure, as it is my impression that ./configure
> we ship is not as well maintained as the Makefile.
>
> Looking through the first part of Makefile, I notice that INET_NTOP
> and INET_PTON bits are not described; we probably should add these
> two close to where we say "Define NO_IPV6 if you lack IPv6 support".
Lol... I avoid Autotools when I can, too.

In this case, since Git supplies Autotools and the fix looks easy, maybe -lnsl -lsockets is the path to chose on Solaris. It ensures things "just work" under the common case. It will avoid future problems, and keep the mailing list dark and silent.

One other thing I try to engineer around... folks usually don't read README's. I fell if README's were going to work, then it would have happened by now in the last 40 or 50 years. Since the indicators tell me they don't work, I don't depend on them.

I guess another option is to remove Autotools. I'm fine with using GNU Make as the primary build system. But like you said, other folks may want to tar and feather you for it.

Jeff

← back to recent threads