title: I cannot run a ELF-format program .The shell tells me no such file or directory
body: <p>My environment is Ubuntu 14 32bits.<br/>
  I write three c files called main.c,foo.c,and bar.c respectively.<br/>
  the codes are very simple.<br/>
  The first source code is main.c<br/></p>
  
  <pre><code> #include&lt;stdio.h&gt;
   extern void foo();
   int main(){
   foo();
   return 0;
  }
  </code></pre>
  
  <p>the second source code is foo.c<br/></p>
  
  <pre><code>#include&lt;stdio.h&gt;
  void foo(){
  printf("Hi,I am foo.");
  bar();
  }
  </code></pre>
  
  <p>the last one is bar.c<br/></p>
  
  <pre><code>#include&lt;stdio.h&gt;
  void bar(){
  printf("Hi,I am bar.");
  }
  </code></pre>
  
  <p>All the files above are be put into the same folder called test.<br/>
  (its absolute path is /home/jack/Desktop/test)<br/>
  then I issue the commands :<br/></p>
  
  <pre><code>$ gcc -fPIC -shared -Wl,-soname,libbar.so.1 -o libbar.so.1.0.0 bar.c
  $ ln -s libbar.so.1.0.0 libbar.so
  $ gcc -fPIC -shared -Wl,-soname,libfoo.so.1 -o libfoo.so.1.0.0 foo.c -lbar -L.
  $ ln -s libfoo.so.1.0.0  libfoo.so
  $ gcc -c main.c
  $ ld -rpath /home/jack/Desktop/test -e main -o main main.o -L. -lfoo -lbar
  </code></pre>
  
  <p>then I run the executable file called main.<br/></p>
  
  <pre><code>$./main
  </code></pre>
  
  <p>but the shell return the string below<br/></p>
  
  <blockquote>
    <p>bash: ./main: no such file or directory.<br/></p>
  </blockquote>
  
  <p>But the main file really exists in the current directory.<br/></p>
  
  <p>Why?<br/></p>