Error while install via NPM #1

Closed
williamvivier opened this Issue May 13, 2011 · 41 comments

Comments

Projects
None yet
8 participants

db-mysql@0.4.1 install /var/nodejs/node_modules/db-mysql
node-waf configure build

Checking for program g++ or c++ : /usr/bin/g++
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Checking for node path : not found
Checking for node prefix : ok /usr/local
/bin/sh: mysql_config: command not found
Traceback (most recent call last):
File "/usr/local/bin/node-waf", line 16, in
Scripting.prepare(t, os.getcwd(), VERSION, wafdir)
File "/usr/local/bin/../lib/node/wafadmin/Scripting.py", line 145, in prepare
prepare_impl(t, cwd, ver, wafdir)
File "/usr/local/bin/../lib/node/wafadmin/Scripting.py", line 135, in prepare_
impl
main()
File "/usr/local/bin/../lib/node/wafadmin/Scripting.py", line 188, in main
fun(ctx)
File "/usr/local/bin/../lib/node/wafadmin/Scripting.py", line 241, in configur
e
conf.sub_config([''])
File "/usr/local/bin/../lib/node/wafadmin/Configure.py", line 221, in sub_conf
ig
self.recurse(k, name='configure')
File "/usr/local/bin/../lib/node/wafadmin/Utils.py", line 634, in recurse
f(self)
File "/var/nodejs/node_modules/db-mysql/wscript", line 35, in configure
conf.env.append_unique('CXXFLAGS', Utils.cmd_output(Options.options.mysql_co
nfig + ' --include').split())
File "/usr/local/bin/../lib/node/wafadmin/Utils.py", line 453, in cmd_output
raise ValueError(msg)
ValueError: command execution failed: mysql_config --include -> ''
npm ERR! error installing db-mysql@0.4.1 Error: db-mysql@0.4.1 install: node-wa f configure build
npm ERR! error installing db-mysql@0.4.1 sh "-c" "node-waf configure build" fa
iled with 1
npm ERR! error installing db-mysql@0.4.1 at ChildProcess. (/usr/l
ocal/lib/node_modules/npm/lib/utils/exec.js:49:20)
npm ERR! error installing db-mysql@0.4.1 at ChildProcess.emit (events.js:67:
17)
npm ERR! error installing db-mysql@0.4.1 at ChildProcess.onexit (child_proce
ss.js:192:12)
npm ERR! db-mysql@0.4.1 install: node-waf configure build
npm ERR! sh "-c" "node-waf configure build" failed with 1
npm ERR!
npm ERR! Failed at the db-mysql@0.4.1 install script.
npm ERR! This is most likely a problem with the db-mysql package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-waf configure build
npm ERR! You can get their info via:
npm ERR! npm owner ls db-mysql
npm ERR! There is likely additional logging output above.
npm ERR!
npm ERR! System Linux 2.6.38.2-grsec-xxxx-grs-ipv6-64
npm ERR! command "node" "/usr/local/bin/npm" "install" "db-mysql"
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /var/nodejs/npm-debug.log
npm not ok

Owner

mariano commented May 13, 2011

Do you have the mysql binaries in your path? If so, what does this return:

$ which mysql_config

For example assuming your mysql_config is in /usr/local/bin try doing:

$ node-waf --mysql-config=/usr/local/bin/mysql_config configure build

Let me know how it goes

mariano was assigned May 13, 2011

$ which mysql_config

Doesn't return anything...

Owner

mariano commented May 13, 2011

That means you don't have the MySQL binaries in your path.

Do you have the mysql client installed in that computer?

I had the same issue. After adding to my path, I got this error:

Checking for library mysqlclient_r : not found, try to find nonthreadsafe libmysqlclient
Checking for library mysqlclient : not found
/node_modules/mysql-libmysqlclient/wscript:47: error: Missing both libmysqlclient_r and libmysqlclient from libmysqlclient-devel or mysql-devel package

Any idea on how to get these on libraries on OSX?

Owner

mariano commented May 13, 2011

If you have mysql_config, it means you have the client, so the libraries should be there. Do you know where MySQL is installed?

Owner

mariano commented May 13, 2011

@snowtorius: I think in OSX MySQL is installed by default in /usr/local/mysql. Could you do a:

$ ls -la /usr/local/mysql

lrwxr-xr-x 1 root wheel 27 Mar 22 2010 /usr/local/mysql -> mysql-5.1.37-osx10.5-x86_64

I found the libraries. How do I tell npm where to look for them? Thanks!

Owner

mariano commented May 13, 2011

If you specify the right path to the mysql_config it should figure out the path by itself.

Try running the following (specify the path to mysql_config if its not in your env path):

$ mysql_config --libs_r

That provides the following:
-L/Applications/MAMP/Library/lib/mysql -lmysqlclient_r -lz -lm

Owner

mariano commented May 13, 2011

Strange, then the library seems to be there. Ok try this:

$ ls -la /Applications/MAMP/Library/lib/mysql/libmysqlclient_r*

That gives me:

-rwxrwxr-x@ 1 digiuser admin 926 Mar 6 2010 /Applications/MAMP/Library/lib/mysql/libmysqlclient_r.la

Owner

mariano commented May 13, 2011

Wicked. Ok here's a freaky request. I'll need you to comment out the part in the node-waf script that aborts if the library is not found. Let's see if it's just the check that's failing.

