Solving library not found for -lmysqlclient_r on Mac OS X

I was recently trying to install node-libmysqlclient on Mac OS X but was running into a build error saying “library not found for -lmysqlclient_r”.

ld: library not found for -lmysqlclient_r
collect2: ld returned 1 exit status
make: *** [Release/mysql_bindings.node] Error 1
ERR! Error: `make` failed with exit code: 2

I went through quite a bit to figure this out. First posted on Stack Overflow, then filed an issue with the developer who recommended some things to try.

After finding this stack overflow post, I realized that libmysqlclient_r is no longer provided, but should just be linked to the normal libmysqlclient.

Run the following symlink commands and the build should succeed:

sudo ln -s /usr/local/mysql/lib/mysql/libmysqlclient.a /usr/local/mysql/lib/mysql/libmyqslclient_r.a
sudo ln -s /usr/local/mysql/lib/mysql/libmysqlclient.la /usr/local/mysql/lib/mysql/libmyqslclient_r.la
sudo ln -s /usr/local/mysql/lib/mysql/libmysqlclient.15.dylib /usr/local/mysql/lib/mysql/libmysqlclient_r.dylib

Simple, after hours of Google-ing.

Possibly related posts:

  1. Sharing a Snippets Library through Dropbox
  2. Missing mysql.sock on Mac OS X
  3. Install Apache, MySQL, and PHP on OS X (10.5)

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment