« Keynotes | Main | Project completed »

2007-09-06

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

make

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

Just for the record, SBCL does support threads on OS X. The support is marked experimental (and has been so marked for a long time), so I wouldn't run any production applications with it. But there's a good chance that it would've been stable enough for your development needs.

But this is of course irrelevant, since SBCL was just a secondary option for you, and you already got your primary option to work correctly.

Posted by: Juho Snellman at September 8, 2007 05:21 PM

Hmm... I saw a reference to that, but it wasn't immediately clear to me how to make use of the "experimental" support. SBCL remains a "target" for our stuff (Wilbur + OINK), particularly if the threads business can be taken care of.

Posted by: Ora Lassila at September 9, 2007 01:30 PM

In SBCL's INSTALL file search for :sb-thread; works nicely for me.

Posted by: Ben Hyde at September 10, 2007 05:59 PM

OK, cool, thanks. Coming soon (I think): OINK on SBCL...

Posted by: Ora Lassila at September 11, 2007 08:36 AM

So, what's the current status of wilbur2? Is it going to have clsql storage?

Did you think of using Uncommon Web for rdf-browser since it makes working with ui components holding its state much simpler?

Posted by: Andrey Esipenko at November 5, 2007 08:13 AM

I have a prototypical implementation of MySQL-backed Wilbur triple store, with optimization of path queries to minimum number of SQL queries. After some more testing it should be ready for a release.

As for the Uncommon Web, I learned about that only after I had written the first prototype of OINK. One of these days I will find some time to better understand if/how I could use it.

Posted by: Ora Lassila at November 6, 2007 05:31 PM