Compiling Q4M on OS X

Posted by chetan on May 11, 2011 in computers suck

I recently compiled Q4M on my Mac and I’m documenting it here now because it proved to be somewhat painful so hopefully you’ll avoid a bit of grief by reading this.

First off, you need MySQL Server. I’ve been using MacPorts for some time now, so this is installed via ports. Unfortunately, it seems to be a pretty barebones config so I had to create a custom variant to add the necessary --with-fast-mutexes option. You can grab my modified Portfile from github. Just clone it into some directory and then add that path into /opt/local/etc/macports/sources.conf before the rsync line. Once you have that, go ahead and reinstall MySQL:

$ sudo port install mysql5 +fast_mutexes

Q4M also requires access to the MySQL sources, so let’s get those unpacked:

$ cd /tmp
$ tar -xzf /opt/local/var/macports/distfiles/mysql5/mysql-5.1.57.tar.gz

Once that’s done, follow these steps to get Q4M compiled:

$ cd /opt/local/include
$ sudo ln -s mysql5/mysql 
$ ./configure --with-mysql=/tmp/mysql-5.1.57 \
$ CPATH=/opt/local/include/mysql \
   LIBRARY_PATH=/opt/local/lib/mysql5/mysql \
$ sudo mv /opt/local/lib/libqueue_engine.* \
# Final step, tell mysql to install the engine
$ mysql -uroot < support-files/install.sql

If after all that you’re still having problems, maybe you’ll have better luck with these Japanese instructions.