title: How to get Ruby to find a native lib?
body: <p>I installed some native libraries in /usr/local/lib.</p>
  
  <p>I am now trying to install a gem which needs these in order to
  build correctly but, the gem build fails as it cannot find the
  libraries.</p>
  
  <p>The gem's extconf.rb file tries to confirm it can find the library with
  <code>have_library()</code> but this fails for some reason.</p>
  
  <p>I tried setting a bunch of environment variables but nothing seems to work:</p>
  
  <pre><code>irb(main):003:0&gt; require 'mkmf'
  =&gt; true
  irb(main):004:0&gt; have_library('gecodesearch')
  checking for main() in -lgecodesearch... no
  =&gt; false
  irb(main):005:0&gt; ENV['LD_LIBRARY_PATH']='/usr/local/lib'
  =&gt; "/usr/local/lib"
  irb(main):006:0&gt; have_library('gecodesearch')
  checking for main() in -lgecodesearch... no
  =&gt; false
  irb(main):007:0&gt; ENV['DYLD_LIBRARY_PATH']='/usr/local/lib'
  =&gt; "/usr/local/lib"
  irb(main):008:0&gt; have_library('gecodesearch')
  checking for main() in -lgecodesearch... no
  =&gt; false
  irb(main):009:0&gt; have_library('libgecodesearch')
  checking for main() in -llibgecodesearch... no
  =&gt; false
  irb(main):010:0&gt; ENV['C_INCLUDE_PATH']='/usr/local/lib'
  =&gt; "/usr/local/lib"
  irb(main):011:0&gt; have_library('gecodesearch')
  checking for main() in -lgecodesearch... no
  =&gt; false
  irb(main):012:0&gt; ENV['PATH']='/usr/local/lib'
  =&gt; "/usr/local/lib"
  irb(main):013:0&gt; have_library('gecodesearch')
  checking for main() in -lgecodesearch... no
  =&gt; false 
  </code></pre>
  
  <p>What is the best way to solve this problem?</p>