Edit the file wscript that is in your db-mysql directory, and comment out (by adding the # character at the beggining of the line) lines 38 through 44. So this block of code should be commented out:

if not conf.check_cxx(lib="mysqlclient_r", errmsg="not found, try to find nonthreadsafe libmysqlclient"): # link flags are needed to find the libraries conf.env.append_unique('LINKFLAGS', Utils.cmd_output(Options.options.mysql_config + ' --libs').split()) if conf.check_cxx(lib="mysqlclient"): conf.env.append_unique('CXXDEFINES', ["MYSQL_NON_THREADSAFE"]) else: conf.fatal("Missing both libmysqlclient_r and libmysqlclient from libmysqlclient-devel or mysql-devel package")

Then, ASSUMING that /usr/local/mysql/bin/mysql_config is the path to your mysql_config binary, run:

$ node-waf --mysql-config=/usr/local/mysql/bin/mysql_config configure build

node-waf --mysql-config=/usr/local/mysql/bin/mysql_config configure build
Checking for program g++ or c++ : /usr/bin/g++
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Checking for node path : ok /usr/local/lib/node
Checking for node prefix : ok /usr/local/Cellar/node/0.4.7
'configure' finished successfully (0.399s)
Waf: Entering directory myproject/node-db-mysql/build' Waf: Leaving directorymyproject/node-db-mysql/build'
source not found: 'lib/node-db/binding.cc' in 'myproject/node-db-mysql'

Owner

mariano commented May 13, 2011

Ok what the heck, it should totally find the source files. You are standing in the node_modules/db-mysql directory that got created as a result of the npm install right? I just did:

$ mkdir ~/test
$ cd ~/test
$ npm install db-mysql
$ cd node_modules/db-mysql
$ node-waf configure build

And it succeeds, so I'm trying to pinpoint where the issue is for you

How can I find the path of mysql_config?

Thanks,

Owner

mariano commented May 13, 2011

vwilliam: What OS are you on? First do:

$ ls /usr/local/mysql

See if that shows anything.

Otherwise you are left with

$ cd /
$ find -name mysql_config -type f

Owner

mariano commented May 13, 2011

@snowtorius: Could you try the following? First add the path to mysql_config to your PATH:

$ export PATH=/usr/local/mysql/bin:$PATH

Then do a fresh install of db-mysql (it should download 0.4.2):

$ cd ~/
$ mkdir test
$ cd test
$ npm install db-mysql

Let me know how this goes

My OS is Ubuntu 11.04
I installed mysql with the command "apt-get install mysql-server"

$ ls /usr/local/mysql

I dont have this directory..

and:
$ cd /
$ find -name mysql_config -type f

doing nothing...

Owner

mariano commented May 13, 2011

@vwilliam: I'm updating the Ubuntu copy I have on VirtualBox (I use ArchLinux). I'll let you know what I find shortly

@mariano: That got me through the configure phase, but now I'm getting errors on build:

npm install db-mysql

db-mysql@0.4.3 preinstall /myproject/node_modules/db-mysql
node-waf configure

Checking for program g++ or c++ : /usr/bin/g++
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Checking for node path : ok /usr/local/lib/node
Checking for node prefix : ok /usr/local/Cellar/node/0.4.7
Checking for library mysqlclient_r : yes
'configure' finished successfully (1.430s)

db-mysql@0.4.3 install /myproject/node_modules/db-mysql
node-waf build

Waf: Entering directory /myproject/node_modules/db-mysql/build' [ 1/11] cxx: lib/node-db/binding.cc -> build/default/lib/node-db/binding_1.o [ 2/11] cxx: lib/node-db/connection.cc -> build/default/lib/node-db/connection_1.o [ 3/11] cxx: lib/node-db/exception.cc -> build/default/lib/node-db/exception_1.o [ 4/11] cxx: lib/node-db/query.cc -> build/default/lib/node-db/query_1.o [ 5/11] cxx: lib/node-db/result.cc -> build/default/lib/node-db/result_1.o [ 6/11] cxx: src/connection.cc -> build/default/src/connection_1.o In file included from ../src/connection.cc:2: ../src/./connection.h:5:25: error: mysql/mysql.h: No such file or directory In file included from ../src/./connection.h:8, from ../src/connection.cc:2: ../src/././result.h:16: error: expected ‘,’ or ‘...’ before ‘&’ token ../src/././result.h:16: error: ISO C++ forbids declaration of ‘MYSQL_FIELD’ with no type ../src/././result.h:28: error: expected)' before ‘’ token
../src/././result.h:48: error: ISO C++ forbids declaration of ‘MYSQL’ with no type
../src/././result.h:48: error: expected ‘;’ before ‘
’ token
../src/././result.h:49: error: ISO C++ forbids declaration of ‘MYSQL_RES’ with no type
../src/././result.h:49: error: expected ‘;’ before ‘’ token
In file included from ../src/connection.cc:2:
../src/./connection.h:22: error: ISO C++ forbids declaration of ‘MYSQL’ with no type
../src/./connection.h:22: error: expected ‘;’ before ‘
’ token
../src/connection.cc: In constructor ‘node_db_mysql::Connection::Connection()’:
../src/connection.cc:5: error: class ‘node_db_mysql::Connection’ does not have any field named ‘connection’
../src/connection.cc:6: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:6: error: expected type-specifier before ‘MYSQL’
../src/connection.cc:6: error: expected ;' before ‘MYSQL’ ../src/connection.cc:7: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’ ../src/connection.cc:10: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’ ../src/connection.cc:10: error: ‘mysql_init’ was not declared in this scope ../src/connection.cc: In destructor ‘virtual node_db_mysql::Connection::~Connection()’: ../src/connection.cc:15: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’ ../src/connection.cc:16: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’ ../src/connection.cc: In member function ‘virtual void node_db_mysql::Connection::open()’: ../src/connection.cc:24: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’ ../src/connection.cc:31: error: ‘mysql_real_connect’ was not declared in this scope ../src/connection.cc:33: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’ ../src/connection.cc:33: error: ‘mysql_error’ was not declared in this scope ../src/connection.cc: In member function ‘virtual void node_db_mysql::Connection::close()’: ../src/connection.cc:39: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’ ../src/connection.cc:39: error: ‘mysql_close’ was not declared in this scope ../src/connection.cc: In member function ‘virtual std::string node_db_mysql::Connection::escape(const std::string&) const’: ../src/connection.cc:50: error: ‘const class node_db_mysql::Connection’ has no member named ‘connection’ ../src/connection.cc:50: error: ‘mysql_real_escape_string’ was not declared in this scope ../src/connection.cc: In member function ‘virtual std::string node_db_mysql::Connection::version() const’: ../src/connection.cc:60: error: ‘const class node_db_mysql::Connection’ has no member named ‘connection’ ../src/connection.cc:60: error: ‘mysql_get_server_info’ was not declared in this scope ../src/connection.cc: In member function ‘virtual node_db::Result* node_db_mysql::Connection::query(const std::string&) const’: ../src/connection.cc:74: error: ‘const class node_db_mysql::Connection’ has no member named ‘connection’ ../src/connection.cc:74: error: ‘mysql_query’ was not declared in this scope ../src/connection.cc:75: error: ‘const class node_db_mysql::Connection’ has no member named ‘connection’ ../src/connection.cc:75: error: ‘mysql_error’ was not declared in this scope ../src/connection.cc:78: error: ‘MYSQL_RES’ was not declared in this scope ../src/connection.cc:78: error: ‘result’ was not declared in this scope ../src/connection.cc:78: error: ‘const class node_db_mysql::Connection’ has no member named ‘connection’ ../src/connection.cc:78: error: ‘mysql_store_result’ was not declared in this scope ../src/connection.cc:83: error: ‘const class node_db_mysql::Connection’ has no member named ‘connection’ Waf: Leaving directorymyproject/node_modules/db-mysql/build'
Build failed: -> task failed (err #1):
{task: cxx connection.cc -> connection_1.o}
npm ERR! error installing db-mysql@0.4.3 Error: db-mysql@0.4.3 install: node-waf build
npm ERR! error installing db-mysql@0.4.3 sh "-c" "node-waf build" failed with 1
npm ERR! error installing db-mysql@0.4.3 at ChildProcess. (/usr/local/lib/node_modules/npm/lib/utils/exec.js:49:20)
npm ERR! error installing db-mysql@0.4.3 at ChildProcess.emit (events.js:67:17)
npm ERR! error installing db-mysql@0.4.3 at ChildProcess.onexit (child_process.js:192:12)

Owner

mariano commented May 13, 2011

@snowtorious: The following:

../src/././result.h:48: error: ISO C++ forbids declaration of ‘MYSQL’ with no type ../src/././result.h:48: error: expected ‘;’ before ‘*’ token

Tells me it's not finding the MySQL include files, which should've worked if mysql_config was used successfully. While still having mysql_config in your path, put yourself in the db-mysql directory (so you should see a wscript file in there), and do:

$ node-waf configure && node-waf build --verbose

What I'm looking for is the -I line used when compiling. For example in my box I see:

17:55:56 runner system command -> ['/usr/bin/g++', '-g', '-Wall', '-I/usr/include/mysql', '-fPIC', '-DPIC', '-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64', '-D_GNU_SOURCE', '-DEV_MULTIPLICITY=0', '-Idefault/lib', '-I../lib', '-I/usr/include/node', '../lib/node-db/connection.cc', '-c', '-o', 'default/lib/node-db/connection_1.o']

As you can see -I/usr/include/mysql is telling where I have my mysql include dir. What do you have? Just take the connection.cc line as I did here.

Any news? :)

Owner

mariano commented May 15, 2011

@vwilliam: Since you are in Ubuntu 11.04 (I have just tried this in my virtual machine), you need to make sure the MySQL devel libraries and binaries are available. So do:

$ sudo apt-get install libmysqlclient-dev

Once you have done that, you can install the latest version of db-mysql (just updated it) wherever you want:

$ npm install db-mysql

I just tried this on a fresh install of Ubuntu 11.04 and it works. So should work for you.

Owner

mariano commented May 15, 2011

@snowtorious: You should now be able to install db-mysql with no issues, making sure mysql_config is in your path. So do the following:

$ export PATH=/usr/local/mysql/bin:$PATH

And then you'll be able to do:

$ npm install db-mysql

Since this solved your problem, and @vwilliam problem was solved in my previous message, I'm closing this ticket.

Please do leave feedback to make sure these solutions work for both of you, or reopen if they didn't.

mariano closed this May 15, 2011

Thanks, it's working now!

iplog commented Jul 3, 2011

Hi!

I'm working with the last MAMP version (my main project is in PHP). I'd like to test your module and I tried to install it.

I've found mysql_config in /Applications/MAMP/Library/bin/mysql_config (mysql is also in /Applications/MAMP/Library/bin/) so I add the following line to my bash_profile:
export MYSQL_CONFIG=/Applications/MAMP/Library/bin/mysql_config
and re source it.

The I tried to install db-mysql through npm with npm install db-mysql command.

I got the following resutls

Checking for program g++ or c++          : /usr/bin/g++ 
Checking for program cpp                 : /usr/bin/cpp 
Checking for program ar                  : /usr/bin/ar 
Checking for program ranlib              : /usr/bin/ranlib 
Checking for g++                         : ok  
Checking for node path                   : not found 
Checking for node prefix                 : ok /Users/iplog/local/node 
Checking for program mysql_config        : /Applications/MAMP/Library/bin/mysql_config 
Checking for library mysqlclient_r       : Missing libmysqlclient_r 
'configure' finished successfully (3.279s)
Waf: Entering directory `/Users/iplog/node_modules/db-mysql/build'
[ 1/11] cxx: lib/node-db/binding.cc -> build/default/lib/node-db/binding_1.o
[ 2/11] cxx: lib/node-db/connection.cc -> build/default/lib/node-db/connection_1.o
[ 3/11] cxx: lib/node-db/exception.cc -> build/default/lib/node-db/exception_1.o
[ 4/11] cxx: lib/node-db/query.cc -> build/default/lib/node-db/query_1.o
[ 5/11] cxx: lib/node-db/result.cc -> build/default/lib/node-db/result_1.o
[ 6/11] cxx: src/connection.cc -> build/default/src/connection_1.o
In file included from ../src/connection.cc:2:
../src/./connection.h:5:19: error: mysql.h: No such file or directory
In file included from ../src/./connection.h:8,
                 from ../src/connection.cc:2:
../src/././result.h:16: error: expected ‘,’ or ‘...’ before ‘&’ token
../src/././result.h:16: error: ISO C++ forbids declaration of ‘MYSQL_FIELD’ with no type
../src/././result.h:28: error: expected `)' before ‘*’ token
../src/././result.h:54: error: ISO C++ forbids declaration of ‘MYSQL’ with no type
../src/././result.h:54: error: expected ‘;’ before ‘*’ token
../src/././result.h:55: error: ISO C++ forbids declaration of ‘MYSQL_RES’ with no type
../src/././result.h:55: error: expected ‘;’ before ‘*’ token
In file included from ../src/connection.cc:2:
../src/./connection.h:43: error: ISO C++ forbids declaration of ‘MYSQL’ with no type
../src/./connection.h:43: error: expected ‘;’ before ‘*’ token
../src/connection.cc: In constructor ‘node_db_mysql::Connection::Connection()’:
../src/connection.cc:11: error: class ‘node_db_mysql::Connection’ does not have any field named ‘connection’
../src/connection.cc: In member function ‘virtual bool node_db_mysql::Connection::isAlive(bool)’:
../src/connection.cc:57: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:57: error: ‘mysql_ping’ was not declared in this scope
../src/connection.cc: In member function ‘virtual void node_db_mysql::Connection::open()’:
../src/connection.cc:65: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:65: error: ‘mysql_init’ was not declared in this scope
../src/connection.cc:66: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:71: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:71: error: ‘MYSQL_SET_CHARSET_NAME’ was not declared in this scope
../src/connection.cc:71: error: ‘mysql_options’ was not declared in this scope
../src/connection.cc:75: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:75: error: ‘MYSQL_OPT_COMPRESS’ was not declared in this scope
../src/connection.cc:75: error: ‘mysql_options’ was not declared in this scope
../src/connection.cc:79: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:79: error: ‘MYSQL_INIT_COMMAND’ was not declared in this scope
../src/connection.cc:79: error: ‘mysql_options’ was not declared in this scope
../src/connection.cc:83: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:83: error: ‘MYSQL_OPT_READ_TIMEOUT’ was not declared in this scope
../src/connection.cc:83: error: ‘mysql_options’ was not declared in this scope
../src/connection.cc:90: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:90: error: ‘MYSQL_OPT_SSL_VERIFY_SERVER_CERT’ was not declared in this scope
../src/connection.cc:90: error: ‘mysql_options’ was not declared in this scope
../src/connection.cc:93: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:93: error: ‘MYSQL_OPT_CONNECT_TIMEOUT’ was not declared in this scope
../src/connection.cc:97: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:97: error: ‘MYSQL_OPT_WRITE_TIMEOUT’ was not declared in this scope
../src/connection.cc:101: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:108: error: ‘mysql_real_connect’ was not declared in this scope
../src/connection.cc:116: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:116: error: ‘mysql_error’ was not declared in this scope
../src/connection.cc: In member function ‘virtual void node_db_mysql::Connection::close()’:
../src/connection.cc:122: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:122: error: ‘mysql_close’ was not declared in this scope
../src/connection.cc: In member function ‘virtual std::string node_db_mysql::Connection::escape(const std::string&) const’:
../src/connection.cc:133: error: ‘const class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:133: error: ‘mysql_real_escape_string’ was not declared in this scope
../src/connection.cc: In member function ‘virtual std::string node_db_mysql::Connection::version() const’:
../src/connection.cc:141: error: ‘const class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:141: error: ‘mysql_get_server_info’ was not declared in this scope
../src/connection.cc: In member function ‘virtual node_db::Result* node_db_mysql::Connection::query(const std::string&) const’:
../src/connection.cc:150: error: ‘const class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:150: error: ‘mysql_real_query’ was not declared in this scope
../src/connection.cc:151: error: ‘const class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:151: error: ‘mysql_error’ was not declared in this scope
../src/connection.cc:154: error: ‘const class node_db_mysql::Connection’ has no member named ‘connection’
Waf: Leaving directory `/Users/iplog/node_modules/db-mysql/build'
Build failed:  -> task failed (err #1): 
    {task: cxx connection.cc -> connection_1.o}
npm ERR! error installing db-mysql@0.6.7 Error: db-mysql@0.6.7 install: `node-waf configure build`
npm ERR! error installing db-mysql@0.6.7 `sh "-c" "node-waf configure build"` failed with 1
npm ERR! error installing db-mysql@0.6.7     at ChildProcess.<anonymous> (/Users/iplog/local/node/lib/node_modules/npm/lib/utils/exec.js:49:20)
npm ERR! error installing db-mysql@0.6.7     at ChildProcess.emit (events.js:67:17)
npm ERR! error installing db-mysql@0.6.7     at ChildProcess.onexit (child_process.js:192:12)

> db-mysql@0.6.7 preuninstall /Users/iplog/node_modules/db-mysql
> rm -rf build/*

npm ERR! db-mysql@0.6.7 install: `node-waf configure build`
npm ERR! `sh "-c" "node-waf configure build"` failed with 1
npm ERR! 
npm ERR! Failed at the db-mysql@0.6.7 install script.
npm ERR! This is most likely a problem with the db-mysql package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-waf configure build
npm ERR! You can get their info via:
npm ERR!     npm owner ls db-mysql
npm ERR! There is likely additional logging output above.
npm ERR! 
npm ERR! System Darwin 10.8.0
npm ERR! command "node" "/Users/iplog/local/node/bin/npm" "install" "db-mysql"
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/iplog/npm-debug.log
npm not ok

Moreover, the mysql_config --libs_r command gives me : -L/Applications/MAMP/Library/lib -lmysqlclient_r -lpthread -lz

I'd like not install another mysql version and keep my MAMP version. What can I do ?

Other information that could help :
$ mysql --version
mysql Ver 14.14 Distrib 5.5.9, for osx10.4 (i386) using EditLine wrapper
osX Version: 10.6.8

Owner

mariano commented Jul 3, 2011

That looks like it's not finding the right headers. CD into the db-mysql directory, and post the output of:

$ node-waf configure build --verbose

iplog commented Jul 3, 2011

Thank you for your help! Here is the whole output :

Checking for program g++ or c++          : /usr/bin/g++ 
Checking for program cpp                 : /usr/bin/cpp 
Checking for program ar                  : /usr/bin/ar 
Checking for program ranlib              : /usr/bin/ranlib 
Checking for g++                         : ok  
Checking for node path                   : not found 
Checking for node prefix                 : ok /Users/iplog/local/node 
Checking for program mysql_config        : /Applications/MAMP/Library/bin/mysql_config 
Checking for library mysqlclient_r       : 21:29:46 runner system command -> ['/usr/bin/g++', '-g', '-Wall', '-I/Applications/MAMP/Library/include', '../test.cpp', '-c', '-o', 'default/test_1.o']
21:29:46 runner system command -> ['/usr/bin/g++', 'default/test_1.o', '-o', '/Users/iplog/node_modules/db-mysql/build/.conf_check_0/testbuild/default/testprog', '-L/Applications/MAMP/Library/lib', '-lmysqlclient_r', '-lpthread', '-lz']
Missing libmysqlclient_r 
'configure' finished successfully (0.646s)
Waf: Entering directory `/Users/iplog/node_modules/db-mysql/build'
[ 4/11] cxx: lib/node-db/query.cc -> build/default/lib/node-db/query_1.o
21:29:46 runner system command -> ['/usr/bin/g++', '-g', '-Wall', '-I/Applications/MAMP/Library/include', '-fPIC', '-compatibility_version', '1', '-current_version', '1', '-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64', '-D_GNU_SOURCE', '-DEV_MULTIPLICITY=0', '-Idefault/lib', '-I../lib', '-I/Users/iplog/local/node/include/node', '../lib/node-db/query.cc', '-c', '-o', 'default/lib/node-db/query_1.o']
[ 6/11] cxx: src/connection.cc -> build/default/src/connection_1.o
21:29:46 runner system command -> ['/usr/bin/g++', '-g', '-Wall', '-I/Applications/MAMP/Library/include', '-fPIC', '-compatibility_version', '1', '-current_version', '1', '-D_LARGEFILE_SOURCE', '-D_FILE_OFFSET_BITS=64', '-D_GNU_SOURCE', '-DEV_MULTIPLICITY=0', '-Idefault/lib', '-I../lib', '-I/Users/iplog/local/node/include/node', '../src/connection.cc', '-c', '-o', 'default/src/connection_1.o']
In file included from ../src/connection.cc:2:
../src/./connection.h:5:19: error: mysql.h: No such file or directory
In file included from ../src/./connection.h:8,
                 from ../src/connection.cc:2:
