1

Getting this error from Passenger (with Apache). Not sure what it means...

 dlopen(/path/to/myapp/shared/bundle/ruby/1.9.1/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle, 9): 
 Library not loaded: /usr/local/mysql/lib/libmysqlclient.16.dylib 
 Referenced from: /path/to/myapp/shared/bundle/ruby/1.9.1/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle 
 Reason: image not found - /path/to/myapp/shared/bundle/ruby/1.9.1/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle

The Ruby installed is actually 1.9.2 but the gems are in this "1.9.1" path for whatever reason...

Could it have something to do with the fact I'm using the mysql2 gem instead of mysql?

Or, maybe could it have something to do with the 2nd line "Library not loaded" where it looks like it might be trying to load the wrong libmysqlclient.16.dylib? As the path /usr/local/mysql points to a version of mysql that is not running. The version of mysql that is running is in /usr/bin/. I'd try to change this but I have no idea how!?!

Meltemi
  • 37,979
  • 50
  • 195
  • 293

1 Answers1

3

The announcement for Ruby 1.9.2 says (sic)

This version is "librariry compatible version". Ruby 1.9.2 is almost 1.9.1 compatible, so the library is installed in 1.9.1 direcotry.

That is why the ruby directories are named “1.9.1”; it is normal.


Your instance of the mysql2 gem was built against the /usr/local/mysql/lib/libmysqlclient.16.dylib library. For one reason or another, that library is not currently available on your system at that pathname (MySQL removed/moved/upgraded?).


You probably need to rebuild your mysql2 gem and point it to the mysql_config (or mysql_config5) from your MySQL installation (in /usr/bin?):

gem install mysql2 -- --with-mysql-config=/usr/bin/mysql_config
Chris Johnsen
  • 214,407
  • 26
  • 209
  • 186
  • thank you! just out of curiosity, i'm learning, where would i go to read about build options like that? I've looked at the **mysql2** docs but can't find any mention. So much hidden "behind the scenes" in Rails, etc...can be frustrating. – Meltemi Nov 23 '10 at 18:31
  • That differs from gem to gem. In your case it's just the mysql2 authors not spending any effort into writing proper installation documentation. In some cases the source code is the best "documentation". You should contact the authors about this issue. Other authors (for example, myself ;)) spend a lot of effort into writing proper documentation that also cover installation problems. – Hongli Nov 23 '10 at 22:08
  • @Meltemi: There is an oblique reference to this option in the “Insalling” section of the [README file](https://github.com/brianmario/mysql2#readme) that is part of the source. A search turned up [ *mysql2* (closed) issue #63](https://github.com/brianmario/mysql2/issues/closed/#issue/63), which shows the exact command line. In the end, I read the source to see how it worked: native-code libraries usually live in `ext`, and have a “config” file named `extconf.rb`, so I looked at [`ext/mysql2/extconf.rb`](https://github.com/brianmario/mysql2/blob/master/ext/mysql2/extconf.rb). – Chris Johnsen Nov 23 '10 at 23:01