Topic: Mongrel doesn't start

Mongrel doesn't start. It ends with the error:

dyld: NSLinkModule() error
dyld: Library not loaded: /usr/local/mysql/lib/mysql/libmysqlclient.15.dylib
  Referenced from: /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.bundle
  Reason: image not found
Trace/BPT trap

What could be wrong?

Re: Mongrel doesn't start

There's something going on with `image`. Is there some kind of image library you are using?

What is your environment? Linux? Mac OS X? Windows?

You might try this:

gem install mysql

to install the latest version of the mysql gem. Uninstalling it first might help too (`gem uninstall mysql`).

email the future with www.l8r.nu

Re: Mongrel doesn't start

I use Mac OS.

Actually Mongrel starts. But when I click the info link on the Rails start page, you know the yellow field with the javascript action, it dies with the message above.

Re: Mongrel doesn't start

Maybe it could be when I installed "sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql"

How do I uninstall that? With "sudo gem uninstall mysql"?

Re: Mongrel doesn't start

I did an uninstall of mysql and now it works? What gives? Would be good if it works if the performance becomes better.

Re: Mongrel doesn't start

Did you recently upgrade MySQL or reinstall the developer tools or OS X? I rebuilt my system over the weekend and have the same issue now. I'm using version 5.0.41 of MySQL.

One thing to note is the file it says it cannot find:

/usr/local/mysql/lib/mysql/libmysqlclient.15.dylib

is not there, though it is here:

/usr/local/mysql/lib/libmysqlclient.15.dylib

I also get the exact same error when trying to make install php5. So it isn't a Ruby/Mongrel specific problem. I tried installing the previous version of MySQL (5.0.37) and have the same problem.

Re: Mongrel doesn't start

sterling wrote:

Did you recently upgrade MySQL or reinstall the developer tools or OS X? I rebuilt my system over the weekend and have the same issue now. I'm using version 5.0.41 of MySQL.

Yes. I did.

Re: Mongrel doesn't start

palb wrote:
sterling wrote:

Did you recently upgrade MySQL or reinstall the developer tools or OS X? I rebuilt my system over the weekend and have the same issue now. I'm using version 5.0.41 of MySQL.

Yes. I did.

I'm guessing that's it. Try going down to version 5.0.33, or whichever was before 5.0.37. I've got a meeting, but I will try after that, I'll post my results.

Re: Mongrel doesn't start

I installed the MySQL 5.1.18 beta and also tried with 5.0.27. Both worked fine. There must be an issue with 5.0.37 and 5.0.41.

Re: Mongrel doesn't start

sterling wrote:

I installed the MySQL 5.1.18 beta and also tried with 5.0.27. Both worked fine. There must be an issue with 5.0.37 and 5.0.41.

Good to know.

Re: Mongrel doesn't start

If you're on OS X and you see this problem, you need to change the "Install Name" (see http://www.cocoadev.com/index.pl?ApplicationLinking) for the mysqlclient library in /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.bundle.  This command in Terminal fixed it for me, after installing the MySQL binary packages from www.mysql.com and the latest rails from gem:

sudo install_name_tool -change /usr/local/mysql/lib/mysql/libmysqlclient.15.dylib /usr/local/mysql/lib/libmysqlclient.15.dylib /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.bundle

Re: Mongrel doesn't start

jhclouse wrote:

If you're on OS X and you see this problem, you need to change the "Install Name" (see http://www.cocoadev.com/index.pl?ApplicationLinking) for the mysqlclient library in /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.bundle.  This command in Terminal fixed it for me, after installing the MySQL binary packages from www.mysql.com and the latest rails from gem:

sudo install_name_tool -change /usr/local/mysql/lib/mysql/libmysqlclient.15.dylib /usr/local/mysql/lib/libmysqlclient.15.dylib /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.bundle

I don't have that file. But I have /usr/local/mysql/lib/libmysqlclient.a

Will the above command affect the settings for php?

Last edited by palb (2007-05-18 15:30:07)

Re: Mongrel doesn't start

I worked around this by creating the directory "mysql" in the "/usr/local/mysql/lib" directory and then placing symbolic links inside that directory pointing back to the original "libs" directory.  Worked fine...:

# cd /usr/local/mysql/lib
# mkdir mysql
# cd mysql
# ln -s /usr/local/mysql/lib/lib* .

This was to get a php install to be happy on OSX but should work for this rails problem I would guess...

Re: Mongrel doesn't start

I got it up and running, but it was a big problem. Can't remember what I did now, but it was related to mysql when configuring Apache2. Seems like a bug or something. I've seen many with the same problem.

Re: Mongrel doesn't start

jhclouse wrote:

If you're on OS X and you see this problem, you need to change the "Install Name" (see http://www.cocoadev.com/index.pl?ApplicationLinking) for the mysqlclient library in /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.bundle.  This command in Terminal fixed it for me, after installing the MySQL binary packages from www.mysql.com and the latest rails from gem:

sudo install_name_tool -change /usr/local/mysql/lib/mysql/libmysqlclient.15.dylib /usr/local/mysql/lib/libmysqlclient.15.dylib /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.bundle

This works like a charm on OS X.  Thanks.

Re: Mongrel doesn't start

This worked for me also. Thanks!!!

Application's environment
OS X 10.4.9
mySQL 5.0.41
Ruby version            1.8.6 (powerpc-darwin8.9.0)
RubyGems version    0.9.2
Rails version            1.2.3
Active Record version    1.15.3
Action Pack version    1.13.3
Action Web Service version    1.2.3
Action Mailer version    1.3.3
Active Support version    1.4.2
Application root    /Users/****/testapp
Environment    development
Database adapter    mysql

Re: Mongrel doesn't start

YES!!!! Post 15 worked for me too!   Thanks a bunch...saved me from a really bad headache.

Re: Mongrel doesn't start

Hey guys...

I am completely new to RoR...i did all my isntalling a few days ago and am now going through some tutorials...I got a similar error with mysql...

"dyld: NSLinkModule() error
dyld: Library not loaded: /usr/local/mysql/lib/mysql/libmysqlclient.15.dylib
  Referenced from: /usr/local/lib/ruby/site_ruby/1.8/i686-darwin8.10.1/mysql.bundle
  Reason: image not found"

The difference between mine and the rest is that the path to "mysql.bundle" is different than the rest...it is in /usr/local/lib/ruby/site_ruby/1.8/i686-darwin8.10.1/ 

should it be there?

I edited the command to fix the problem and it worked...here is what I used to fix my problem...

sudo install_name_tool -change /usr/local/mysql/lib/mysql/libmysqlclient.15.dylib /usr/local/mysql/lib/libmysqlclient.15.dylib /usr/local/lib/ruby/site_ruby/1.8/i686-darwin8.10.1/mysql.bundle

PLEASE let me know if the mysql.bundle should be in " /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/"

Thanks a ton guys!

for the record...Im running Mac OS 10.4.9

Re: Mongrel doesn't start

Thank you so very much! Post 11 got me back on track!

Re: Mongrel doesn't start

For gems installed in /opt/local:

sudo install_name_tool -change /usr/local/mysql/lib/mysql/libmysqlclient.15.dylib /usr/local/mysql/lib/libmysqlclient.15.dylib /opt/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.bundle