I'm trying to patch the MuJoCo binaries using patchelf
.
I've ran patchelf --set-interpreter $(cat $NIX_CC/nix-support/dynamic-linker) ./bin/basic
. And running patchelf --print-interpreter bin/basic
gives me /nix/store/33idnvrkvfgd5lsx2pwgwwi955adl6sk-glibc-2.31/lib/ld-linux-x86-64.so.2
.
Now, if I run ./bin/basic
I get the output: bash: ./bin/basic: cannot execute binary file: Exec format error
Running ldd ./bin/basic
gives me: not a dynamic executable
, which I thought was strange.
Running file ./bin/basic
yields:
./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
This looks alright to me. I thought there might be something wrong with the header so I tried readelf -h bin/basic
, this gives me:
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
So this is what I've got so far:
file
andreadelf -h
both think it's a dynamically linked executable- Trying to run it fails
ldd
Thinks it's not a dynamically linked executable
Does anyone have an idea what could be the issue here?
I suspect that there is something invalid about the elf file which file
and readelf
is not picking up on.
Is there a tool I can use to search for such issues with an elf file?
CodePudding user response:
Looks like you're trying to use an AArch64 binary on an x86_64 system.