Linux 为什么在尝试运行此可执行文件时出错?
我正在尝试将python 3应用程序部署到具有armv7体系结构的嵌入式linux(Yocto)机器上。由于软件包有限,我在raspberry pi(具有相同的armv7体系结构)上创建了一个带有cx冻结的独立文件。现在,如果我尝试在目标机器上运行创建的二进制文件,我会得到一个错误,表明源代码是为另一个平台编译的:Linux 为什么在尝试运行此可执行文件时出错?,linux,cx-freeze,nuitka,Linux,Cx Freeze,Nuitka,我正在尝试将python 3应用程序部署到具有armv7体系结构的嵌入式linux(Yocto)机器上。由于软件包有限,我在raspberry pi(具有相同的armv7体系结构)上创建了一个带有cx冻结的独立文件。现在,如果我尝试在目标机器上运行创建的二进制文件,我会得到一个错误,表明源代码是为另一个平台编译的: root@target:/media/sda/dist# ./helloworld -sh: ./helloworld: No such file or directory 此可执
root@target:/media/sda/dist# ./helloworld
-sh: ./helloworld: No such file or directory
此可执行文件在生成计算机上工作
我已将file命令的输出与目标计算机上运行的另一个应用程序进行了比较:
root@target:/usr/bin# file demo-application
demo-application: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, BuildID[sha1]=bd6660c43d9e98c59dfa8b16eb26277aa4f19949, stripped
chmod +x helloworld
这是不起作用的文件:
root@target:/media/sda/dist# file helloworld
helloworld: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.26, BuildID[sha1]=99b2ae19f1e65dc26b6fd7d8b1dbc83f974830bd, stripped
这是另一个在目标机器上工作的二进制文件:
root@target:/usr/bin# file demo-application
demo-application: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, BuildID[sha1]=bd6660c43d9e98c59dfa8b16eb26277aa4f19949, stripped
chmod +x helloworld
唯一的区别似乎是所需的最低内核版本,但uname显示实际版本为3.0.35:
root@target:/media/sda/dist# uname -a
Linux Target-Machine 3.0.35-Yocto-21.0-r5061-0-svn2437 #1 PREEMPT Fri Jun 19 21:40:10 CEST 2015 armv7l GNU/Linux
取消raspberry pi构建机的输出:
pi@raspberrypi ~/py/helloworld $ uname -a
Linux raspberrypi 3.18.11-v7+ #781 SMP PREEMPT Tue Apr 21 18:07:59 BST 2015 armv7l GNU/Linux
我做错了什么?对于实际的python代码或依赖项来说,这不应该是一个问题,我用一行代码尝试了一个非常简单的helloworld应用程序
编辑
生成计算机上ldd命令的输出(使用nuitka创建的exe):
编辑2
我尝试了nuitka
编译python代码,并使用以下方法创建一个独立的应用程序:
nuitka——独立——递归所有helloworld.py
它将生成一个可执行的helloworld.exe文件以及所有已编译的库文件(.so)。
但是,在目标机器上,当我尝试运行此操作时,仍然会得到:
root@target:~/helloworld/helloworld.dist#/helloworld.exe
-sh:./helloworld.exe:没有这样的文件或目录
不幸的是,我无法在目标计算机上运行ldd
或readelf
命令,因为它们的包丢失了
编辑3
它似乎真的缺少一些图书馆。出于实验目的,我将ld linux armhf.so.3从raspi复制到嵌入式系统,它显示了一个不同的错误(另一个库丢失)。我认为另一个问题是raspberry pi使用硬浮点(armhf),而嵌入式系统使用软浮点。。我想我不能这样做
编辑4
我现在正在使用另一个平台和操作系统,一切正常,所以这个问题不再与我相关 在目标计算机上运行此命令:
root@target:/usr/bin# file demo-application
demo-application: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, BuildID[sha1]=bd6660c43d9e98c59dfa8b16eb26277aa4f19949, stripped
chmod +x helloworld
它使您的文件可执行。如果在二进制文件上运行ldd命令,输出是什么?@ojblass它说:
root@target:/media/sda/dist#ldd helloworld-sh:ldd:command未找到
@ojblass编辑了我的问题sda是什么类型的分区?分机(2,3,4),NTFS?如果是NTFS,则不会work@cookiesoft当我尝试从根主目录运行它时,也会出现相同的错误:root@target:~/dist#./helloworld-sh:/helloworld:没有这样的文件或目录