2

I just built my goldfish android kernel. I wrote a hello world program and compiled using arm-linux-gnueabi-gcc. I used adb push to put the executable in /data/local of the emulated kernel. I was able to ssh into the emulated kernel using adb shell. When I cd into /data/local and ls the directory, I'm able to see the a.out which I had put using adb push. When I do #./a.out, I get the error ./a.out: not found.

Can some one help me on this.

psteelk
  • 1,305
  • 3
  • 16
  • 24

2 Answers2

1

I added the -static option during compilation worked. arm-linux-gnueabi-gcc -static

psteelk
  • 1,305
  • 3
  • 16
  • 24
0

I guess it's a missing library problem. I have met this problem before, my fix is below:

root@evab:~# ./a.out 
-sh: ./a.out: not found
root@evab:~# ls /lib /root
/lib:
libc.so.6

/root:
a.out
root@evab:~# 

Then check which shared library is needed by the application:

leo@leo-VirtualBox:/opt/nfs/root$ arm-linux-readelf a.out -a |grep lib
    [Requesting program interpreter: /lib/ld-linux.so.3]
    0x00000001 (NEEDED)                     Shared library: [libc.so.6]
... ...

By the output, we can confirm that the ld-linux.so.3 is missing, so copy ld-linux.so.3 to target filesystem /lib directory:

root@evab:~# ./a.out 
test
root@evab:~# ls /lib /root
/lib:
ld-linux.so.3 libc.so.6

/root:
a.out
root@evab:~# 
ASGM
  • 11,051
  • 1
  • 32
  • 53
leo
  • 1