我正试图用patchelf修补MuJoCo二进制文件.

我跑了patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) ./bin/basic. run patchelf --print-interpreter bin/basic给我/nix/store/33idnvrkvfgd5lsx2pwgwwi955adl6sk-glibc-2.31/lib/ld-linux-x86-64.so.2分.

现在,如果我运行./bin/basic,我会得到输出:bash: ./bin/basic: cannot execute binary file: Exec format error

ldd ./bin/basic分让我得到not a dynamic executable分,我觉得这很奇怪.

file ./bin/basic%的yield 率:

./bin/basic: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /nix/store/33idnvrkvfgd5lsx2pwgwwi955adl6sk-glibc-2.31/lib/ld-linux-x86-64.so.2, for GNU/Linux 3.7.0, not stripped

我觉得这没问题.我认为头球可能有问题,所以我try 了readelf -h bin/basic次,这给了我:

ELF Header:
  Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF64
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           AArch64
  Version:                           0x1
  Entry point address:               0x232f70
  Start of program headers:          64 (bytes into file)
  Start of section headers:          293584 (bytes into file)
  Flags:                             0x0
  Size of this header:               64 (bytes)
  Size of program headers:           56 (bytes)
  Number of program headers:         12
  Size of section headers:           64 (bytes)
  Number of section headers:         28
  Section header string table index: 26

这就是我到目前为止得到的:

  • filereadelf -h都认为它是一个动态链接的可执行文件
  • 试图运行它失败了
  • ldd认为它不是一个动态链接的可执行文件

有人知道这里的问题是什么吗?

我怀疑elf文件中有一些无效的东西,filereadelf没有注意到.

有没有一个工具可以用来用elf文件搜索此类问题?

推荐答案

看起来您正试图在x86_64系统上使用AArch64二进制文件.

Linux相关问答推荐

PERF显示不应该执行指令的内核的用户空间周期

如果在两种模式之间找到文本,则使用sed删除它们之间的所有行

将十六进制文件名转换为十进制

Boost更新失败,现在不确定我有哪个版本

inotifywait 可以说文件在另一个进程可以访问之前已关闭吗?

将 Visual Studio C++ 项目迁移到 Linux 和 CMake

如何使用正则表达式在 LINux 中查找具有不同结尾的多个文件?

使用打印命令 Select 子域

函数在 shell 脚本中抛出错误语法错误:} unexpected

tmux:挂起不加载,不响应任何选项命令

Linux中没有X.org的OpenGL

SVN 错误:无法将字符串从本机编码转换为UTF-8

如何下载较旧的 google play 服务?

bash shell 脚本函数定义(如f () {})中使用的括号是什么?它与使用function关键字不同吗?

scp 使用私钥身份验证将目录复制到另一台服务器

zsh/bash 上不区分大小写的 Glob

Docker Volume 没有挂载任何文件

如何获取 GNU Makefile 中使用的 shell 命令的退出状态?

如何使用cp从不同目录复制多个文件?

Linux(Ubuntu)终端-如何查看以前的页面不再可见