0

I'm trying to cross-compile a simple C program for arm using the sourcery toolchain.

#include <stdio.h>
#include <stdlib.h>

int main(void)
{
 system("ls");
}

 arm-none-linux-gnueabi-gcc test.c
 arm-none-linux-gnueabi-strip a.out

 $ file a.out    
 a.out: ELF 32-bit LSB  executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, stripped

Compiles fine, but when I copy it to my android device it's not recognized as an executable binary. Attempting to run it gives me "sh: ./test: No such file or directory".

Any idea what the problem is?

Richard Pennington
  • 19,673
  • 4
  • 43
  • 72
Jocala
  • 243
  • 1
  • 4
  • 16
  • 3
    Android uses a different libc than what the sourcery toolchan uses, you might be able to build a statically linked executable, but you'll be better off using an android toolchain. – nos Oct 04 '14 at 14:12
  • Make this an answer and I'll mark it. Switching to the ndk toolchain worked. – Jocala Oct 04 '14 at 15:38
  • http://stackoverflow.com/a/5239573/1163019 – auselen Oct 04 '14 at 20:53
  • 1
    Reason it says "No such file..." is because dynamically executable file's loader is missing which boils down to not using android toolchain. – auselen Oct 04 '14 at 20:54

0 Answers0