../src/././result.h:16: error: expected ‘,’ or ‘...’ before ‘&’ token
../src/././result.h:16: error: ISO C++ forbids declaration of ‘MYSQL_FIELD’ with no type
../src/././result.h:28: error: expected `)' before ‘*’ token
../src/././result.h:54: error: ISO C++ forbids declaration of ‘MYSQL’ with no type
../src/././result.h:54: error: expected ‘;’ before ‘*’ token
../src/././result.h:55: error: ISO C++ forbids declaration of ‘MYSQL_RES’ with no type
../src/././result.h:55: error: expected ‘;’ before ‘*’ token
In file included from ../src/connection.cc:2:
../src/./connection.h:43: error: ISO C++ forbids declaration of ‘MYSQL’ with no type
../src/./connection.h:43: error: expected ‘;’ before ‘*’ token
../src/connection.cc: In constructor ‘node_db_mysql::Connection::Connection()’:
../src/connection.cc:11: error: class ‘node_db_mysql::Connection’ does not have any field named ‘connection’
../src/connection.cc: In member function ‘virtual bool node_db_mysql::Connection::isAlive(bool)’:
../src/connection.cc:57: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:57: error: ‘mysql_ping’ was not declared in this scope
../src/connection.cc: In member function ‘virtual void node_db_mysql::Connection::open()’:
../src/connection.cc:65: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:65: error: ‘mysql_init’ was not declared in this scope
../src/connection.cc:66: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:71: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:71: error: ‘MYSQL_SET_CHARSET_NAME’ was not declared in this scope
../src/connection.cc:71: error: ‘mysql_options’ was not declared in this scope
../src/connection.cc:75: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:75: error: ‘MYSQL_OPT_COMPRESS’ was not declared in this scope
../src/connection.cc:75: error: ‘mysql_options’ was not declared in this scope
../src/connection.cc:79: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:79: error: ‘MYSQL_INIT_COMMAND’ was not declared in this scope
../src/connection.cc:79: error: ‘mysql_options’ was not declared in this scope
../src/connection.cc:83: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:83: error: ‘MYSQL_OPT_READ_TIMEOUT’ was not declared in this scope
../src/connection.cc:83: error: ‘mysql_options’ was not declared in this scope
../src/connection.cc:90: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:90: error: ‘MYSQL_OPT_SSL_VERIFY_SERVER_CERT’ was not declared in this scope
../src/connection.cc:90: error: ‘mysql_options’ was not declared in this scope
../src/connection.cc:93: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:93: error: ‘MYSQL_OPT_CONNECT_TIMEOUT’ was not declared in this scope
../src/connection.cc:97: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:97: error: ‘MYSQL_OPT_WRITE_TIMEOUT’ was not declared in this scope
../src/connection.cc:101: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:108: error: ‘mysql_real_connect’ was not declared in this scope
../src/connection.cc:116: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:116: error: ‘mysql_error’ was not declared in this scope
../src/connection.cc: In member function ‘virtual void node_db_mysql::Connection::close()’:
../src/connection.cc:122: error: ‘class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:122: error: ‘mysql_close’ was not declared in this scope
../src/connection.cc: In member function ‘virtual std::string node_db_mysql::Connection::escape(const std::string&) const’:
../src/connection.cc:133: error: ‘const class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:133: error: ‘mysql_real_escape_string’ was not declared in this scope
../src/connection.cc: In member function ‘virtual std::string node_db_mysql::Connection::version() const’:
../src/connection.cc:141: error: ‘const class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:141: error: ‘mysql_get_server_info’ was not declared in this scope
../src/connection.cc: In member function ‘virtual node_db::Result* node_db_mysql::Connection::query(const std::string&) const’:
../src/connection.cc:150: error: ‘const class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:150: error: ‘mysql_real_query’ was not declared in this scope
../src/connection.cc:151: error: ‘const class node_db_mysql::Connection’ has no member named ‘connection’
../src/connection.cc:151: error: ‘mysql_error’ was not declared in this scope
../src/connection.cc:154: error: ‘const class node_db_mysql::Connection’ has no member named ‘connection’
Owner

mariano commented Jul 3, 2011

Show me the contents of /Applications/MAMP/Library/include

Owner

mariano commented Jul 3, 2011

Also show me the output of this:

$ /Applications/MAMP/Library/bin/mysql_config --include

iplog commented Jul 3, 2011

Ok:
1- /Applications/MAMP/Library/include does not exist :-s. Which is not very convenient
2- /Applications/MAMP/Library/bin/mysql_config --include output is

-I/Applications/MAMP/Library/include

Owner

mariano commented Jul 3, 2011

Then that's your problem. Mysqlconfig is reporting an include dir which is not in your system, and that's why the compiler is reporting mysql.h cannot be found.

I'm not a mac user but a quick google search shows that this issue has been reported to MAMP Appareantly for some reason MAMP does not ship in MySQL's include files.

Also while browsing quickly the MAMP site I think I found a possible solution. First take note of your MAMP version (for example 1.7.2, which I think is the last stable release). Then go to MAMP's repository of files and download the appropriate source file for your MAMP version (for example file MAMP_1.7.2_src.zip

After downloading this file and opening it, you'll notice a bunch of .tar.gz files. Locate the mysql one (named mysql-5.0.41.tar.gz for MAMP 1.7.2). Extract this file somewhere in your system, and then move its include/ dir to /Applications/MAMP/Library.

iplog commented Jul 3, 2011

It's going better but we're not done yet.

My MAMP version is 1.9.6. As you said, I've downloaded the mamp component file and I've found the mysql.tar.gz file and the include folder inside. I've put this folder in /Application/MAMP/Library.

I've tried a first install and had the following error :

/Applications/MAMP/Library/include/mysql.h:71:27: error: mysql_version.h: No such file or directory

I renamed the mysql_version.h.in fil to mysql_version.h and retried to install. Now I have this :

Checking for program g++ or c++          : /usr/bin/g++ 
Checking for program cpp                 : /usr/bin/cpp 
Checking for program ar                  : /usr/bin/ar 
Checking for program ranlib              : /usr/bin/ranlib 
Checking for g++                         : ok  
Checking for node path                   : not found 
Checking for node prefix                 : ok /Users/nicolasblanchot/local/node 
Checking for program mysql_config        : /Applications/MAMP/Library/bin/mysql_config 
Checking for library mysqlclient_r       : Missing libmysqlclient_r 
'configure' finished successfully (1.343s)
Waf: Entering directory `/Users/iplog/node_modules/db-mysql/build'
[ 1/11] cxx: lib/node-db/binding.cc -> build/default/lib/node-db/binding_1.o
[ 2/11] cxx: lib/node-db/connection.cc -> build/default/lib/node-db/connection_1.o
[ 3/11] cxx: lib/node-db/exception.cc -> build/default/lib/node-db/exception_1.o
[ 4/11] cxx: lib/node-db/query.cc -> build/default/lib/node-db/query_1.o
[ 5/11] cxx: lib/node-db/result.cc -> build/default/lib/node-db/result_1.o
[ 6/11] cxx: src/connection.cc -> build/default/src/connection_1.o
In file included from /Applications/MAMP/Library/include/mysql.h:72,
                 from ../src/./connection.h:5,
                 from ../src/connection.cc:2:
