title: ERROR: ld.so: object 'getpid.so' from LD_PRELOAD cannot be preloaded: ignored
body: <p>When I try to use LD_PRELOAD as following,</p>
  
  <pre><code>LD_PRELOAD=getpid.so ./testpid
  </code></pre>
  
  <p>I get the following error...</p>
  
  <pre><code>ERROR: ld.so: object 'getpid.so' from LD_PRELOAD cannot be preloaded: ignored.
  </code></pre>
  
  <p>I compile getpid.so by using </p>
  
  <pre><code>gcc -Wall -fPIC -shared -o getpid.so getpid.c
  </code></pre>
  
  <p>and it contains the following code...</p>
  
  <pre><code>// getpid.c
  #include &lt;sys/syscall.h&gt;
  #include &lt;sys/types.h&gt;
  #include &lt;unistd.h&gt;
  #include &lt;stdio.h&gt;
  
  pid_t getpid(void)
  {
      printf("Hello, world!\n");
      return syscall(SYS_getpid);
  }
  </code></pre>
  
  <p><code>tespid.c</code> constains code which uses getpid as shown below and which is compiled by doing </p>
  
  <pre><code>gcc testpid -o testpid.c
  </code></pre>
  
  <p>What can be the problem here? Why is LD_PRELOAD not working?</p>
  
  <pre><code>// testpid.c
  #include &lt;sys/syscall.h&gt;
  #include &lt;sys/types.h&gt;
  #include &lt;unistd.h&gt;
  #include &lt;stdio.h&gt;
  
  int main()
  {
      printf( "pid = %d!\n", getpid() );
  
      return 0;
  }
  </code></pre>