Note that there are some explanatory texts on larger screens.

plurals
  1. PORuby's MySQL driver not finding required libraries
    text
    copied!<p>Linux 2.6.18-92.el5, ruby 1.8.7, Rails 2.2.2, mysql gem 2.7</p> <p>I installed the MySQL binary distribution under /usr/local, then installed the mysql gem like this:</p> <pre><code>gem install mysql --no-rdoc --no-ri \ -- --with-mysql-include=/usr/local/mysql/include \ --with-mysql-lib=/usr/local/mysql/lib \ --with-mysql-config=/usr/local/mysql/bin/mysql_config </code></pre> <p>When I run <code>irb&gt; require 'mysql'</code> I get the error shown below:</p> <pre><code>irb(main):001:0&gt; require 'rubygems' =&gt; true irb(main):002:0&gt; require 'mysql' LoadError: libmysqlclient.so.16: cannot open shared object file: No such file or directory - /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.so from /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.so from /usr/local/lib/ruby/site_ruby/1.8/rubygems/ custom_require.rb:36:in `require' from (irb):2 </code></pre> <p>After some Googling I found that I could use <code>ldconfig</code> to configure mysql.so to be available to the whole system. Once I added "/usr/local/ mysql/lib" to /etc/ld.so.conf and ran ldconfig, it worked fine:</p> <pre><code>irb(main):002:0&gt; require 'rubygems' =&gt; true irb(main):003:0&gt; require 'mysql' =&gt; true </code></pre> <p>OK, so I got it to work. But my question is, why was I getting that error? You used to be able to just <code>gem install mysql</code> and it would work. Has anyone else encountered the same error? Using <code>ldconfig</code> seems kind of brittle and unmaintainable. Is there a better solution?</p> <p>Any insight would be greatly appreciated.</p> <p>Thanks,</p> <p>Ethan</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload