Bug #70542 MySQL does not compile on OSX 10.9 GM
Submitted: 7 Oct 2013 11:00 Modified: 13 Nov 2013 23:47
Reporter: Roderik van der Veer Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S1 (Critical)
Version:5.6.13 OS:MacOS (10.9GM, XCode 5.0.1GM, CLT GM)
Assigned to: CPU Architecture:Any

[7 Oct 2013 11:00] Roderik van der Veer
Description:
MySQL does not compile (using Homebrew)

If fails with

make[2]: *** [storage/archive/CMakeFiles/archive.dir/ha_archive.cc.o] Error 1
make[1]: *** [storage/archive/CMakeFiles/archive.dir/all] Error 2
make: *** [all] Error 2

Full output and all relevant settings: https://gist.github.com/roderik/6865926

How to repeat:
Every time
[7 Oct 2013 13:24] MySQL Verification Team
Thank you for the bug report. I couldn't repeat on 10.8:

[10:22:10][pochita:]mysql-5.6.13 miguel$ sql/Debug//mysqld --version
sql/Debug//mysqld  Ver 5.6.13-debug for osx10.8 on x86_64 (Source distribution)
[10:22:44][pochita:]mysql-5.6.13 miguel$
[7 Oct 2013 13:26] MySQL Verification Team
compile success

Attachment: mysql-5.6.13-compiled.png (image/png, text), 275.96 KiB.

[7 Oct 2013 14:16] Roderik van der Veer
I see you compiled from Xcode, i'm compiling commandline with 

cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/mysql/5.6.13 -DMYSQL_DATADIR=/usr/local/var/mysql -DINSTALL_MANDIR=/usr/local/Cellar/mysql/5.6.13/share/man -DINSTALL_DOCDIR=/usr/local/Cellar/mysql/5.6.13/share/doc/mysql -DINSTALL_INFODIR=/usr/local/Cellar/mysql/5.6.13/share/info -DINSTALL_MYSQLSHAREDIR=share/mysql -DWITH_SSL=yes -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DSYSCONFDIR=/usr/local/etc -DWITH_UNIT_TESTS=OFF -DWITH_READLINE=yes

It fails only on OSX 10.9 Mavericks, the GM release. 

I was asked to open the bug report here by the maintainers of Homebrew: https://github.com/mxcl/homebrew/issues/23098 There is some more input and references to other people with the same problem there.
[7 Oct 2013 16:03] Misty De Meo
According to user reports, it appears this may specifically be an issue compiling mysql with libc++. In 10.9, libc++ is now the default C++ stdlib, whereas libstdc++ was the default in all older versions of OS X. If that's the case, you should be able to reproduce on 10.8 by building using clang and using libc++ by adding the -stdlib=libc++ flag.
[23 Oct 2013 13:16] MySQL Verification Team
Thank you for the feedback. Update my OS to Mavericks and then got the error compiling reported:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:964:38: error: expected ')'
    template <class _Up> static char test(typename _Up::pointer* = 0);
                                     ^
/Users/miguel/temp/mysql-5.6.13/include/my_global.h:464:23: note: expanded from macro 'test'
#define test(a)         ((a) ? 1 : 0)
                             ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:964:38: note: to match this '('
/Users/miguel/temp/mysql-5.6.13/include/my_global.h:464:18: note: expanded from macro 'test'
#define test(a)         ((a) ? 1 : 0)
                        ^
In file included from /Users/miguel/temp/mysql-5.6.13/storage/archive/ha_archive.cc:21:
In file included from /Users/miguel/temp/mysql-5.6.13/sql/sql_class.h:27:
In file included from /Users/miguel/temp/mysql-5.6.13/sql/log.h:19:
In file included from /Users/miguel/temp/mysql-5.6.13/sql/unireg.h:170:
In file included from /Users/miguel/temp/mysql-5.6.13/sql/structs.h:23:
In file included from /Users/miguel/temp/mysql-5.6.13/sql/sql_plugin.h:20:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/vector:261:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/__bit_reference:15:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/algorithm:594:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:969:69: error: no member named 'test' in namespace
      'std::__1::__has_pointer_type_imp'
    : public integral_constant<bool, sizeof(__has_pointer_type_imp::test<_Tp>(0)) == 1>
                                            ~~~~~~~~~~~~~~~~~~~~~~~~^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:969:74: error: '_Tp' does not refer to a value
    : public integral_constant<bool, sizeof(__has_pointer_type_imp::test<_Tp>(0)) == 1>
                                                                         ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:967:17: note: declared here
template <class _Tp>
                ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:970:1: error: expected class name
{
^
8 errors generated.
make[2]: *** [storage/archive/CMakeFiles/archive.dir/ha_archive.cc.o] Error 1
make[1]: *** [storage/archive/CMakeFiles/archive.dir/all] Error 2
make: *** [all] Error 2
[11:12:30][Pochita:]mysql-5.6.13 miguel$
[28 Oct 2013 16:51] MySQL Verification Team
http://bugs.mysql.com/bug.php?id=70751 marked as duplicate of this one.
[30 Oct 2013 5:27] David Peixotto
patch to fix build off of 5.6 branch

Attachment: fix-build-on-macosx-9.patch (application/octet-stream, text), 93.30 KiB.

[30 Oct 2013 5:28] David Peixotto
There seems to be some conflict with the "test" macro defined in include/my_global.h. I uploaded a patch that renames the test macro to mysql_test. That fixes the build for me on mac osx 9.
[13 Nov 2013 23:47] Paul DuBois
Noted in 5.6.15, 5.7.3 changelogs.

MySQL did not compile on Mac OS X 10.9 (Mavericks).