views:

80

answers:

1

Before running "sudo port install mysqlxx +universal", I installed the universal variant of mysql5.

... checking whether -lm is needed to use C math functions... no

checking whether -lsocket is needed... no

checking whether -lnsl is needed... no

checking for MySQL library directory... /opt/local/lib/mysql5/mysql

checking for MySQL include directory... /opt/local/include/mysql5/mysql

checking if we can link to MySQL C API library directly... no

checking zlib.h usability... yes

checking zlib.h presence... yes

checking for zlib.h... yes

checking for gzread in -lz... yes

checking whether adding -lz will let MySQL C API link succeed... no

configure: error: Unable to link to MySQL client library!

A: 

I suspect what's going on here is that you're running Snow Leopard. In previous versions of OS X, the default C++ compiler built 32-bit executables by default, but this changed to 64-bit in Snow Leopard. This can cause link problems with the MySQL C API library if it's not built as a Universal library supporting both 64- and 32-bit executables.

There are a bunch of ways around this problem, but most of the ones I know about either won't work with MacPorts or I don't know how to make them work. I've added a section on this to the MySQL++ README for Mac OS X, which you can read online, here.

Perhaps you can figure out how to adapt these solutions to the MacPorts build system. Something like this might work:

CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32 sudo port install mysqlxx +universal

That depends on those environment variables making it through the sudo and port barriers. You might have to get trickier. For instance:

sudo -s
CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32 port install mysqlxx +universal

As I commented above, it might be simplest to just build from the source tarball.

Warren Young