You can try this patch to check if it works.

>From 74b502bcbef74927b2e006ac399a4d3b3de1d331 Mon Sep 17 00:00:00 2001
From: Vincent Bernat <vinc...@bernat.im>
Date: Wed, 18 May 2016 19:38:36 +0200
Subject: [PATCH] MINOR: use a macro for htonll/ntohll

Some OS have a definition for htonll/ntohll using a regular function and
the signature is not compatible with the provided function. Instead,
provide a macro that would shadow such a definition instead of
conflicting with it.
---
 include/common/standard.h | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/include/common/standard.h b/include/common/standard.h
index f123f1a41dfb..2cd7fc48937c 100644
--- a/include/common/standard.h
+++ b/include/common/standard.h
@@ -1049,7 +1049,7 @@ static inline unsigned char utf8_return_length(unsigned char code)
  * a few bswap and 2 shifts are left, which is the minimum acceptable.
  */
 #ifndef htonll
-static inline unsigned long long htonll(unsigned long long a)
+static inline unsigned long long _htonll(unsigned long long a)
 {
 	union {
 		struct {
@@ -1060,14 +1060,12 @@ static inline unsigned long long htonll(unsigned long long a)
 	} w = { .by64 = a };
 	return ((unsigned long long)htonl(w.by32.w1) << 32) | htonl(w.by32.w2);
 }
+#define htonll(a) _htonll(a)
 #endif
 
 /* Turns 64-bit value <a> from network byte order to host byte order. */
 #ifndef ntohll
-static inline unsigned long long ntohll(unsigned long long a)
-{
-	return htonll(a);
-}
+#define ntohll(a) htonll(a)
 #endif
 
 /* returns a 64-bit a timestamp with the finest resolution available. The
-- 
2.8.1

-- 
Let the data structure the program.
            - The Elements of Programming Style (Kernighan & Plauger)

 ――――――― Original Message ―――――――
 From: Jonathan Fisher <jfis...@tomitribe.com>
 Sent: 18 mai 2016 12:56 -0400
 Subject: Re: Compilation problem: haproxy 1.6.5 (latest) on Solaris 11
 To: Vincent Bernat
 Cc: haproxy@formilux.org

> Oh man, I wish I was smart enough to understand what's happening
> there... what do I need to replace? (And for my own learning/benefit,
> can you explain what's happening?)
>
> Thank you!!!
>
> On Wed, May 18, 2016 at 12:07 PM, Vincent Bernat <ber...@luffy.cx>
> wrote:
>
>     Hey!
>     
>     Since there is some discrepancy in the definition of ntohll among
>     platforms, I define this macro to shadow any existing definition:
>     
>     #ifndef ntohll
>     # define ntohll(x) \
>     (((u_int64_t)(ntohl((int)(((x) << 32) >> 32))) << 32) | \
>     (unsigned int)ntohl(((int)((x) >> 32))))
>     #endif
>     
>     You can try yourself. Or if you don't know what to replace, I can
>     provide a patch.
>     --
>     Don't compare floating point numbers just for equality.
>     - The Elements of Programming Style (Kernighan & Plauger)
>     
>     ――――――― Original Message ―――――――
>     From: Jonathan Fisher <jfis...@tomitribe.com>
>     Sent: 18 mai 2016 10:22 -0400
>     Subject: Compilation problem: haproxy 1.6.5 (latest) on Solaris 11
>     To: haproxy@formilux.org
>     
>     
>     
>     > We can get 1.5 to compile quite nicely on Solaris 11 :) 1.6 has
>     a few
>     > nice features though we'd like to have, if it all possible. I
>     have a
>     > VMDK created if the developers want to try it themselves in a
>     virtual
>     > machine.
>     >
>     > Here is the output of the compiler, which is GCC-48:
>     >
>     > user@tomee:~/haproxy-1.6.5$ gmake TARGET=solaris
>     > gcc -Iinclude -Iebtree -Wall -O2 -g -fno-strict-aliasing -
>     > Wdeclaration-after-statement -fomit-frame-pointer -
>     DFD_SETSIZE=65536 -
>     > D_REENTRANT -DTPROXY -DCONFIG_HAP_CRYPT -DNEED_CRYPT_H -
>     > DUSE_GETADDRINFO -DENABLE_POLL -
>     DCONFIG_HAPROXY_VERSION=\"1.6.5\" -
>     > DCONFIG_HAPROXY_DATE=\"2016/05/10\" \
>     > -DBUILD_TARGET='"solaris"' \
>     > -DBUILD_ARCH='""' \
>     > -DBUILD_CPU='"generic"' \
>     > -DBUILD_CC='"gcc"' \
>     > -DBUILD_CFLAGS='"-O2 -g -fno-strict-aliasing -
>     > Wdeclaration-after-statement -fomit-frame-pointer -
>     DFD_SETSIZE=65536 -
>     > D_REENTRANT"' \
>     > -DBUILD_OPTIONS='""' \
>     > -c -o src/haproxy.o src/haproxy.c
>     > In file included from include/common/ticks.h:56:0,
>     > from include/proto/proxy.h:26,
>     > from include/common/cfgparse.h:30,
>     > from src/haproxy.c:63:
>     > include/common/standard.h:1013:34: error: static declaration of
>     > 'htonll' follows non-static declaration
>     > static inline unsigned long long htonll(unsigned long long a)
>     > ^
>     > In file included from /usr/include/netinet/in.h:73:0,
>     > from /usr/include/sys/socket.h:29,
>     > from src/haproxy.c:36:
>     > /usr/include/sys/byteorder.h:75:17: note: previous declaration
>     of
>     > 'htonll' was here
>     > extern uint64_t htonll(uint64_t);
>     > ^
>     > In file included from include/common/ticks.h:56:0,
>     > from include/proto/proxy.h:26,
>     > from include/common/cfgparse.h:30,
>     > from src/haproxy.c:63:
>     > include/common/standard.h:1028:34: error: static declaration of
>     > 'ntohll' follows non-static declaration
>     > static inline unsigned long long ntohll(unsigned long long a)
>     > ^
>     > In file included from /usr/include/netinet/in.h:73:0,
>     > from /usr/include/sys/socket.h:29,
>     > from src/haproxy.c:36:
>     > /usr/include/sys/byteorder.h:76:17: note: previous declaration
>     of
>     > 'ntohll' was here
>     > extern uint64_t ntohll(uint64_t);
>     > ^
>     > gmake: *** [src/haproxy.o] Error 1
>     > user@tomee:~/haproxy-1.6.5$
>     >
>     > cheers,

Reply via email to