Skip to content
This repository

Library not found error on OS X #129

Closed
botskonet opened this Issue May 17, 2012 · 12 comments

3 participants

Mike Botsko Oleg Efimov Akzhan Abdulin
Mike Botsko

I'm getting an error trying to install this via npm and I can't tell what the problem is. I posted to stack overflow with the details and one user confirms he sees the same issue.

http://stackoverflow.com/questions/10640636/npm-package-build-failing-how-best-to-debug

$ npm install mysql-libmysqlclient
npm http GET https://registry.npmjs.org/mysql-libmysqlclient
npm http 304 https://registry.npmjs.org/mysql-libmysqlclient

> mysql-libmysqlclient@1.3.3 install /Users/botskonet/node_modules/mysql-libmysqlclient
> node-gyp rebuild

info it worked if it ends with ok 
spawn python [ '/Users/botskonet/.node-gyp/0.6.12/tools/gyp_addon',
  'binding.gyp',
  '-I/Users/botskonet/node_modules/mysql-libmysqlclient/build/config.gypi',
  '-f',
  'make' ]
spawn make [ 'BUILDTYPE=Release', '-C', 'build' ]
  CXX(target) Release/obj.target/mysql_bindings/src/mysql_bindings.o
  CXX(target) Release/obj.target/mysql_bindings/src/mysql_bindings_connection.o
  CXX(target) Release/obj.target/mysql_bindings/src/mysql_bindings_result.o
  CXX(target) Release/obj.target/mysql_bindings/src/mysql_bindings_statement.o
  SOLINK_MODULE(target) Release/mysql_bindings.node
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
    at Array.0 (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:176:25)
    at EventEmitter._tickCallback (node.js:192:40)
ERR! not ok

npm ERR! mysql-libmysqlclient@1.3.3 install: `node-gyp rebuild`
npm ERR! `sh "-c" "node-gyp rebuild"` failed with 1
npm ERR! 
npm ERR! Failed at the mysql-libmysqlclient@1.3.3 install script.
npm ERR! This is most likely a problem with the mysql-libmysqlclient package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls mysql-libmysqlclient
npm ERR! There is likely additional logging output above.
npm ERR! 
npm ERR! System Darwin 11.3.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "mysql-libmysqlclient"
npm ERR! cwd /Users/botskonet/Sites/SportsBuddies
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.15
npm ERR! code ELIFECYCLE
npm ERR! message mysql-libmysqlclient@1.3.3 install: `node-gyp rebuild`
npm ERR! message `sh "-c" "node-gyp rebuild"` failed with 1
npm ERR! errno {}
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/botskonet/Sites/SportsBuddies/npm-debug.log
npm not ok
Oleg Efimov
Owner
Sannis commented May 17, 2012

Look at the dependencies section in README and issues #107. To build mysql-libmysqlclient you should install both libmysqlclient and development headers for it, add path to your MySQL bin dir to $PATH and path to your MySQL lib dir to $DYLD_LIBRARY_PATH.

Mike Botsko

I've already done so. Mysql was install manually on my Mac just as I would our servers. It was ./configure'd, installed, and php was built against it so I know the header files are available. I've made sure that both the PATH and DYLD_LIBRARY_PATH are accurate yet the build of this still fails, same error.

Oleg Efimov
Owner
Sannis commented May 17, 2012

Please show me output of mysql_config --libs_r.

Mike Botsko

-L/usr/local/mysql/lib/mysql -lmysqlclient_r -lz -lm

Oleg Efimov
Owner
Sannis commented May 18, 2012

Please ensure that /usr/local/mysql/lib/mysql contains libmysqlclient_r* libs and show me your build/config.gypi and build/Makefile.

Oleg Efimov
Owner
Sannis commented May 18, 2012

To do this you should git clone this repo and run npm install in it.

Mike Botsko

Output of the mysql lib directory, the requested files:

http://pastie.org/private/uuacbtxdraqenriwfxekg

Mike Botsko

Any hope? I'm struggling to make this work because I need it to do work on an existing project.

Mike Botsko

Based on the last comment in this thread (http://stackoverflow.com/questions/4486584/what-is-difference-between-libmysqlclient-a-and-libmysqlclient-r-a) I tried linking the libs as the user suggested but it didn't work.

"Newer versions of the MySQL client distributions do not include the "_r" version. Some may have a symbolic link from libmyqslclient_r.a to libmyqslclient.a"

So if I don't have the _r - what should I do?

Mike Botsko

It seems that I needed all three items symlinked, so I did:

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

And now it builds just fine.

Mike Botsko botskonet closed this May 21, 2012
Akzhan Abdulin
akzhan commented May 21, 2012

Hm, I suppose that *_r "reentrant" libraries should be not used anymore due to its absence.

Oleg Efimov
Owner
Sannis commented May 22, 2012

@botskonet thanks for your investigation!

I'll look into MySQL changelog and try to make binding.gyp compatible with newer versions. Nevertheless, if your mysql_config --libs_r suggests to use -lmysqlclient_r flag, it looks more as bug in MySQL Makefile that forgot ot create symlinks.

Oleg Efimov Sannis reopened this May 22, 2012
Oleg Efimov Sannis closed this May 22, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.