title: gcc - compile for another machine does not work
body: <p>I'm having following issue:</p>
  
  <ul>
  <li>I have legacy system - ARM CPU.</li>
  <li>On legacy system I don't have devel libs and also don't have GCC.</li>
  <li>On legacy system I don't have enough resources (mainly RAM and SWAP is not possible) to compile.</li>
  </ul>
  
  <p>I need to compile very simple program that I have source for. When I compile it on another machine that have also ARM CPU (a bit newer) with following GCC commands:</p>
  
  <pre class="lang-none prettyprint-override"><code>gcc -mcpu=arm920t -march=armv4t -o app app.c
  </code></pre>
  
  <p>(-mcpu and -march is set to CPU of legacy system)</p>
  
  <p>When I copy this compiled file to legacy system, make it executable and try to run it I get following message:</p>
  
  <pre class="lang-none prettyprint-override"><code>$ ./app
  -sh: ./app: No such file or directory
  $ ls -lah
  total 237K
  drwxr-xr-x  2 root    root    0 Apr  4 07:35 .
  drwxr-xr-x  4 root    root    0 Dec 31  1969 ..
  -rwxr-xr-x  1 root    root 108K Mar 14 09:23 app
  $
  </code></pre>
  
  <p>There is no problem with path, partition is <strong>not</strong> mounted with noexec option. When I copy any system (for example cat) file into same directory I can launch it without problem.</p>
  
  <p>Here is difference between application I compiled (1st result) and application that was already on system (2nd result):</p>
  
  <pre class="lang-none prettyprint-override"><code>$ readelf -h app
  ELF Header:
    Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
    Class:                             ELF32
    Data:                              2's complement, little endian
    Version:                           1 (current)
    OS/ABI:                            UNIX - System V
    ABI Version:                       0
    Type:                              EXEC (Executable file)
    Machine:                           ARM
    Version:                           0x1
    Entry point address:               0xa278
    Start of program headers:          52 (bytes into file)
    Start of section headers:          100104 (bytes into file)
    Flags:                             0x5000002, has entry point, Version5 EABI
    Size of this header:               52 (bytes)
    Size of program headers:           32 (bytes)
    Number of program headers:         10
    Size of section headers:           40 (bytes)
    Number of section headers:         38
    Section header string table index: 35
  $
  </code></pre>
  
  <p>And:</p>
  
  <pre class="lang-none prettyprint-override"><code>$ readelf -h cat
  ELF Header:
    Magic:   7f 45 4c 46 01 01 01 61 00 00 00 00 00 00 00 00
    Class:                             ELF32
    Data:                              2's complement, little endian
    Version:                           1 (current)
    OS/ABI:                            ARM
    ABI Version:                       0
    Type:                              EXEC (Executable file)
    Machine:                           ARM
    Version:                           0x1
    Entry point address:               0x8c34
    Start of program headers:          52 (bytes into file)
    Start of section headers:          15220 (bytes into file)
    Flags:                             0x2, has entry point, GNU EABI
    Size of this header:               52 (bytes)
    Size of program headers:           32 (bytes)
    Number of program headers:         6
    Size of section headers:           40 (bytes)
    Number of section headers:         24
    Section header string table index: 23
  $
  </code></pre>
  
  <p>Output of <code>file cat app</code>:</p>
  
  <pre class="lang-none prettyprint-override"><code>app: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, not stripped
  cat: ELF 32-bit LSB executable, ARM, version 1, dynamically linked (uses shared libs), for GNU/Linux 2.2.0, stripped
  </code></pre>
  
  <p>I'm not sure what's problem here, as even if application is wrongly compiled I'm expecting to get different error message than 'No such file or directory'.</p>