title: LD_LIBRARY_PATH doesn't seem to work
body: <p>I'm trying to compile a test file:</p>
  
  <pre><code>gcc -o test  test.c -lg2c
  </code></pre>
  
  <p>but I get the error:</p>
  
  <pre><code>/usr/bin/ld: cannot find -lg2c
  </code></pre>
  
  <p>If I use:</p>
  
  <pre><code>gcc -o test  test.c -L/usr/lib/gcc/x86_64-redhat-linux/3.4.6 -lg2c
  </code></pre>
  
  <p>then it works fine.</p>
  
  <p>So I added the path like so:</p>
  
  <pre><code>LD_LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/3.4.6:$LD_LIBRARY_PATH
  </code></pre>
  
  <p>and when I use <code>$LD_LIBRARY_PATH</code> it's listed there, but:</p>
  
  <pre><code>gcc -o test  test.c -lg2c
  </code></pre>
  
  <p>still doesn't work, it gives the same error, I can't figure out why.</p>
  
  <p>I'm using CentOS (2.6.32-279.9.1.el6.x86_64), any help would be greatly appreciated.</p>
  
  <hr>
  
  <p><strong>EDIT</strong>: compiler version:</p>
  
  <pre><code>rpm -qa | grep gcc
  
  gcc-4.4.6-4.el6.x86_64
  compat-gcc-34-g77-3.4.6-19.el6.x86_64
  libgcc-4.4.6-4.el6.x86_64
  compat-gcc-34-3.4.6-19.el6.x86_64
  gcc-gfortran-4.4.6-4.el6.x86_64
  libgcc-4.4.6-4.el6.i686
  gcc-c++-4.4.6-4.el6.x86_64
  </code></pre>
  
  <hr>
  
  <p><strong>EDIT</strong>: I tried using <code>LIBRARY_PATH</code> instead, now I get a different error:</p>
  
  <pre><code>gcc: spec failure: unrecognized spec option 'M'
  </code></pre>
  
  <p>I have no idea what it means.</p>