【问题标题】:32 bit linux executable failing with Exec format error. Binary file not executable32 位 linux 可执行文件因 Exec 格式错误而失败。二进制文件不可执行
【发布时间】:2022-01-18 07:28:22
【问题描述】:

我在 linux 64 位机器上构建了一个 32 位二进制文​​件并尝试运行。

它因错误执行格式错误而失败。二进制文件不可执行。

./test

./test: Exec format error. Binary file not executable.



file test

test: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=b8710a266a084a5d6e8d63a585cc6824e382a5e6, not stripped

机器详情

uname -a

Linux den03cif 4.1.12-124.52.5.el7uek.x86_64 #2 SMP Wed Jul 21 14:58:50 PDT 2021 x86_64 x86_64 x86_64 GNU/Linux

【问题讨论】:

  • 那是一个旧的可执行文件。你是从哪里弄来的?程序应该做什么?你可以访问它的源代码吗?你能重建它吗?
  • 您是否安装了 32 位环境才能运行 32 位应用程序?
  • 以上测试是我的代码的一部分。我有一些测试运行正常,只有一个报告了这个错误。
  • 您介意添加“file another_test”的输出吗?您编译“测试”的方式与其他测试不同吗? “ldd test”的输出是什么?

标签: c linux


【解决方案1】:

我很确定这是因为您的机器架构是 x86_64,但您正在尝试运行适用于 i386 架构的东西

【讨论】:

  • 你可以在 x86-64 上运行 i386 镜像没有任何问题,只要安装了相应的库
  • @phuclv 也许他缺少 i386 库。
  • 如果缺少库,错误应该是不同的。我宁愿想象一个二进制文件损坏(例如,在 ascii 模式下的 ftp 下载)。
猜你喜欢
  • 1970-01-01
  • 2017-06-26
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-06-28
相关资源
最近更新 更多