ARM上显示hello not found问题
ARM上显示hello not found问题
**************************环境参数************************************
mini2440 ARM Linux 启动内核信息如下:
Linux version 2.6.29.4-FriendlyARM (gcc version 4.3.2)
[PC 虚拟机 redhat Linux]# uname -r
2.6.18-53.el5
[PC 虚拟机 redhat Linux]# arm-linux-gcc -v
gcc version 4.3.2
[PC 虚拟机 redhat Linux]# gcc -v
gcc version 4.3.2
****************************问题出现************************************
[root] # ./hello
-/bin/sh: ./hello: not found
****************************解决步骤************************************
1.ARM上先确保文件权限
A.确保本文件夹下有hello这个可执行文件
B.确保hello具有执行权限ls -l;chmod +x hello
2.试一试静态编译make static是否可以
PC 虚拟机 Linux上#arm-linux-gcc -static -o hello.c hello
ARM Linux #./hello若可以,说明是动态编译缺少动态库导致的
3.查看所需要的动态库
PC 虚拟机 Linux上#arm-linux-readelf -a hello | grep NEEDED
出来的内容就是你需要的库,确保你的开发板上有这些库。
[root@localhost 01hello]# arm-linux-readelf -a hello | grep NEEDED
0x00000001 (NEEDED) Shared library: [libc.so.6]
[root@localhost 01hello]# cd /lib/
[root@localhost lib]# ls libc.so.6
libc.so.6
[root@localhost lib]# file libc.so.6
libc.so.6: symbolic link to `libc-2.5.so'
[root@localhost lib]# ls libc-2.5.so
libc-2.5.so
[root@localhost lib]# file libc-2.5.so
libc-2.5.so: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.9, not stripped
4.把需要的动态库及指向的连接cp到ARM /lib下
[ARM/lib] # ls
libc-2.5.so libc.so.6 modules
**************************有个疑问**********************************
libc.so.6 libc-2.x.so文件在PC虚拟机Linux/lib下 和 usr/local/4.3.2.../lib都有存在
我是拷贝哪个文件夹下的libc.so.6 libc-2.x.so到ARM开发板上
**************************问题仍然**********************************
为什么我还是出现了同样的问题
[root] # ./hello
-/bin/sh: ./hello: not found