4

I'm trying to deploy a python 3 application to an embedded linux (Yocto) machine with armv7-architecture. Because of the limited packages, I am creating a standalone file with cx-freeze on my raspberry pi (which has the same armv7 architecture). Now if I try to run the created binary file on the target machine I get an error which indicates that the source was compiled for another platform:

root@target:/media/sda/dist# ./helloworld
-sh: ./helloworld: No such file or directory

This executable works on the build machine.

I have compared the outputs of the file-command with another application which runs on the target machine:

This is the file which does not work:

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

And this is another binary which does work on the target machine:

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

The only difference seems to be the minimum required kernel-version, but uname shows that the actual version is 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

uname output of the raspberry pi build machine:

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

What am I doing wrong here? It should not be an issue with the actual python code or dependencies, I tried it with a very simple helloworld application with one line of code.

EDIT

Output of ldd command on build machine (exe created with nuitka):

pi@raspberrypi ~/py/helloworld/helloworld.dist $ ldd helloworld.exe
    /usr/lib/arm-linux-gnueabihf/libcofi_rpi.so (0x76faf000)
    libdl.so.2 => /home/pi/py/helloworld/helloworld.dist/./libdl.so.2 (0x76fa4000)
    libpython3.2mu.so.1.0 => /home/pi/py/helloworld/helloworld.dist/./libpython3.2mu.so.1.0 (0x76ccf000)
    libstdc++.so.6 => /home/pi/py/helloworld/helloworld.dist/./libstdc++.so.6 (0x76bfd000)
    libm.so.6 => /home/pi/py/helloworld/helloworld.dist/./libm.so.6 (0x76b8c000)
    libgcc_s.so.1 => /home/pi/py/helloworld/helloworld.dist/./libgcc_s.so.1 (0x76b64000)
    libc.so.6 => /home/pi/py/helloworld/helloworld.dist/./libc.so.6 (0x76a33000)
    /lib/ld-linux-armhf.so.3 (0x76fbc000)
    libz.so.1 => /home/pi/py/helloworld/helloworld.dist/./libz.so.1 (0x76a15000)
    libexpat.so.1 => /home/pi/py/helloworld/helloworld.dist/./libexpat.so.1 (0x769ec000)
    libpthread.so.0 => /home/pi/py/helloworld/helloworld.dist/./libpthread.so.0 (0x769cd000)
    libutil.so.1 => /home/pi/py/helloworld/helloworld.dist/./libutil.so.1 (0x769c2000)

EDIT 2

I tried nuitka to compile the python code and create a standalone application by using:

nuitka --standalone --recurse-all helloworld.py

which produces an executable helloworld.exe file along with all compiled libary files (.so). However, on the target machine, when I try to run this I still get:

root@target:~/helloworld/helloworld.dist# ./helloworld.exe -sh: ./helloworld.exe: No such file or directory

Unfortunately I cannot run the ldd or readelf command on the target machine because their packages are missing.

EDIT 3

It seems that it really lacked some libraries. For experimental purposes, I copied the ld-linux-armhf.so.3 from the raspi to the embedded system and it showed a different error (another library missing). I think another problem is that the raspberry pi uses hardfloat (armhf) whereas the embedded system uses softfloat.. I don't think I can get this to work this way.

EDIT 4 I'm using another platform and os now and everything works so the question is no longer relevant to me.

4

1 回答 1

0

在你的目标机器上运行这个命令:

chmod +x helloworld

它使您的文件可执行。

于 2015-12-05T16:22:26.823 回答