title: Problems using a shared library
body: <p>I am following the explanation in <a href="http://tldp.org/HOWTO/Program-Library-HOWTO/shared-libraries.html" rel="nofollow">this page</a> and <a href="http://www.yolinux.com/TUTORIALS/LibraryArchives-StaticAndDynamic.html" rel="nofollow">this page</a> trying to build and use shared libraries on Ubuntu Linux.</p>
  
  <p>I am building the libraries and application using a cross-compiler on my PC, than copying the files to the target system and running there.</p>
  
  <p>Finally, I am at the stage where all symlinks are defined correctly and the I am able to run the application - but not in the required form.</p>
  
  <p>Let's say that I have a shared library <code>libtest.so.1.0</code> in a directory <code>/home/ysap/libs</code>. I then created the symlinks <code>libtest.so.1</code> and <code>libtest.so</code> in the same directory, both pointing to the library file.</p>
  
  <p>In the directory <code>/home/ysap/apps</code> I have an application program <code>app.e</code> that uses the <code>test</code> library.</p>
  
  <p>Now, to run the application, I can type:</p>
  
  <pre><code>&gt; LD_LIBRARY_PATH=/home/ysap/libs ./app.e
  </code></pre>
  
  <p>and the application runs nicely. However, I'd like to eliminate the assignment, so I tried typing:</p>
  
  <pre><code>&gt; export LD_LIBRARY_PATH=/home/ysap/libs
  &gt; ./app.e
  </code></pre>
  
  <p>but unfortunately I get an error message, saying:</p>
  
  <p><code>./app.e: error while loading shared libraries: libtest.so.1: cannot open shared object file: No such file or directory</code></p>
  
  <p>I also tried typing:</p>
  
  <pre><code>&gt; ldconfig -n /home/ysap/libs
  </code></pre>
  
  <p>and</p>
  
  <pre><code>&gt; sudo ldconfig -n /home/ysap/libs
  </code></pre>
  
  <p>but it does not help.</p>
  
  <p><strong>What am I doing wrong? How can I make app.e run w/o the variable assignment?</strong></p>
  
  <hr>
  
  <p><strong>Update 1</strong>:</p>
  
  <p>The application uses the <code>mmap()</code> call, so it has to be run with <em>sudo</em> priviledge. The actual invocation line is:</p>
  
  <pre><code>&gt; sudo LD_LIBRARY_PATH=/home/ysap/libs ./app.e
  </code></pre>
  
  <p>Is it possible that the <code>export</code>-ed variable is not updated in the <em>sudo</em> environment?</p>
  
  <hr>
  
  <p><strong>Update 2</strong>:</p>
  
  <p>Output of <code>ldd ./app.e</code>:</p>
  
  <pre><code>libtest.so.1 =&gt; /home/ysap/libs/libtest.so.1 (0xb6faa000)
  libgcc_s.so.1 =&gt; /lib/arm-linux-gnueabi/libgcc_s.so.1 (0xb6f85000)
  libc.so.6 =&gt; /lib/arm-linux-gnueabi/libc.so.6 (0xb6ea4000)
  /lib/ld-linux.so.3 (0xb6fb7000)
  </code></pre>