I have Rails 3.1-rc4, MySQL 5.5.15 (just updated) and Mac OS X Lion. My problem was that the mysql_api.bundle file was associated with the desired libmysqlclient.18.dylib file, but it could not find the library:
otool -L ~/.rvm/gems/ruby-1.9.2-p180/gems/mysql-2.8.1/lib/mysql_api.bundle /Users/rowland/.rvm/gems/ruby-1.9.2-p180/gems/mysql-2.8.1/lib/mysql_api.bundle: /Users/rowland/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.1.9.1.dylib (compatibility version 1.9.1, current version 1.9.1) libmysqlclient.18.dylib (compatibility version 18.0.0, current version 18.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.0.0) /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
The library was not found at runtime. My first attempt to fix this was to add the LC_RPATH command, but that wasn’t enough (perhaps because it was at the end of the list). Instead, I directly changed the library link:
install_name_tool -change libmysqlclient.18.dylib /usr/local/mysql/lib/libmysqlclient.18.dylib ~/.rvm/gems/ruby-1.9.2-p180\@rails-3.1/gems/mysql-2.8.1/lib/mysql_api.bundle
Now otool shows me:
otool -L ~/.rvm/gems/ruby-1.9.2-p180\@rails-3.1/gems/mysql-2.8.1/lib/mysql_api.bundle /Users/rowland/.rvm/gems/ ruby-1.9.2-p180@rails-3.1 /gems/mysql-2.8.1/lib/mysql_api.bundle: /Users/rowland/.rvm/rubies/ruby-1.9.2-p180/lib/libruby.1.9.1.dylib (compatibility version 1.9.1, current version 1.9.1) /usr/local/mysql/lib/libmysqlclient.18.dylib (compatibility version 18.0.0, current version 18.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.0.0) /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
and he is happy again. This only works on Mac OS X.
Shaun rowland
source share