Bug #23392 Build failure for 5.0.24a using gcc4 (pkgsrc/macosx)
Submitted: 17 Oct 2006 20:32 Modified: 18 Oct 2006 20:46
Reporter: Juha Liukkonen Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.0.24a OS:MacOS (Mac OS X 10.4.8 (PowerPC))
Assigned to: Sveta Smirnova CPU Architecture:Any

[17 Oct 2006 20:32] Juha Liukkonen
Description:
Build fails with a C language files using type bool variables. This is apparently not acceptable to Apple's gcc4, which is the default compiler in recent OSX. pkgsrc (with tag pkgsrc-2006Q3) was used as the build environment, but this does not appear to have a significance.

The build fails with:

 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.

The same with a few other files -- see the attached patch.

How to repeat:
configure; make

--or, using pkgsrc--

cd databases/mysql5-client
bmake install

Suggested 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;
[18 Oct 2006 7:14] Sveta Smirnova
Thank you for the report.

Could you please try using current 5.0.26 version accessible from http://dev.mysql.com/downloads/mysql/5.0.html?
[18 Oct 2006 20:46] Juha Liukkonen
5.0.26 seems to build without a problem. I will notify the pkgsrc maintainer to update. Thank you!