title: How do you cross compile ELF executables for Android?
body: <p>I have prepared a sample C code below to make it run on Android Operating System by following these procedures,</p>
  
  <pre><code>/*test.c file*/
  #include &lt;stdio.h&gt;
  
  int
  main(int argc, char **argv)
  {
      printf("Android Test Application.\n");
      return 0;
  }
  </code></pre>
  
  <blockquote>
    <p>$ arm-none-linux-gnueabi-gcc -o test test.c -Wall</p>
  </blockquote>
  
  <p>I copied the binary file --test-- into target device "/system/bin" directory.</p>
  
  <p>When I attempt to make cross-compiled binary run on the target system, I am getting this error</p>
  
  <blockquote>
    <p>$ pwd</p>
    
    <p>/system/bin</p>
    
    <p>$ ./test </p>
    
    <p>bash: ./test: No such file or directory</p>
    
    <p>$ ls -al | grep test</p>
    
    <p>-rwxr-xr-x  1 0 0 8384 2011-12-22 15:26 test</p>
  </blockquote>
  
  <p>although the binary file --test-- is already in "/system/bin" directory. </p>
  
  <p>My cross-compiler is</p>
  
  <blockquote>
    <p>$ arm-none-linux-gnueabi-gcc --version</p>
    
    <p>arm-none-linux-gnueabi-gcc (Sourcery G++ Lite 2009q1-203) 4.3.3
    Copyright (C) 2008 Free Software Foundation, Inc. This is free
    software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
    PURPOSE.</p>
  </blockquote>
  
  <p>Why I am getting this error?</p>
  
  <blockquote>
    <p>bash: ./test: No such file or directory</p>
  </blockquote>