Solaris: Fail to build git with CFLAGS=-m64
From: evgeny litvinenko <hidden>
Date: 2016-06-15 23:06:50
Subsystem:
the rest · Maintainer:
Linus Torvalds
Hi.
Tried to build git-2.6.1 on Solaris (Oracle Solaris 11.2 and
OpenIndiana 151.1.9)
with CFLAGS="-m64" and got an error during make step:
GIT_VERSION = 2.6.1
* new build flags
gcc -o credential-store.o -c -MF ./.depend/credential-store.o.d -MQ
credential-store.o -MMD -MP --save-temps -O2 -m64 -I.
-D__EXTENSIONS__ -D__sun__ -DHAVE_ALLOCA_H -DNO_D_TYPE_IN_DIRENT
-DNO_INET_NTOP -DNO_INET_PTON -DHAVE_PATHS_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"' credential-store.c
In file included from cache.h:4:0,
from credential-store.c:1:
git-compat-util.h:689:13: error: conflicting types for inet_ntop
/usr/include/arpa/inet.h:43:20: note: previous declaration of inet_ntop was here
gmake: *** [credential-store.o] Error 1
Solaris has the following prototype in the file /usr/include/arpa/inet.h:
extern const char *inet_ntop(int, const void *_RESTRICT_KYWD, char
*_RESTRICT_KYWD, socklen_t);
Git's prototype for inet_ntop is in file git-compat-util.h:
#ifdef NO_INET_NTOP
const char *inet_ntop(int af, const void *src, char *dst, size_t size);
#endif
When build with -m64
typedefs for socklen_t
typedef unsigned int uint32_t;
typedef uint32_t socklen_t;
and typedefs for size_t
typedef unsigned long ulong_t;
typedef ulong_t size_t;
With -m32 both socklen_t and size_t are "unsigned int" and there is no
any errors.
Also Solaris has the functions inet_ntop and inet_pton in libnsl.so so
I did the following correction to configure.ac to build git with -m64:
diff --git a/configure.ac b/configure.ac
index 14012fa..4cf1929 100644
--- a/configure.ac
+++ b/configure.ac@@ -637,6 +637,11 @@ AC_CHECK_FUNC([inet_ntop], [NEEDS_RESOLV=YesPlease], [NO_INET_NTOP=YesPlease]) ]) +if test "x$ac_cv_func_inet_ntop" != xyes; then +AC_CHECK_LIB([nsl], [inet_ntop], + [NEEDS_NSL=YesPlease; NO_INET_NTOP=], + []) +fi GIT_CONF_SUBST([NO_INET_NTOP]) # # Define NO_INET_PTON if linking with -lresolv is not enough.
@@ -648,6 +653,11 @@ AC_CHECK_FUNC([inet_pton], [NEEDS_RESOLV=YesPlease], [NO_INET_PTON=YesPlease]) ]) +if test "x$ac_cv_func_inet_pton" != xyes; then +AC_CHECK_LIB([nsl], [inet_pton], + [NEEDS_NSL=YesPlease; NO_INET_PTON=], + []) +fi GIT_CONF_SUBST([NO_INET_PTON]) # # Define NO_HSTRERROR if linking with -lresolv is not enough.
Is it possible to change prototype for inet_ntop in git-compat-util.h or use Solaris's inet_ntop and inet_pton ? Evgeny