Building MySql 5.5.14 at Mac Os X 10.7 Lion with Xcode 4

Building MySql 5.5.14 at Mac Os X 10.7 Lion with Xcode 4

When I updated my Mac Os X to the 10.7 version, I have two very dispointed surprises:
First, the “old” Xcode 4 was not running, it is necessary to update to a newer version, a very nice 3 Gb download.
Second, you open the Xcode, choice to build/install and when you run the mysqld, seg fault!

You spend 1 hours trying to figure out what happend, checking configuration, debugging, and you find and weird error when using pthread.

What is happened:
Xcode 4.1 pthread library was a bug (or feature) that the pthread_init function is not exported or exists, I do not know very well.

How to fix:
Open the configure.cmake file from the MySql source, go to the line 394, that should be:
CHECK_FUNCTION_EXISTS (pthread_init HAVE_PTHREAD_INIT)

change it to:

IF (NOT CMAKE_OSX_SYSROOT)
CHECK_FUNCTION_EXISTS (pthread_init HAVE_PTHREAD_INIT)
ENDIF (NOT CMAKE_OSX_SYSROOT)

Generate again the configurations for Xcode:
cmake . -G “Xcode”

Open the project at the Xcode, build install or run the mysqld and be happy :-)

Ps: I tested with MySql 5.5.14 and Xcode 4.1

source: https://github.com/mxcl/homebrew/issues/6277
https://github.com/CharlieRoot/homebrew/blob/44db2406d3d71cb5882627581a7dee1c4acbe0a6/Library/Formula/mysql.rb

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s