Re: trouble building on solaris

2013-05-01 Thread Willy Tarreau
Hi Keith,

On Tue, Apr 30, 2013 at 09:39:12AM +, keith anderson wrote:
 Benjamin Polidore polidore@... writes:
 
  
  
  sorry, this is 1.5 dev 14. 
  
  thanks.On Wed, Dec 5, 2012 at 9:17 AM, Benjamin Polidore
 polid...@gmail.com wrote:
  src/proxy.c:46: error: initializer element is not constant
  
  
  
  
  
  
 
 Hi Willy,
 
 It seems that this issue has crept into the latest haproxy-1.5-dev18 release.

indeed :-(

I'm CCing Simon and Marc-Antoine who last included stdbool. We fixed this
already in the past, so I have now added a notice about this in the readme.

Stdbool is not portable, it does not properly work on some OS/gcc
combinations, we need to be careful about it.

 gcc -Iinclude -Iebtree -Wall  -O2 -g -fno-strict-aliasing
 -fomit-frame-pointer -DFD_SETSIZE=65536 -D_REENTRANT  -DTPROXY
 -DCONFIG_HAP_CRYPT -DNEED_CRYPT_H -DUSE_GETADDRINFO -DENABLE_POLL 
 -DCONFIG_HAPROXY_VERSION=\1.5-dev18\ -DCONFIG_HAPROXY_DATE=\2013/04/03\
 -c -o src/checks.o src/checks.c
 In file included from src/checks.c:28:
 /usr/include/stdbool.h:42:2: #error Use of stdbool.h is valid only in a
 c99 compilation environment.
 gmake: *** [src/checks.o] Error 1
 
 Blindly removing the #include stdbool.h from checks.c and
 haproxy-systemd-wrapper.c does get a binary compilation but also an
 (unsurprisingly) eventual core dump.

It should not cause any error, the stdbool you pointed were not used at
all, so you're facing a different error.

Would you please download the latest snapshot, we fixed a number of bugs
that may or may not be responsible for this. If you still get the core,
please run it through gdb and issue a bt full so that we can get an
idea of what is causing it. At least it works on my old Ultra5 under
solaris 8.

Thanks,
Willy




Re: trouble building on solaris

2013-05-01 Thread Simon Horman
On Wed, May 01, 2013 at 10:15:00AM +0200, Willy Tarreau wrote:
 Hi Keith,
 
 On Tue, Apr 30, 2013 at 09:39:12AM +, keith anderson wrote:
  Benjamin Polidore polidore@... writes:
  
   
   
   sorry, this is 1.5 dev 14. 
   
   thanks.On Wed, Dec 5, 2012 at 9:17 AM, Benjamin Polidore
  polid...@gmail.com wrote:
   src/proxy.c:46: error: initializer element is not constant
   
   
   
   
   
   
  
  Hi Willy,
  
  It seems that this issue has crept into the latest haproxy-1.5-dev18 
  release.
 
 indeed :-(
 
 I'm CCing Simon and Marc-Antoine who last included stdbool. We fixed this
 already in the past, so I have now added a notice about this in the readme.

Sorry about that.

Is the implication that bool, true and false shouldn't be used in haproxy?

 
 Stdbool is not portable, it does not properly work on some OS/gcc
 combinations, we need to be careful about it.
 
  gcc -Iinclude -Iebtree -Wall  -O2 -g -fno-strict-aliasing
  -fomit-frame-pointer -DFD_SETSIZE=65536 -D_REENTRANT  -DTPROXY
  -DCONFIG_HAP_CRYPT -DNEED_CRYPT_H -DUSE_GETADDRINFO -DENABLE_POLL 
  -DCONFIG_HAPROXY_VERSION=\1.5-dev18\ -DCONFIG_HAPROXY_DATE=\2013/04/03\
  -c -o src/checks.o src/checks.c
  In file included from src/checks.c:28:
  /usr/include/stdbool.h:42:2: #error Use of stdbool.h is valid only in a
  c99 compilation environment.
  gmake: *** [src/checks.o] Error 1
  
  Blindly removing the #include stdbool.h from checks.c and
  haproxy-systemd-wrapper.c does get a binary compilation but also an
  (unsurprisingly) eventual core dump.
 
 It should not cause any error, the stdbool you pointed were not used at
 all, so you're facing a different error.
 
 Would you please download the latest snapshot, we fixed a number of bugs
 that may or may not be responsible for this. If you still get the core,
 please run it through gdb and issue a bt full so that we can get an
 idea of what is causing it. At least it works on my old Ultra5 under
 solaris 8.
 
 Thanks,
 Willy
 



Re: trouble building on solaris

2013-05-01 Thread Willy Tarreau
On Wed, May 01, 2013 at 05:49:20PM +0900, Simon Horman wrote:
 On Wed, May 01, 2013 at 10:15:00AM +0200, Willy Tarreau wrote:
  Hi Keith,
  
  On Tue, Apr 30, 2013 at 09:39:12AM +, keith anderson wrote:
   Benjamin Polidore polidore@... writes:
   


sorry, this is 1.5 dev 14. 

thanks.On Wed, Dec 5, 2012 at 9:17 AM, Benjamin Polidore
   polid...@gmail.com wrote:
src/proxy.c:46: error: initializer element is not constant






   
   Hi Willy,
   
   It seems that this issue has crept into the latest haproxy-1.5-dev18 
   release.
  
  indeed :-(
  
  I'm CCing Simon and Marc-Antoine who last included stdbool. We fixed this
  already in the past, so I have now added a notice about this in the readme.
 
 Sorry about that.

You don't have to be sorry Simon, we discover lots of surprizes when porting
to other OSes, such as Solaris' implementation of isalnum() etc... as macros
that don't work as expected on chars, or AIX using unsigned chars by default
leading to funny behaviour where that was not expected. This is annoying at
first but in the end it teaches us how to write more portable code.

 Is the implication that bool, true and false shouldn't be used in haproxy?

Yes that's exactly this. I've added a few lines on this in the readme because
it's not the first time people get trapped and we can't expect them to be
aware of it if it's not documented anywhere.

Thanks!
Willy




RE: trouble building on solaris

2013-05-01 Thread Anderson Keith
Hi Willy,

SNIP

  Blindly removing the #include stdbool.h from checks.c and
  haproxy-systemd-wrapper.c does get a binary compilation but also an
  (unsurprisingly) eventual core dump.
 
 It should not cause any error, the stdbool you pointed were not used at
 all, so you're facing a different error.
 
 Would you please download the latest snapshot, we fixed a number of
 bugs that may or may not be responsible for this. If you still get the
 core, please run it through gdb and issue a bt full so that we can
 get an idea of what is causing it. At least it works on my old Ultra5
 under solaris 8.
 
 Thanks,
 Willy

I've taken the snapshot haproxy-ss-20130429 and removed the include entries 
from the files above.  gcc spat out a couple of warnings (below) but it 
compiles and doesn't core dump when executed.  Initial testing with our 
configurations would show that it works as expected.

Many thanks for your help

Keith

Vis:
$ cd haproxy-ss-20130429 
$ gmake TARGET=solaris CPU=ultrasparc USE_STATIC_PCRE=1 USE_OPENSSL=1 
USE_ZLIB=yes

SNIP

gcc -Iinclude -Iebtree -Wall  -O6 -mcpu=v9 -mtune=ultrasparc -g 
-fno-strict-aliasing -fomit-frame-pointer -DFD_SETSIZE=65536 -D_REENTRANT  
-DTPROXY -DCONFIG_HAP_CRYPT -DNEED_CRYPT_H -DUSE_GETADDRINFO -DUSE_ZLIB  
-DENABLE_POLL -DUSE_OPENSSL -DUSE_PCRE -I/usr/local/include  
-DCONFIG_HAPROXY_VERSION=\1.5-dev18\ -DCONFIG_HAPROXY_DATE=\2013/04/03\ -c 
-o src/ssl_sock.o src/ssl_sock.c
src/ssl_sock.c: In function `ssl_sock_infocbk':
src/ssl_sock.c:92: warning: passing arg 1 of `SSL_get_ex_data' discards 
qualifiers from pointer target type
src/ssl_sock.c: In function `__ssl_sock_init':
src/ssl_sock.c:3203: warning: implicit declaration of function 
`SSL_COMP_get_compression_methods'
src/ssl_sock.c:3203: warning: assignment makes pointer from integer without a 
cast
gcc -Iinclude -Iebtree -Wall  -O6 -mcpu=v9 -mtune=ultrasparc -g 
-fno-strict-aliasing -fomit-frame-pointer -DFD_SETSIZE=65536 -D_REENTRANT  
-DTPROXY -DCONFIG_HAP_CRYPT -DNEED_CRYPT_H -DUSE_GETADDRINFO -DUSE_ZLIB  
-DENABLE_POLL -DUSE_OPENSSL -DUSE_PCRE -I/usr/local/include  
-DCONFIG_HAPROXY_VERSION=\1.5-dev18\ -DCONFIG_HAPROXY_DATE=\2013/04/03\ -c 
-o src/shctx.o src/shctx.c
src/shctx.c: In function `shctx_get_cb':
src/shctx.c:460: warning: passing arg 2 of `d2i_SSL_SESSION' from incompatible 
pointer type

SNIP

Unless otherwise stated, this email has been sent from Fujitsu (Ireland) 
Limited, Fujitsu. 

This email is only for the use of its intended recipient.  Its contents are 
subject to a duty of confidence and may be privileged.  Fujitsu does not 
guarantee that this email has not been intercepted and amended or that it is 
virus-free.

Fujitsu (Ireland) Limited, registered in Ireland No 473572, registered office 
Airside Business Park, Swords Co Dublin.



Re: trouble building on solaris

2013-04-30 Thread keith anderson
Benjamin Polidore polidore@... writes:

 
 
 sorry, this is 1.5 dev 14. 
 
 thanks.On Wed, Dec 5, 2012 at 9:17 AM, Benjamin Polidore
polid...@gmail.com wrote:
 src/proxy.c:46: error: initializer element is not constant
 
 
 
 
 
 

Hi Willy,

It seems that this issue has crept into the latest haproxy-1.5-dev18 release.

vis:
gmake -v
GNU Make 3.80

gcc -v
Reading specs from /usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3/specs
Configured with:
/sfw10/builds/build/sfw10-patch/usr/src/cmd/gcc/gcc-3.4.3/configure
--prefix=/usr/sfw --with-as=/usr/ccs/bin/as --without-gnu-as
--with-ld=/usr/ccs/bin/ld --without-gnu-ld --enable-languages=c,c++
--enable-shared
Thread model: posix
gcc version 3.4.3 (csl-sol210-3_4-branch+sol_rpath)

gzcat haproxy-1.5-dev18.tar.gz | gtar xf - ;cd haproxy-1.5-dev18; gmake
TARGET=solaris
gcc -Iinclude -Iebtree -Wall  -O2 -g -fno-strict-aliasing
-fomit-frame-pointer -DFD_SETSIZE=65536 -D_REENTRANT  -DTPROXY
-DCONFIG_HAP_CRYPT -DNEED_CRYPT_H -DUSE_GETADDRINFO -DENABLE_POLL 
-DCONFIG_HAPROXY_VERSION=\1.5-dev18\ -DCONFIG_HAPROXY_DATE=\2013/04/03\ \
  -DBUILD_TARGET='solaris' \
  -DBUILD_ARCH='' \
  -DBUILD_CPU='generic' \
  -DBUILD_CC='gcc' \
  -DBUILD_CFLAGS='-O2 -g -fno-strict-aliasing -fomit-frame-pointer
-DFD_SETSIZE=65536 -D_REENTRANT' \
  -DBUILD_OPTIONS='' \
   -c -o src/haproxy.o src/haproxy.c
gcc -Iinclude -Iebtree -Wall  -O2 -g -fno-strict-aliasing
-fomit-frame-pointer -DFD_SETSIZE=65536 -D_REENTRANT  -DTPROXY
-DCONFIG_HAP_CRYPT -DNEED_CRYPT_H -DUSE_GETADDRINFO -DENABLE_POLL 
-DCONFIG_HAPROXY_VERSION=\1.5-dev18\ -DCONFIG_HAPROXY_DATE=\2013/04/03\
-c -o src/sessionhash.o src/sessionhash.c
gcc -Iinclude -Iebtree -Wall  -O2 -g -fno-strict-aliasing
-fomit-frame-pointer -DFD_SETSIZE=65536 -D_REENTRANT  -DTPROXY
-DCONFIG_HAP_CRYPT -DNEED_CRYPT_H -DUSE_GETADDRINFO -DENABLE_POLL 
-DCONFIG_HAPROXY_VERSION=\1.5-dev18\ -DCONFIG_HAPROXY_DATE=\2013/04/03\
-c -o src/base64.o src/base64.c

SNIP

gcc -Iinclude -Iebtree -Wall  -O2 -g -fno-strict-aliasing
-fomit-frame-pointer -DFD_SETSIZE=65536 -D_REENTRANT  -DTPROXY
-DCONFIG_HAP_CRYPT -DNEED_CRYPT_H -DUSE_GETADDRINFO -DENABLE_POLL 
-DCONFIG_HAPROXY_VERSION=\1.5-dev18\ -DCONFIG_HAPROXY_DATE=\2013/04/03\
-c -o src/checks.o src/checks.c
In file included from src/checks.c:28:
/usr/include/stdbool.h:42:2: #error Use of stdbool.h is valid only in a
c99 compilation environment.
gmake: *** [src/checks.o] Error 1

Blindly removing the #include stdbool.h from checks.c and
haproxy-systemd-wrapper.c does get a binary compilation but also an
(unsurprisingly) eventual core dump.

Many regards

Keith




Re: trouble building on solaris

2012-12-05 Thread Benjamin Polidore
sorry, this is 1.5 dev 14.

thanks.

On Wed, Dec 5, 2012 at 9:17 AM, Benjamin Polidore polid...@gmail.comwrote:

 src/proxy.c:46: error: initializer element is not constant



Re: trouble building on solaris

2012-12-05 Thread Willy Tarreau
Hi Benjamin,

On Wed, Dec 05, 2012 at 09:17:38AM -0500, Benjamin Polidore wrote:
 I'm building on this system:
 
 SunOS 5.10 Generic_118833-17 sun4u sparc SUNW,Sun-Fire-V245 Solaris
 
 with gcc 4.2.4:
 
 Using built-in specs.
 Target: sparc-sun-solaris2.10
 Configured with: ../configure --prefix=/usr/local/sparc-solaris2.10
 --enable-languages=c,c++
 Thread model: posix
 gcc version 4.2.4
 
 And I get this error when I build:
 
 In file included from src/dumpstats.c:17:
 /usr/include/stdbool.h:42:2: error: #error Use of stdbool.h is valid
 only in a c99 compilatio   n environment.
 src/dumpstats.c:69: error: expected declaration specifiers or '...' before
 'bool'

Thanks for your report, stdbool is totally useless here. I've just fixed it
with the attached patch.

Best regards,
Willy

From 4445502351c5684247b0d14e2843177c72b9480b Mon Sep 17 00:00:00 2001
From: Willy Tarreau w...@1wt.eu
Date: Wed, 5 Dec 2012 23:01:12 +0100
Subject: BUILD: stdbool is not portable

Benjamin Polidore reported a build issue on Solaris with gcc 4.2.4 where
stdbool is not usable without c99. It only appeared at one location in
dumpstats and is totally useless, let's use the more common and portable
int as everywhere else.
---
 src/dumpstats.c | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/dumpstats.c b/src/dumpstats.c
index f2849ef..cddadab 100644
--- a/src/dumpstats.c
+++ b/src/dumpstats.c
@@ -14,7 +14,6 @@
 #include ctype.h
 #include errno.h
 #include fcntl.h
-#include stdbool.h
 #include stdio.h
 #include stdlib.h
 #include string.h
@@ -66,7 +65,7 @@ static int stats_dump_raw_to_buffer(struct stream_interface 
*si);
 static int stats_dump_full_sess_to_buffer(struct stream_interface *si, struct 
session *sess);
 static int stats_dump_sess_to_buffer(struct stream_interface *si);
 static int stats_dump_errors_to_buffer(struct stream_interface *si);
-static int stats_table_request(struct stream_interface *si, bool show);
+static int stats_table_request(struct stream_interface *si, int show);
 static int stats_dump_proxy(struct stream_interface *si, struct proxy *px, 
struct uri_auth *uri);
 static int stats_dump_http(struct stream_interface *si, struct uri_auth *uri);
 
@@ -3957,12 +3956,12 @@ void cli_release_handler(struct stream_interface *si)
  * properly set. It returns 0 if the output buffer is full and it needs
  * to be called again, otherwise non-zero.
  */
-static int stats_table_request(struct stream_interface *si, bool show)
+static int stats_table_request(struct stream_interface *si, int show)
 {
struct session *s = si-conn-xprt_ctx;
struct ebmb_node *eb;
int dt;
-   bool skip_entry;
+   int skip_entry;
 
/*
 * We have 3 possible states in si-conn-xprt_st :
@@ -4027,7 +4026,7 @@ static int stats_table_request(struct stream_interface 
*si, bool show)
break;
 
case STAT_ST_LIST:
-   skip_entry = false;
+   skip_entry = 0;
 
if (si-applet.ctx.table.data_type = 0) {
/* we're filtering on some data contents */
@@ -4069,7 +4068,7 @@ static int stats_table_request(struct stream_interface 
*si, bool show)
 (si-applet.ctx.table.data_op == STD_OP_EQ 
||
  si-applet.ctx.table.data_op == STD_OP_LT 
||
  si-applet.ctx.table.data_op == 
STD_OP_LE)))
-   skip_entry = true;
+   skip_entry = 1;
}
 
if (show  !skip_entry 
-- 
1.7.12.2.21.g234cd45.dirty