【问题标题】:Statically linked binary fails with "applet not found"静态链接的二进制文件因“找不到小程序”而失败
【发布时间】:2020-04-01 04:02:37
【问题描述】:

我在嵌入式 linux 系统上运行busybox v1.27.2。为了测试我的用户空间构建环境,我交叉编译了一个名为“hello”的简单 hello-world 应用程序。系统没有可用的库文件,所以我用 uClibc 静态链接。我已经确认二进制文件是使用文件正确构建的:

hello: ELF 32-bit LSB  executable, ARM, EABI5 version 1 (SYSV), statically linked, not stripped

当我尝试从目标 rootfs 执行时,我得到以下信息:

/ # ./hello
hello: applet not found

我试过从 /usr/bin 和其他目录执行,结果是一样的。我了解当符号链接未正确指向busybox 二进制文件时,可能会出现此消息。但是我很困惑,因为这个应用程序不应该依赖于busybox。任何帮助,将不胜感激。

下面是代码供参考:

// C library headers
#include <stdio.h>
#include <string.h>

int main(int argc, char *argv[])
{
    printf("hello world");
    return 0;
}

【问题讨论】:

  • 你把hello程序复制到目标系统了吗?它位于哪里?
  • @jwdonahue 是的,我确保在重建和刷新内核到目标之前复制到我的 rootfs。 Rootfs 安装为 initramfs。我在 /usr/bin 或 /root 等各种位置都试过了,没有变化。
  • 如果您发布ls -l hello的输出可能会有所帮助。
  • 这是在目标/usr/bin # ls -l hello -rwxr-xr-x 1 589555 hello 上运行的输出

标签: c linux embedded busybox


【解决方案1】:

修复了使用来自 buildroot 的 arm-buildroot-uclinux-uclibcgnueabi-gcc 工具链重新编译 uClibc 和“hello”二进制文件的问题

【讨论】:

    猜你喜欢
    • 2015-02-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-03-28
    • 2015-04-02
    • 1970-01-01
    • 2021-10-29
    相关资源
    最近更新 更多