title: gdb says "cannot open shared object file"
body: <p>I have one binary and one shared library.
  The shared library is compiled with:</p>
  
  <pre><code>all:
  g++ -g -shared -fpic $(SOURCES) -o libmisc.so
  </code></pre>
  
  <p>the binary is compiled with:</p>
  
  <pre><code>LIBS=-L../../misc/src
  
  LDFLAGS=-lmisc
  
  all:
  g++ -g -o mainx $(INCLUDE) $(SOURCE) $(LIBS) $(LDFLAGS)
  </code></pre>
  
  <p>I set in <code>~/.bashrc</code></p>
  
  <pre><code>export LD_LIBRARY_PATH=/mnt/sda5/Programming/misc/src/
  </code></pre>
  
  <p>to the <code>libmisc.so</code> output path.</p>
  
  <p>Debugging from console works fine:</p>
  
  <pre><code>gdb mainx
  </code></pre>
  
  <p>However from Emacs22, launching gdb fails with the following message:</p>
  
  <blockquote>
    <p>Starting program: /mnt/sda5/Programming/main/src/mainx
    /mnt/sda5/Programming/main/src/mainx: error while loading shared libraries: libmisc.so: cannot open shared object file: No such file or directory</p>
  </blockquote>
  
  <p>This looks very tricky for the moment, and I couldn't solve it. I am not sure if this a emacs's problem, or I should pass a parameter in gdb's command line.</p>