Bug #55601 BUILD/check-cpu in mysql-trunk is broken on Mac OS X 10.5
Submitted: 28 Jul 2010 12:44 Modified: 20 Aug 2010 14:45
Reporter: Alexey Kopytov Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.5 OS:Mac OS X
Assigned to: Davi Arnaut CPU Architecture:Any

[28 Jul 2010 12:44] Alexey Kopytov
Description:
BUILD/check-cpu does not work on Mac OS 10.5 anymore, since gcc 4.0.1 which is the default compiler on 10.5 does not understand -mtune=core2. As a result, all of the BUILD/* scripts are unusable.

The culprit is the following code introduced by davi.arnaut@sun.com-20100702193804-bakpwbwtd7po85y2:

--- cut ---
  if test "x$core2" = "xyes" ; then
    cpu_arg="core2"
  fi

  if test "x$compiler" != "x" ; then
    return 0
  fi
--- cut ---

How to repeat:
Run BUILD/check-cpu on Mac OS X 10.5
[28 Jul 2010 12:55] Valeriy Kravchuk
I see the following:

macbook-pro:mysql-trunk openxs$ BUILD/check-cpu 
testing core2 ... ok
macbook-pro:mysql-trunk openxs$ gcc --version
i686-apple-darwin9-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5577)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

macbook-pro:mysql-trunk openxs$ uname -a
Darwin macbook-pro 9.6.0 Darwin Kernel Version 9.6.0: Mon Nov 24 17:37:00 PST 2008; root:xnu-1228.9.59~1/RELEASE_I386 i386

What's wrong with this my box (other than recent? Xcode for 10.5.x installed)?
[28 Jul 2010 12:58] Valeriy Kravchuk
macbook-pro:mysql-trunk openxs$ bzr revision-info
3074 alik@sun.com-20100723121820-jryu2fuw3pc53q9w
[28 Jul 2010 13:08] Alexey Kopytov
Valeriy,

Xcode 3.1 installs /usr/bin/gcc-4.2, but IIRC 4.0.1 is still the default one on 10.5 (at least that's how it is currently setup on my machine after upgrading Xcode). Perhaps you made 4.2 a default compiler (e.g. using gcc_select)?
[28 Jul 2010 13:34] Valeriy Kravchuk
Looks like i did it in a dirty way:

macbook-pro:mysql-trunk openxs$ ls -l /usr/bin/gcc
lrwxr-xr-x  1 root  wheel  7 20 лис  2009 /usr/bin/gcc -> gcc-4.2

Indeed, now I remember that 4.0.1 was still the default, and our manual (http://dev.mysql.com/doc/refman/5.5/en/installing-source.html) says 3.2+ is OK, while it is NOT:

macbook-pro:mysql-trunk openxs$ export CC=/usr/bin/gcc40
macbook-pro:mysql-trunk openxs$ echo $CC
/usr/bin/gcc40
macbook-pro:mysql-trunk openxs$ BUILD/check-cpu 
testing core2 ... failed
[5 Aug 2010 12:32] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/115094

3164 Davi Arnaut	2010-08-05
      Bug#55601: BUILD/check-cpu in mysql-trunk is broken on Mac OS X 10.5
      
      Restore the original behavior of check-cpu with respect to core2.
      It isn't used as a actual target processor type, but as a mean to
      perform other kinds of architecture checks.
[6 Aug 2010 13:46] Davi Arnaut
Queued to 5.5-bugfixing.
[16 Aug 2010 6:30] Bugs System
Pushed into mysql-trunk 5.6.1-m4 (revid:alik@sun.com-20100816062701-qo9dpnk5tkt1pksb) (version source revid:alik@sun.com-20100816062603-xc16eftmv7rmktyq) (merge vers: 5.6.1-m4) (pib:20)
[16 Aug 2010 6:41] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100816062819-bluwgdq8q4xysmlg) (version source revid:alik@sun.com-20100816062612-enatdwnv809iw3s9) (pib:20)
[17 Aug 2010 10:56] MC Brown
A note has been added to the 5.6.1 changelog: 

        The default compiler options used for Mac OS X 10.5 would be set incorrectly.
[20 Aug 2010 14:45] MC Brown
Added to the 5.5.6 changelog