2012-01-31 162 views
2

我刚刚构建了我的金鱼android内核。我写了一个hello world程序,并使用arm-linux-gnueabi-gcc进行编译。我使用adb push将可执行文件放在模拟内核的/ data/local中。我能够使用adb shell ssh进入模拟内核。当我cd到/ data/local目录时,我可以看到我使用adb push的a.out。当我执行#。/ a.out时,出现错误./a.out:找不到。Hello World Android程序

有人可以帮我解决这个问题。

+0

'ldd。/ a.out'的输出是什么? – sarnold 2012-02-01 09:36:44

+0

检查该目录的权限 – 2012-01-31 16:48:08

+0

权限似乎很好! – psteelk 2012-01-31 16:52:41

回答

0

我在编译过程中添加了-static选项。 arm-linux-gnueabi-gcc -static

0

我想这是一个缺少的库问题。我以前也遇到了这个问题,我的解决方法是如下:

[email protected]:~# ./a.out 
-sh: ./a.out: not found 
[email protected]:~# ls /lib /root 
/lib: 
libc.so.6 

/root: 
a.out 
[email protected]:~# 

然后检查其应用程序所需的共享库:

[email protected]:/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] 
... ... 

通过输出,我们可以确认的是,ld-linux.so.3缺失,因此将ld-linux.so.3复制到目标文件系统/ lib目录:

[email protected]:~# ./a.out 
test 
[email protected]:~# ls /lib /root 
/lib: 
ld-linux.so.3 libc.so.6 

/root: 
a.out 
[email protected]:~#