{"thread":{"id":"40546","subject":"Solaris: Fail to build git with CFLAGS=-m64","startedAt":"2015-10-13T06:30:48Z","lastAt":"2015-10-13T19:06:38Z","messageCount":3,"participants":["evgeny litvinenko","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"271555","messageId":"CAKzKBF0MH+f3=frtwwxKfaELNXm4fCR5LWVhvJ7-YQF-ngfM+g@mail.gmail.com","threadId":"40546","inReplyTo":null,"subject":"Solaris: Fail to build git with CFLAGS=-m64","fromName":"evgeny litvinenko","fromEmail":"evgeny.v.litvinenko@gmail.com","sentAt":"2015-10-13T06:30:48Z","receivedAt":"2015-10-13T06:30:48Z","isPatch":false,"sender":{"key":"evgeny.v.litvinenko@gmail.com","avatar":null},"body":"Hi.\n\nTried to build git-2.6.1 on Solaris (Oracle Solaris 11.2 and\nOpenIndiana 151.1.9)\nwith CFLAGS=\"-m64\" and got an error during make step:\n\nGIT_VERSION = 2.6.1\n    * new build flags\ngcc -o credential-store.o -c -MF ./.depend/credential-store.o.d -MQ\ncredential-store.o -MMD -MP  --save-temps -O2 -m64 -I.\n-D__EXTENSIONS__ -D__sun__ -DHAVE_ALLOCA_H -DNO_D_TYPE_IN_DIRENT\n-DNO_INET_NTOP -DNO_INET_PTON  -DHAVE_PATHS_H -DHAVE_STRINGS_H\n-DHAVE_DEV_TTY -DHAVE_CLOCK_GETTIME -DHAVE_CLOCK_MONOTONIC\n-DHAVE_GETDELIM -DSHA1_HEADER='<openssl/sha.h>'  -Icompat/regex\n-DSHELL_PATH='\"/bin/bash\"'  credential-store.c\nIn file included from cache.h:4:0,\n                 from credential-store.c:1:\ngit-compat-util.h:689:13: error: conflicting types for inet_ntop\n/usr/include/arpa/inet.h:43:20: note: previous declaration of inet_ntop was here\ngmake: *** [credential-store.o] Error 1\n\nSolaris has the following prototype in the file /usr/include/arpa/inet.h:\n\nextern const char *inet_ntop(int, const void *_RESTRICT_KYWD, char\n*_RESTRICT_KYWD, socklen_t);\n\nGit's prototype for inet_ntop is in file git-compat-util.h:\n\n#ifdef NO_INET_NTOP\nconst char *inet_ntop(int af, const void *src, char *dst, size_t size);\n#endif\n\nWhen build with -m64\ntypedefs for socklen_t\n\ntypedef unsigned int uint32_t;\ntypedef uint32_t socklen_t;\n\nand typedefs for size_t\n\ntypedef unsigned long ulong_t;\ntypedef ulong_t size_t;\n\nWith -m32 both socklen_t and size_t are \"unsigned int\" and there is no\nany errors.\n\nAlso Solaris has the functions inet_ntop and inet_pton in libnsl.so so\nI did the following correction to configure.ac to build git with -m64:\n\ndiff --git a/configure.ac b/configure.ac\nindex 14012fa..4cf1929 100644\n--- a/configure.ac\n+++ b/configure.ac\n@@ -637,6 +637,11 @@ AC_CHECK_FUNC([inet_ntop],\n        [NEEDS_RESOLV=YesPlease],\n        [NO_INET_NTOP=YesPlease])\n ])\n+if test \"x$ac_cv_func_inet_ntop\" != xyes; then\n+AC_CHECK_LIB([nsl], [inet_ntop],\n+       [NEEDS_NSL=YesPlease; NO_INET_NTOP=],\n+       [])\n+fi\n GIT_CONF_SUBST([NO_INET_NTOP])\n #\n # Define NO_INET_PTON if linking with -lresolv is not enough.\n@@ -648,6 +653,11 @@ AC_CHECK_FUNC([inet_pton],\n        [NEEDS_RESOLV=YesPlease],\n        [NO_INET_PTON=YesPlease])\n ])\n+if test \"x$ac_cv_func_inet_pton\" != xyes; then\n+AC_CHECK_LIB([nsl], [inet_pton],\n+       [NEEDS_NSL=YesPlease; NO_INET_PTON=],\n+       [])\n+fi\n GIT_CONF_SUBST([NO_INET_PTON])\n #\n # Define NO_HSTRERROR if linking with -lresolv is not enough.\n\nIs it possible to change prototype for inet_ntop in git-compat-util.h\nor use Solaris's inet_ntop and inet_pton\n?\n\nEvgeny\n"},{"id":"271560","messageId":"xmqqvbab9pz7.fsf@gitster.mtv.corp.google.com","threadId":"40546","inReplyTo":"CAKzKBF0MH+f3=frtwwxKfaELNXm4fCR5LWVhvJ7-YQF-ngfM+g@mail.gmail.com","subject":"Re: Solaris: Fail to build git with CFLAGS=-m64","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-10-13T07:39:40Z","receivedAt":"2015-10-13T07:39:40Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"evgeny litvinenko <evgeny.v.litvinenko@gmail.com> writes:\n\n> Solaris has the following prototype in the file /usr/include/arpa/inet.h:\n>\n> extern const char *inet_ntop(int, const void *_RESTRICT_KYWD, char\n> *_RESTRICT_KYWD, socklen_t);\n>\n> Git's prototype for inet_ntop is in file git-compat-util.h:\n>\n> #ifdef NO_INET_NTOP\n> const char *inet_ntop(int af, const void *src, char *dst, size_t size);\n> #endif\n\nThis tells me that it is designed to be used only when the platform\ndoes not offer inet_ntop().  If your platform does have it, why is\nyour build define NO_INET_NTOP?\n\nPerhaps configure generated by autoconf is faulty?\n\nIn this project, use of autoconf/configure is optional---in other\nwords, it is expected that you can build successfully by setting and\nunsetting necessary Makefile macros in your own config.mak without\nusing autoconf/configure at all.  I'd try without configure and make\nsure I do not define NO_INET_NTOP (and if you have inet_pton(), then\nmake sure you do not define NO_INET_PTON either) in config.mak if I\nwere you.\n"},{"id":"271588","messageId":"CAKzKBF1nS_Yzs3V3ZjpezwOAOqpn_xfUGF-F6vuLtYAR4=5pYQ@mail.gmail.com","threadId":"40546","inReplyTo":"xmqqvbab9pz7.fsf@gitster.mtv.corp.google.com","subject":"Re: Solaris: Fail to build git with CFLAGS=-m64","fromName":"evgeny litvinenko","fromEmail":"evgeny.v.litvinenko@gmail.com","sentAt":"2015-10-13T19:06:38Z","receivedAt":"2015-10-13T19:06:38Z","isPatch":false,"sender":{"key":"evgeny.v.litvinenko@gmail.com","avatar":null},"body":"Hi Junio,\n\nOn 10/13/15, Junio C Hamano <gitster@pobox.com> wrote:\n> evgeny litvinenko <evgeny.v.litvinenko@gmail.com> writes:\n>\n>> Solaris has the following prototype in the file /usr/include/arpa/inet.h:\n>>\n>> extern const char *inet_ntop(int, const void *_RESTRICT_KYWD, char\n>> *_RESTRICT_KYWD, socklen_t);\n>>\n>> Git's prototype for inet_ntop is in file git-compat-util.h:\n>>\n>> #ifdef NO_INET_NTOP\n>> const char *inet_ntop(int af, const void *src, char *dst, size_t size);\n>> #endif\n>\n> This tells me that it is designed to be used only when the platform\n> does not offer inet_ntop().  If your platform does have it, why is\n> your build define NO_INET_NTOP?\n\nI think this is because configure.ac doesn't check for inet_ntop in\nlibnsl (in Solaris 11.2 inet_ntop and inet_pton are in libnsl)\nconfigure.ac checks for these function in libresolv only.\n\n> Perhaps configure generated by autoconf is faulty?\n>\n> In this project, use of autoconf/configure is optional---in other\n> words, it is expected that you can build successfully by setting and\n> unsetting necessary Makefile macros in your own config.mak without\n> using autoconf/configure at all.  I'd try without configure and make\n> sure I do not define NO_INET_NTOP (and if you have inet_pton(), then\n> make sure you do not define NO_INET_PTON either) in config.mak if I\n> were you.\n>\n\nYes, if I do not define NO_INET_NTOP/NO_INET_PTON the build is successful\nas libnsl is linked - in configure.ac there is 'NEEDS_NSL = YesPlease'\nfor SunOS'es.\n\nevgeny.\n"}]}