Bug #30356 gcc-compile fails if used with option "-mcpu=970" or "-mcpu=G5"
Submitted: 10 Aug 2007 11:38 Modified: 18 Dec 2008 9:56
Reporter: D. Giffeler Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.0.45, 5.1.22-rc OS:MacOS (10.4.10 Server)
Assigned to: Guilhem Bichot CPU Architecture:Any
Tags: G5, gcc, mcpu, ppc970

[10 Aug 2007 11:38] D. Giffeler
Description:
Using gcc version 4.0.1 (Apple Computer, Inc. build 5367), linker Apple Computer, Inc. version cctools-622.5.obj~13

No errors while configuring.
Compilation stops with the following error:

gcc-4.0 -DDEFAULT_BASEDIR=\"/usr/local/mysql\" -DDATADIR="\"/data\"" -DDEFAULT_CHARSET_HOME="\"/usr/local/mysql\"" -DSHAREDIR="\"/usr/local/mysql/share/mysql\"" -DDEFAULT_HOME_ENV=MYSQL_HOME -DDEFAULT_GROUP_SUFFIX_ENV=MYSQL_GROUP_SUFFIX -DDEFAULT_SYSCONFDIR="\"/etc\"" -DHAVE_CONFIG_H -I. -I. -I.. -I../zlib -I../include -I../include -I.    -DDBUG_OFF -w -mcpu=G5 -O3 -mmacosx-version-min=10.3 -isysroot /Developer/SDKs/MacOSX10.3.9.sdk   -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -c thr_lock.c
thr_lock.c:687: error: parse error before 'bool'
thr_lock.c: In function 'free_all_read_locks':
thr_lock.c:689: error: 'lock' undeclared (first use in this function)
thr_lock.c:689: error: (Each undeclared identifier is reported only once
thr_lock.c:689: error: for each function it appears in.)
thr_lock.c:706: error: 'using_concurrent_insert' undeclared (first use in this function)
make[2]: *** [thr_lock.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

No compile-errors without the mcpu-option.

How to repeat:
ac_cv_c_bigendian=yes \
MACOSX_DEPLOYMENT_TARGET=10.3 \
CC=gcc-4.0 CFLAGS="-w -mcpu=G5 -O3 -mmacosx-version-min=10.3 -isysroot /Developer/SDKs/MacOSX10.3.9.sdk" \
CXX=g++-4.0 CXXFLAGS="-w -mcpu=G5 -O3 -mmacosx-version-min=10.3 -isysroot /Developer/SDKs/MacOSX10.3.9.sdk" \
./configure \
--disable-dependency-tracking \
--with-mysqld-ldflags=-all-static \
--with-client-ldflags=-all-static \
--disable-shared \
--enable-static \
--with-embedded-server \
--enable-thread-safe-client \
--prefix=/usr/local/mysql \
--localstatedir=/data \
--enable-assembler \
--with-big-tables \
--with-charset=latin1 \
--with-collation=latin1_german1_ci \
--with-extra-charsets=utf8 \
--with-unix-socket-path=/var/mysql/mysql.sock \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--sysconfdir=/etc \
--enable-local-infile \
--with-mysqld-user=mysql \
--without-debug \
--without-bench \
--without-docs \
--without-isam \
--without-innodb
[10 Aug 2007 12:37] Sveta Smirnova
Thank you for the report.

I can not repeat described behaviour in myself environment. Please indicate which processor do you have.
[10 Aug 2007 12:51] D. Giffeler
Hardware Overview:

      Machine Name: Xserve G5
      Machine Model: RackMac3,1
      CPU Type: PowerPC G5  (3.0)
      Number Of CPUs: 1
      CPU Speed: 2 GHz
      L2 Cache (per CPU): 512 KB
      Memory: 2 GB
      Bus Speed: 1 GHz
      Boot ROM Version: 5.1.7f2
[11 Aug 2007 15:35] D. Giffeler
By the way: I had no problems compiling other sources like PHP 5.2.3 with the gcc-option -mcpu=G5.
[12 Aug 2007 16:55] Davi Arnaut
Some old headers of Apple's gcc may define the bool type when altivec is
disabled (#define bool bool), causing include/my_global.h to not define
bool. IMHO, we should always undef bool (so it won't collide with my_bool)
and replace all occurrences of bool with my_bool in mysys files.
[27 Aug 2007 20:41] Sveta Smirnova
Thank you for the report.

Verified as described.
[28 Oct 2007 13:52] Valeriy Kravchuk
Bug #31367 was marked as a duplicate of this one. It has a contributed idea about possible fix.
[26 Feb 2008 17:59] Guilhem Bichot
Coincidence, this was fixed by me in the Maria tree and the 5.1-build tree:
ChangeSet@1.2532, 2008-02-19 18:45:11+01:00, guilhem@gbichot4.local +5 -0
  fixes for build failures due to my yesterday's changeset forbidding
  bool in C.
[18 Dec 2008 9:56] Guilhem Bichot
fixed in 5.1 since a few months:
revno: 2531
revision-id: sp1r-guilhem@gbichot4.local-20080218223657-33278
parent: sp1r-tsmith@ramayana.hindu.god-20080218192531-43561
parent: sp1r-guilhem@gbichot4.local-20080218222939-48852
committer: guilhem@gbichot4.local
timestamp: Mon 2008-02-18 23:36:57 +0100
message:
  Merge gbichot@bk-internal.mysql.com:/home/bk/mysql-5.1-build
  into  gbichot4.local:/home/mysql_src/mysql-5.1-build-gca
    ------------------------------------------------------------
    revno: 2512.11.1
    revision-id: sp1r-guilhem@gbichot4.local-20080218222939-48852
    parent: sp1r-mkindahl@dl145h.mysql.com-20080205123157-59005
    committer: guilhem@gbichot4.local
    timestamp: Mon 2008-02-18 23:29:39 +0100
    message:
      Fix for server bug experienced in Maria (wrong "Truncated incorrect <var_name>
      value" error even though the value was correct): a C function in my_getopt.c
      was taking bool* in parameter and was called from C++ sql_plugin.cc,
      but on some Mac OS X sizeof(bool) is 1 in C and 4 in C++, giving funny
      mismatches. Fixed, all other occurences of bool in C are removed, future
      ones are blocked by a "C-bool-catcher" in my_global.h (use my_bool).

and merged into 6.0 a few months ago too.