On the eve of 2010.. and your boss wants to stick to these MacOS X 10.5 machines, too stubborn or chicken to upgrade. Some developers still have their old PowerBook laptops and they need MySQL flying on PowerPC machines. To top it all, one guy said he wanted to have 32 and 64-bit in one bite. Sigh .. But there is an easy way out! A universal binary!
This post shows you a way to create MySQL universal binaries using MacOS X 10.6 so you can run them on MacOS X 10.5/10.6 whether it is PowerPC or Intel, or 32bit or 64bit.
- You have MacOS X 10.6 with latest Xcode (fully) installed.
- The MySQL source unpacked somewhere. Get it on the MySQL download website under Source Downloads, package named
Compressed GNU TAR archive (tar.gz).
- And some nerves for when the build process fails.
Most complete Universal Binary
First, here is away to build MySQL so it runs on MacOS X 10.5 Intel/PowerPC and 10.6 32 or 64-bit.
Here is the source of the build script names
build.sh. Executed it while located inside the source directory of MySQL.
SDK=”-isysroot /Developer/SDKs/MacOSX10.5.sdk” SDKLIB=”-Wl,-syslibroot,/Developer/SDKs/MacOSX10.5.sdk” export MACOSX_DEPLOYMENT_TARGET=”10.5” PREFIX=/opt/mysql/mysql-5.1.42-universal-macosx-10.5
ARCH=”-arch i386 -arch x86_64 -arch ppc”
export CFLAGS=”-O2 -fPIC $ARCH $SDK” export CXXFLAGS=”-O2 -fPIC $ARCH $SDK” export LDFLAGS=”$ARCH $SDKLIB”
CC=”/usr/bin/gcc-4.2” CXX=”/usr/bin/g++-4.2” OBJC=”/usr/bin/gcc-4.2”
./configure –prefix=$PREFIX \ –disable-dependency-tracking \ –mandir=$PREFIX/share/man –infodir=$PREFIX/share/info \ –localstatedir=$PREFIX/var/ –libdir=$PREFIX/lib \ –bindir=$PREFIX/bin –libexecdir=$PREFIX/bin \ –includedir=$PREFIX/include \ –datadir=$PREFIX/share/ –sysconfdir=$PREFIX/etc \ –with-extra-charsets=complex \ –with-mysqld-user=mysql \ –without-docs \ –with-plugins=all \ –enable-thread-safe-client –without-embedded-server \ –with-pic –with-libedit
if [ $? -eq 0 ]; then make clean time make -j 2 fi ```
Here is what
file shows for the
$ file sql/mysqld
sql/mysqld: Mach-O universal binary with 3 architectures
sql/mysqld (for architecture i386): Mach-O executable i386
sql/mysqld (for architecture x86_64): Mach-O 64-bit executable x86_64
sql/mysqld (for architecture ppc7400): Mach-O executable ppc
These binaries were tested and work on MacOS X 10.6 Intel and MacOS X 10.5 PowerPC.
32/64-bit Universal binaries for MacOS X 10.6
Same as above, but with the following changes:
Setting the above is probably not needed when you are already on a Mac running 10.6, but it doesn’t hurt to be explicit.
Need it for MacOS X 10.4?
I gave this a spin:
ARCH="-arch i386 -arch ppc"
But it failed with
error: stdarg.h: No such file or directory
.. but I lack intrest making stuff for MacOS X 10.4 (Tiger). Consider this your homework!
If you like to leave a comment, but don't like to use Disqus, please send an email instead. Comments by email might end up as a FAQ here under.