/Applications/MAMP/Library/include/mysql_com.h:418:5: error: token "@" is not valid in preprocessor expressions
../src/connection.cc:86:5: error: token "@" is not valid in preprocessor expressions
../src/connection.cc:110:5: error: token "@" is not valid in preprocessor expressions
Waf: Leaving directory `/Users/iplog/node_modules/db-mysql/build'
Build failed:  -> task failed (err #1): 
    {task: cxx connection.cc -> connection_1.o}

I opened the file and did not see any "@" on line 418. Seems weird.

Owner

mariano commented Jul 3, 2011

Ok yeah the problem is because mysql_version.h.in is supposed to be processed by Makefile. Some people explain how to compile against mysql included in MAMP

iplog commented Jul 3, 2011

Yeah! It's worked great \o/.

It was quite long to compile because of my 5 years old laptop but now everything right!

Thank you so much for your help. I couldn't have done it alone.

Owner

mariano commented Jul 3, 2011

Awesome, glad it worked out

kenvunz commented Aug 17, 2011

my 2 cents,

older mysql (< 5.5) only produce libmysqlclient.dylib when run make, just need to duplicate that file with _r at the end. Takes me hours to find out

Hi Mariano , i'm getting the following error when i try to install the db-mysql , any ideas what is going on ?

'configure' finished successfully (1.657s)
Waf: Entering directory /home/mawi/node_modules/db-mysql/build' [ 1/11] cxx: lib/node-db/binding.cc -> build/default/lib/node-db/binding_1.o In file included from ../lib/node-db/binding.cc:2: ../lib/node-db/./binding.h:6:25: error: node_events.h: No such file or directory In file included from ../lib/node-db/./binding.h:11, from ../lib/node-db/binding.cc:2: ../lib/node-db/././query.h:20: error: expected class-name before ‘{’ token In file included from ../lib/node-db/binding.cc:2: ../lib/node-db/./binding.h:14: error: expected class-name before ‘{’ token ../lib/node-db/binding.cc: In constructor ‘node_db::Binding::Binding()’: ../lib/node-db/binding.cc:7: error: expected class-name before ‘(’ token ../lib/node-db/binding.cc:7: error: expected ‘{’ before ‘(’ token ../lib/node-db/binding.cc: At global scope: ../lib/node-db/binding.cc:7: error: expected unqualified-id before ‘)’ token ../lib/node-db/binding.cc:7: error: expected constructor, destructor, or type conversion before ‘(’ token ../lib/node-db/binding.cc: In static member function ‘static v8::Handle<v8::Value> node_db::Binding::Connect(const v8::Arguments&)’: ../lib/node-db/binding.cc:91: error: ‘class node_db::Binding’ has no member named ‘Ref’ ../lib/node-db/binding.cc:92: error: invalid conversion from ‘int (*)(eio_req*)’ to ‘void (*)(eio_req*)’ ../lib/node-db/binding.cc:92: error: initializing argument 1 of ‘eio_req* eio_custom(void (*)(eio_req*), int, int (*)(eio_req*), void*)’ ../lib/node-db/binding.cc: In static member function ‘static void node_db::Binding::connectFinished(node_db::Binding::connect_request_t*)’: ../lib/node-db/binding.cc:124: error: ‘class node_db::Binding’ has no member named ‘Emit’ ../lib/node-db/binding.cc:128: error: ‘class node_db::Binding’ has no member named ‘Emit’ ../lib/node-db/binding.cc: In static member function ‘static int node_db::Binding::eioConnectFinished(eio_req*)’: ../lib/node-db/binding.cc:160: error: ‘class node_db::Binding’ has no member named ‘Unref’ Waf: Leaving directory/home/mawi/node_modules/db-mysql/build'
Build failed: -> task failed (err #1):
{task: cxx binding.cc -> binding_1.o}
npm ERR! error installing db-mysql@0.6.7 Error: db-mysql@0.6.7 install: node-waf configure build
npm ERR! error installing db-mysql@0.6.7 sh "-c" "node-waf configure build" failed with 1
npm ERR! error installing db-mysql@0.6.7 at ChildProcess. (/home/mawi/local/node/lib/node_modules/npm/lib/utils/exec.js:49:20)
npm ERR! error installing db-mysql@0.6.7 at ChildProcess.emit (events.js:70:17)
npm ERR! error installing db-mysql@0.6.7 at ChildProcess.onexit (child_process_legacy.js:246:12)

Owner

mariano commented Aug 20, 2011

@MohamedFaramawi: Yes, you are probably trying to install it against node 0.5.x. I have yet to adapt it to the recent C++ API changes in node 0.5.x, so in the meantime you have to stick to 0.4.x (which is the stable node version ayway)

I'm running Centos 5, and running into the same "Missing libmysqlclient_r" issue.

npm install db-mysql
npm info it worked if it ends with ok
npm info using npm@0.3.18
npm info using node@v0.5.0-pre
npm info preinstall db-mysql@0.7.6
npm info install db-mysql@0.7.6
Checking for program g++ or c++          : /usr/bin/g++ 
Checking for program cpp                 : /usr/bin/cpp 
Checking for program ar                  : /usr/bin/ar 
Checking for program ranlib              : /usr/bin/ranlib 
Checking for g++                         : ok  
Checking for node path                   : not found 
Checking for node prefix                 : ok /usr/local 
Checking for program mysql_config        : /usr/bin/mysql_config 
Checking for library mysqlclient_r       : Missing libmysqlclient_r 
'configure' finished successfully (0.184s)
Waf: Entering directory `/usr/local/lib/node/.npm/db-mysql/0.7.6/package/build'
[ 1/12] cxx: lib/node-db/binding.cc -> build/default/lib/node-db/binding_1.o
[ 2/12] cxx: lib/node-db/connection.cc -> build/default/lib/node-db/connection_1.o
[ 3/12] cxx: lib/node-db/events.cc -> build/default/lib/node-db/events_1.o
../lib/node-db/events.cc: In member function ‘bool node_db::EventEmitter::Emit(const char*, int, v8::Handle<v8::Value>*)’:
../lib/node-db/events.cc:32: error: ‘MakeCallback’ is not a member of ‘node’
../lib/node-db/binding.cc: In static member function ‘static v8::Handle<v8::Value> node_db::Binding::Connect(const v8::Arguments&)’:
../lib/node-db/binding.cc:86: error: invalid conversion from ‘void (*)(eio_req*)’ to ‘int (*)(eio_req*)’
../lib/node-db/binding.cc:86: error:   initializing argument 1 of ‘eio_req* eio_custom(int (*)(eio_req*), int, int (*)(eio_req*), void*)’
Waf: Leaving directory `/usr/local/lib/node/.npm/db-mysql/0.7.6/package/build'
Build failed:
 -> task failed (err #1): 
    {task: cxx events.cc -> events_1.o}
 -> task failed (err #1): 
    {task: cxx binding.cc -> binding_1.o}
npm info db-mysql@0.7.6 Failed to exec install script
npm ERR! install failed Error: db-mysql@0.7.6 install: `node-waf configure build`
npm ERR! install failed `sh "-c" "node-waf configure build"` failed with 1
npm ERR! install failed     at ChildProcess.<anonymous> (/usr/local/lib/node/.npm/npm/0.3.18/package/lib/utils/exec.js:49:20)
npm ERR! install failed     at ChildProcess.emit (events.js:67:17)
npm ERR! install failed     at ChildProcess.onexit (child_process.js:192:12)
npm info install failed rollback
npm info uninstall [ 'db-mysql@0.7.6' ]
npm info preuninstall db-mysql@0.7.6
npm info uninstall db-mysql@0.7.6
npm info auto-deactive not symlink
npm info postuninstall db-mysql@0.7.6
npm info uninstall db-mysql@0.7.6 complete
npm info install failed rolled back
npm ERR! Error: db-mysql@0.7.6 install: `node-waf configure build`
npm ERR! `sh "-c" "node-waf configure build"` failed with 1
npm ERR!     at ChildProcess.<anonymous> (/usr/local/lib/node/.npm/npm/0.3.18/package/lib/utils/exec.js:49:20)
npm ERR!     at ChildProcess.emit (events.js:67:17)
npm ERR!     at ChildProcess.onexit (child_process.js:192:12)
npm ERR! 
npm ERR! Failed at the db-mysql@0.7.6 install script.
npm ERR! This is most likely a problem with the db-mysql package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-waf configure build
npm ERR! You can get their info via:
npm ERR!     npm owner ls db-mysql
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 2.6.18-194.el5
npm ERR! argv { remain: [ 'db-mysql' ],
npm ERR! argv   cooked: [ 'install', 'db-mysql' ],
npm ERR! argv   original: [ 'install', 'db-mysql' ] }
npm not ok

Here's the output of some of the commands mentioned above:
which mysql_config
/usr/bin/mysql_config

mysql_config --libs_r
-L/usr/lib64/mysql -lmysqlclient -lmysqlclient_r -lpthread -lz -lm -lrt -lssl -lcrypto -ldl

mysql_config --include
-I/usr/include/mysql

l /usr/include/mysql
/usr/include/mysql -> /usr/include/mysql51/mysql/

And mysql.h is in the /usr/include/mysql folder.

I cloned the repo into my home folder to do a bit more sleuthing and this from the node-db-mysql folder:

node-waf configure -vv
Checking for program g++ or c++          : /usr/bin/g++ 
Checking for program cpp                 : /usr/bin/cpp 
Checking for program ar                  : /usr/bin/ar 
Checking for program ranlib              : /usr/bin/ranlib 
Checking for g++                         : ok  
Checking for node path                   : not found 
Checking for node prefix                 : ok /usr/local 
Checking for program mysql_config        : /usr/bin/mysql_config 
Checking for library mysqlclient_r       : 09:40:51 runner system command -> ['/usr/bin/g++', '-g', '-Wall', '-I/usr/include/mysql', '../test.cpp', '-c', '-o', 'default/test_1.o']
09:40:51 runner system command -> ['/usr/bin/g++', 'default/test_1.o', '-o', '/home/mrich/node-db-mysql/build/.conf_check_0/testbuild/default/testprog', '-L/usr/lib64/mysql', '-lmysqlclient', '-lmysqlclient_r', '-lpthread', '-lz', '-lm', '-lrt', '-lssl', '-lcrypto', '-ldl', '-Wl,-Bdynamic']
Missing libmysqlclient_r 
'configure' finished successfully (0.178s)
ls /usr/lib64/mysql
INFO_BIN  libmysqlclient_r.so.16@      libmysqlclient.so.16@      libmysqlclient.so.18@      mysqlbug*      plugin/
INFO_SRC  libmysqlclient_r.so.16.0.0*  libmysqlclient.so.16.0.0*  libmysqlclient.so.18.0.0*  mysql_config*

I've tried installing mysql-devel with yum, but I'm running into conflicts, and the compat-mysql51 package installed ok and provided the libmysqlclient_r files.

Any hints? Thanks!

I have the same problem :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment