“-sh:executable_path:not found”是什么意思

Shr*_*han 2 linux shell embedded-linux raspberry-pi

我正在尝试在 linux shell 中运行一个可执行文件(树莓派上的 OpenELEC)

OpenELEC:~ # /storage/fingi/usr/lib/autossh/autossh
-sh: /storage/fingi/usr/lib/autossh/autossh: not found
Run Code Online (Sandbox Code Playgroud)

在这种情况下,“未找到”是什么意思?

如果我尝试做 ldd:

OpenELEC:~ # ldd  /storage/fingi/usr/lib/autossh/autossh
/usr/bin/ldd: eval: line 1: /storage/fingi/usr/lib/autossh/autossh: not found
Run Code Online (Sandbox Code Playgroud)

如果我做文件:

OpenELEC:~ # file /storage/fingi/usr/lib/autossh/autossh
/storage/fingi/usr/lib/autossh/autossh: ELF 32-bit LSB  executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.26, BuildID[sha1]=599207c47d75b62ede5f214f9322ae2a18643eb7, stripped
Run Code Online (Sandbox Code Playgroud)

文件类型格式正确。但它不会工作,也不会给出更多描述性错误消息。

由于 openELEC 非常严格,我从 raspbmc 安装复制了 autossh 可执行文件。我也为其他几个可执行文件(屏幕、boost 库等)做过这件事,它们工作得很好。

谁能建议可能是什么问题?

编辑 1:正如所建议的,这是正在工作的可执行文件(也从 raspbmc 复制)上的文件命令的输出:

OpenELEC:~ # file /storage/fingi/usr/bin/screen
/storage/fingi/usr/bin/screen: ELF 32-bit LSB  executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.26, BuildID[sha1]=5c58f047a25caa2c51a81d8285b4f314abc690e7, stripped
Run Code Online (Sandbox Code Playgroud)

saw*_*ust 5

在这种情况下,“未找到”是什么意思?

这通常意味着可执行文件无法找到一个或多个(共享)库来满足其外部符号。
这通常发生在没有库存储在 initramfs 中,或者缺少可执行文件所需的共享库时。
如果可执行文件是使用与运行时库不兼容的 C 库(例如 uClibc 与 glibc/eglibc)构建的,也会发生这种情况。

strings executable | less是查看可执行文件所需的所需库和外部符号的最快方法。
或者
通过指定-static选项重新编译您的程序并使用静态链接。