官方app编译环境编译的应用程序可以在开发板自带的系统中运行,自己编译并烧写了系统,却提示:
root@imx6ulevk:/root# ./VTTerminal -sh: ./VTTerminal: No such file or directory
查看文件信息,发现没有什么错误
root@imx6ulevk:/root# file VTTerminal VTTerminal: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.3, for GNU/Linux 2.6.32, BuildIDd
tony建议查看下是否缺少相关库,于是我查看依赖:
root@imx6ulevk:/root# arm-poky-linux-gnueabi-readelf -a VTTerminal | grep "Shared" 0x00000001 (NEEDED) Shared library: [libpthread.so.0] 0x00000001 (NEEDED) Shared library: [libc.so.6]
然后跑到/lib, /usr/lib下查看库是否缺失,答案为否,使用ld debug和strace命令继续追踪
root@imx6ulevk:~# strace -f -F -o ~/log.txt ./VTTerminal log文件为 962 execve("./VTTerminal", ["./VTTerminal"], [/* 15 vars */]) = -1 ENOENT (No 962 write(2, "strace: exec: No such file or di"..., 40) = 40 962 exit_group(1) = ? 962 +++ exited with 1 +++
在自己的image上不能执行的文件属性:
summer@summer-ThinkPad-X230:/nfsroot/workspace/hello$ file hello
hello: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.3, for GNU/Linux 2.6.32, BuildID[sha1]=3801ca19875a1f217a660eab159099fddbd90974, not stripped
tony提供的可以执行的文件
summer@summer-ThinkPad-X230:/nfsroot/tonys$ file hello
hello: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 2.6.32, BuildID[sha1]=312402ec4e4e472214fbf65068ac3a5ebcb24919, stripped
最终解决方式如下:
cp /lib/ld-linux-armhf.so.3 /lib/ld-linux.so.3
这种情况应该用multi arch来解决比较合适 Tony 18:54:23 直接拷贝并不好 summer 18:55:07 会引入其他问题对吗 Tony 18:55:21 你的环境不统一