Library not found for -lmysqlclient after Maverick

2019-09-01 12:47发布

问题:

I have been running the MySQL C API on Lion for some time and now just upgraded to 10.9.3 Mavericks. When I build my project, XCode says “Build succeeded” but then it suffers a “0 dyld_fatal_error” with the message “dyld: Library not loaded: libmysqlclient.18.dylib” … Reason: image not found.”

In fact, libmysqlclient.18.dylib is still in the /usr/local/mysql/lib/ directory where it always was. Nothing has changed but the upgrade to Mavericks. XCode’s build settings also are the same: (Header Search Paths: /usr/local/mysql/include; Library Search Paths: /usr/local/mysql/lib; Other Linker Flags: -lmysqlclient -lm -lz).

Why would this be happening? Thanks for any suggestions.

回答1:

Answer found:

ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib

This wasn't necessary with Lion, but (for me at least) it is with Mavericks.