Documentation Home
MySQL Connector/ODBC Developer Guide
Related Documentation Download this Manual

MySQL Connector/ODBC Developer Guide  /  Connector/ODBC Installation  /  Building Connector/ODBC from a Source Distribution on OS X

4.6 Building Connector/ODBC from a Source Distribution on OS X

To build the driver on OS X (Darwin), make use of the following configure example:

shell> ./configure --prefix=/usr/local

The command assumes that the unixODBC and MySQL are installed in the default locations. If not, configure accordingly.

On OS X, --enable-shared builds .dylib files by default. You can build .so files like this:

shell> make
shell> cd driver
shell> CC=/usr/bin/gcc \
          $CC -bundle -flat_namespace -undefined error
          -o .libs/ *.o
          -liodbcinst -lmysqlclient -lz -lc

To build the thread-safe driver library:

shell> CC=/usr/bin/gcc \
          $CC -bundle -flat_namespace -undefined error
          -o .libs/ *.o
          -liodbcinst -lmysqlclienti_r -lz -lc -lpthread

Make sure to change the -liodbcinst to -lodbcinst in case of using unixODBC instead of iODBC and configure the libraries path accordingly.

By default, Connector/ODBC is linked statically with the MySQL client library libmysqlclient.a. If you want to link dynamically or to another MySQL client library, use the mysqlclient_lib_name option to supply the client library's name.

In Apple's version of GCC, both cc and gcc are actually symbolic links to gcc3.

Copy this library to the $prefix/lib directory and symlink to

You can cross-check the output shared-library properties using this command:

shell> otool -LD .libs/

User Comments
Sign Up Login You must be logged in to post a comment.