尝试使用 patchelf 修补 MuJoCo 二进制文件时出现“Exec format error”

Getting `Exec format error` when trying to patch MuJoCo binaries with patchelf

我正在尝试使用 patchelf 修补 MuJoCo 二进制文件。

我 运行 patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) ./bin/basic。 运行ning 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,我以为是 st运行ge.

运行 file ./bin/basic 产量:

./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

我觉得这还不错。我认为 header 可能有问题所以我尝试了 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 没有获取的 elf 文件有一些无效的东西。

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

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