« June 2007 | Main | November 2007 »


MacOS X and x86_64

I am writing this mostly to just document what I did last night, but given how much I struggled, perhaps someone else will find this information useful.

For a long time, my Common Lisp development environment has been OpenMCL with CL-SQL and Portable AllegroServe installed. I tend to use MySQL through CL-SQL, sometimes also SQLite. This environment has been stable and has worked well for me. Recently, however, I switched to an Intel-based MacBook Pro (with a 2.33 GHz Intel Core Duo), requiring me to rethink my development tools.

I really like OpenMCL, having been a user of first CCL back in 1988 or so, then MCL, and now the open source version. There is now a beta version of OpenMCL for Intel-based Macs. It is, however, a 64-bit application ("-arch x86_64"). Funny enough, all the libraries that come with MacOS X 10.4.10, more or less, are 32-bit versions ("-arch i386"), and cannot be used with OpenMCL. Now what...?

I noticed that SBCL, being a 32-bit application, loads the necessary shared libraries (e.g., MySQL client libraries) fine, but the MacOS X version of SBCL does not support threads, so I couldn't install AllegroServe. OpenMCL ran AllegroServe fine, but I couldn't load the shared foreign libraries. For a while I played with Allegro (which did both things fine). I did, however, desire to go back to OpenMCL.

I couldn't find a version of the MySQL libraries already compiled for MacOS X x86_64, and I had a hard time finding any decent documentation about how to compile them myself from source. So finally I just had to figure it out myself. It took some reading of GCC and MySQL documentation, but it now seems that the following will do it (execute this in the root of the MySQL source distribution directory):

export CC=gcc
export CFLAGS="-arch x86_64 -g -Os -fno-omit-frame-pointer" 
export CPPFLAGS="" 
export CXX=gcc
export CXXFLAGS="-arch x86_64 -g -Os -fno-omit-frame-pointer -fno-exceptions -fno-rtti" 

./configure --prefix=/usr/local/mysql --with-extra-charsets=complex --enable-local-infile \
--disable-dependency-tracking --enable-thread-safe-client --enable-largefile \
--with-big-tables --with-unix-socket-path=/tmp/mysql.sock --with-ndb-shm \
--with-ndb-port --with-ndb-port-base --with-comment --with-gnu-ld


sudo make install

Now life is back to normal again, and I have my development environment the way I want it.

Posted by ora at 20:43 | Comments (6)