I've built a custom 32-bit non-GUI Raspberry Pi image using Yocto (Morty), built the corresponding SDK, and used the SDK's toolchain to build an app. When I run the app on the RPi, from a command prompt as root, the shell complains:
-sh: /path/to/app: No such file or directory
(with the real app name, obviously). sh
is linked to bash
. Here's what
I've checked:
The app exists, and is the correct executable.
Its execute permission bit is set.
Its ELF file format is the same as the ELF file format of every other command in the system.
The shared libraries it uses all exist, recursively, in /lib or /usr/lib. They are all listed by
ldconfig -p
.There is no
LD_LIBRARY_PATH
variable.If I run the app with
LL_DEBUG=all
, I get the same error, so it isn't even getting as far as loading libraries. (Or perhapsLL_DEBUG
isn't supported on this build.)
Googling didn't turn up any other possibilities. Has anyone seen any other reasons for this error? Or any ideas on how to diagnose it further?
In response to techraf:
If I had mistyped the name, I'd have gotten a "command not found" error. I tried running it by typing the full path. I also tried copying it into /bin and typing its name, in which case the error message showed the path in /bin.
ls -l
showed the x attribute.On the build system,
arm-poky-linux-objdump -f
(from the Yocto SDK) on the app executable showedfile format elf32-littlearm
,architecture: arm, flags 0x00000112
,EXEC_P, HAS_SYMS, D_PAGED
. If I did the same thing to, say, thels
command in the target rootfs in the build tree, it showed the same thing.Using
arm-poky-linux-objdump -x
on the executable and grepping forNEEDED
, I listed all libraries needed by the app executable, then did the same thing on all those libraries in the rootfs, and built a combined list. I then didldconfig -p
on the RPi, and verified that every library that was needed was in the list with the correct versions. Here are the relevant items from the list:ld-linux-armhf.so.3 (ELF) => /lib/ld-linux-armhf.so.3 libasound.so.2 (libc6) => /usr/lib/libasound.so.2 libc.so.6 (ELF, OS ABI: Linux 3.2.0) => /lib/libc.so.6 libcrypto.so.1.0.0 (libc6) => /usr/lib/libcrypto.so.1.0.0 libdl.so.2 (libc6, OS ABI: Linux 3.2.0) => /lib/libdl.so.2 libgcc_s.so.1 (libc6) => /lib/libgcc_s.so.1 libm.so.6 (libc6, OS ABI: Linux 3.2.0) => /lib/libm.so.6 libpthread.so.0 (libc6, OS ABI: Linux 3.2.0) => /lib/libpthread.so.0 librt.so.1 (libc6, OS ABI: Linux 3.2.0) => /lib/librt.so.1 libstdc++.so.6 (libc6) => /usr/lib/libstdc++.so.6
I don't know what the parenthesized items in the list mean, so maybe there's a clue there.
I made sure there was no
LD_LIBRARY_PATH
variable.I tried running
LL_DEBUG=all /path/to/app
and got the same error, with no library loading trace.
I understand that the No such file or directory
error often means a missing library, but I've made sure all the libraries are there and properly cached. So I'm wondering if anyone else knows any other possible cause for this error.
I created an empty C project (just return 0;
inside main
), and got the same error message. I used arm-poky-linux-objdump -x
on both it and the chmod
command, which is the smallest executable my build's /bin
directory. Everything was the same other than section addresses and sizes, except that my dummy program has one .comment
section and chmod
has one .gnu_debuglink
section. Even the .ARM.attributes
sections have the same contents. Yet chmod
loads and runs, while my test program won't load even far enough for ldd
to output any shared library activity. There has to be something wrong with the SDK toolchain, even though it was generated as part of the Linux build.
stat /path/to/app
using the exact path from the error proves this isn't just a typo or something...