Subject: pkg/34844: mysql5-client fails to build with gcc4 on Darwin
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <jussi.liukkonen@snorkkeli.homeip.net>
List: pkgsrc-bugs
Date: 10/17/2006 20:45:01
>Number:         34844
>Category:       pkg
>Synopsis:       mysql5-client fails to build with gcc4 on Darwin
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Oct 17 20:45:00 +0000 2006
>Originator:     Juha Liukkonen
>Release:        Mac OS X 10.4.8
>Organization:
Headache, Inc
>Environment:
Darwin lankku.koti2.net 8.8.0 Darwin Kernel Version 8.8.0: Fri Sep  8 17:18:57 PDT 2006; root:xnu-792.12.6.obj~1/RELEASE_PPC Power Macintosh powerpc

>Description:
mysql 5.0.24a (from pkgsrc-2006Q3) fails to build with Darwin's gcc4 due to use of bool variables in C source files. Filed as MySQL bug #23392. Several files exhibit this failure mode:

 gcc -pipe -DDEFAULT_CHARSET_HOME=\"/usr/pkg\" -DDATADIR=\"/var/mysql\" -DDEFAULT_HOME_ENV=MYSQL_HOME -DDEFAULT_GROUP_SUFFIX_ENV=MYSQL_GROUP_SUFFIX -DDEFAULT_SYSCONFDIR=\"/usr/pkg/etc\" -DSHAREDIR=\"/usr/pkg/share/mysql\" -DDONT_USE_RAID -DMYSQL_CLIENT -I. -I.. -I../include -Dunix -no-cpp-precomp -I/Users/powermac/Projects/pkgsrc/databases/mysql5-client/work/.buildlink/include -DDBUG_OFF -mcpu=G4 -O2 -DUSE_OLD_FUNCTIONS -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -c libmysql.c  -fno-common -DPIC -o .libs/libmysql.o
libmysql.c: In function 'read_binary_time':
libmysql.c:3409: error: 'bool' undeclared (first use in this function)
libmysql.c:3409: error: (Each undeclared identifier is reported only once
libmysql.c:3409: error: for each function it appears in.)
libmysql.c:3409: error: parse error before "to"
libmysql.c: In function 'is_binary_compatible':
libmysql.c:4220: error: 'bool' undeclared (first use in this function)
libmysql.c:4220: error: parse error before "type1_found"
libmysql.c:4223: error: 'type1_found' undeclared (first use in this function)
libmysql.c:4224: error: 'type2_found' undeclared (first use in this function)
gnumake[2]: *** [libmysql.lo] Error 1
gnumake[1]: *** [all-recursive] Error 1
gnumake: *** [all] Error 2
*** Error code 2

Stop.
bmake: stopped in /Users/powermac/Projects/pkgsrc/databases/mysql5-client
*** Error code 1

Stop.
>How-To-Repeat:
cd databases/mysql5-client; bmake build
>Fix:
--- libmysql/libmysql.c.orig    2006-08-26 00:11:46.000000000 +0300
+++ libmysql/libmysql.c 2006-10-17 22:49:55.000000000 +0300
@@ -3406,7 +3406,7 @@
   if (length)
   {
     uchar *to= *pos;
-    tm->neg= (bool) to[0];
+    tm->neg= (my_bool) to[0];
 
     tm->day=    (ulong) sint4korr(to+1);
     tm->hour=   (uint) to[5];
@@ -4217,7 +4217,7 @@
   for (range= range_list; range != range_list_end; ++range)
   {
     /* check that both type1 and type2 are in the same range */
-    bool type1_found= FALSE, type2_found= FALSE;
+    my_bool type1_found= FALSE, type2_found= FALSE;
     for (type= *range; *type != MYSQL_TYPE_NULL; type++)
     {
       type1_found|= type1 == *type;
--- vio/viosslfactories.c.orig  2006-10-17 23:12:50.000000000 +0300
+++ vio/viosslfactories.c       2006-10-17 23:13:13.000000000 +0300
@@ -18,8 +18,8 @@
 
 #ifdef HAVE_OPENSSL
 
-static bool     ssl_algorithms_added    = FALSE;
-static bool     ssl_error_strings_loaded= FALSE;
+static my_bool  ssl_algorithms_added    = FALSE;
+static my_bool  ssl_error_strings_loaded= FALSE;
 static int      verify_depth = 0;
 
 static unsigned char dh512_p[]=
--- regex/reginit.c.orig        2006-10-17 23:16:04.000000000 +0300
+++ regex/reginit.c     2006-10-17 23:16:15.000000000 +0300
@@ -5,7 +5,7 @@
 #include <m_string.h>
 #include "cclass.h"
 
-static bool regex_inited=0;
+static my_bool regex_inited=0;
 
 void my_regex_init(CHARSET_INFO *cs)
 {
--- client/mysqltest.c.orig     2006-10-17 23:26:32.000000000 +0300
+++ client/mysqltest.c  2006-10-17 23:29:16.000000000 +0300
@@ -2280,8 +2280,8 @@
   char *con_buf, *p;
   char buff[FN_REFLEN];
   int con_port;
-  bool con_ssl= 0;
-  bool con_compress= 0;
+  my_bool con_ssl= 0;
+  my_bool con_compress= 0;
   int free_con_sock= 0;
   int error= 0;
   int create_conn= 1;
@@ -3294,7 +3294,7 @@
 */
 
 static void append_field(DYNAMIC_STRING *ds, uint col_idx, MYSQL_FIELD* field,
-                         const char* val, ulonglong len, bool is_null)
+                         const char* val, ulonglong len, my_bool is_null)
 {
   if (col_idx < max_replace_column && replace_column[col_idx])
   {
@@ -5063,12 +5063,12 @@
 #define LAST_CHAR_CODE 259
 
 typedef struct st_replace {
-  bool  found;
+  my_bool       found;
   struct st_replace *next[256];
 } REPLACE;
 
 typedef struct st_replace_found {
-  bool found;
+  my_bool found;
   char *replace_string;
   uint to_offset;
   int from_offset;