Bug #11845 GCC-4.0 build problems [patch]
Submitted: 10 Jul 2005 15:41 Modified: 25 Jul 2005 11:20
Reporter: Christian Hammers (Silver Quality Contributor) (OCA) Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Compiling Severity:S2 (Serious)
Version:4.1 and 5.0 OS:Linux (Debian GNU/Linux)
Assigned to: CPU Architecture:Any

[10 Jul 2005 15:41] Christian Hammers
Description:
Debian has started to use the GCC-4.0 compiler suite per default. This caused MySQL to no longer build. The patch seems to be fairly simple but I would like to get your approval.

The problem affects at least MySQL 4.1.2 and 5.0.7beta with "gcc (GCC) 4.0.1 20050701".

bye,

-christian- (Debian maintainer for MySQL)

How to repeat:
Just build and stumble upon:

if g++ -DDEFAULT_BASEDIR=\"/usr\" -DDATADIR="\"/var/lib/mysql\"" -DDEFAULT_CHARSET_HOME="\"/usr\"" -DSHAREDIR="\"/usr/share/mysql\"" -DHAVE_CONFIG_H -I. -I. -I.. -I../include -I.    -O3 -DDBUG_OFF -DBIG_JOINS=1 -felide-constructors -fno-rtti -O3   -fno-implicit-templates -fno-exceptions -fno-rtti  -MT my_new.o -MD -MP -MF ".deps/my_new.Tpo" -c -o my_new.o my_new.cc; \
then mv -f ".deps/my_new.Tpo" ".deps/my_new.Po"; else rm -f ".deps/my_new.Tpo"; exit 1; fi
/usr/include/asm/system.h:247: error: expected ',' or '...' before 'new'
/usr/include/asm/system.h: In function 'long unsigned int __cmpxchg(volatile void*, long unsigned int, long unsigned int)':
/usr/include/asm/system.h:250: error: 'size' was not declared in this scope
/usr/include/asm/system.h:254: error: expected type-specifier before ')' token
/usr/include/asm/system.h:260: error: expected type-specifier before ')' token
/usr/include/asm/system.h:266: error: expected type-specifier before ')' token
make[3]: *** [my_new.o] Fehler 1
make[3]: Leaving directory `/home/ch/debian/mysql/SID-4.1/mysql-dfsg-4.1-4.1.12/mysys'
make[2]: *** [all-recursive] Fehler 1
make[2]: Leaving directory `/home/ch/debian/mysql/SID-4.1/mysql-dfsg-4.1-4.1.12'
make[1]: *** [all] Fehler 2
make[1]: Leaving directory `/home/ch/debian/mysql/SID-4.1/mysql-dfsg-4.1-4.1.12'
make: *** [build-stamp] Fehler 2

("Fehler" is German for "error")

Suggested fix:
--- old/include/my_global.h.orig        2005-07-10 16:56:58.000000000 +0200
+++ new/include/my_global.h     2005-07-10 16:55:53.000000000 +0200
@@ -301,10 +301,10 @@
 #include <alloca.h>
 #endif
 #ifdef HAVE_ATOMIC_ADD
-#if defined(__ia64__)
+/* #if defined(__ia64__) */
 #define new my_arg_new
 #define need_to_restore_new 1
-#endif
+/* #endif */
 C_MODE_START
 #include <asm/atomic.h>
 C_MODE_END
[12 Jul 2005 3:42] Jorge del Conde
Thanks for your bug report and patch.
[12 Jul 2005 3:42] Jorge del Conde
This bug is closely related to 11576
[12 Jul 2005 7:32] Christian Hammers
Jorge: Are you sure that you gave the right bug number for which this one here should be a duplicate? The one you mentioned is regarding thread detection while this one is about gcc-3 vs. gcc-4 - the source was buildable with the very same commands just minutes before I upgraded to the new Debian gcc-4.0 packages...

-christian-
[25 Jul 2005 11:20] Sergei Golubchik
Christian - it shoud be fixed already - http://bugs.mysql.com/bug.php?id=7851