I have a third party library file compiled for Linux, when I tried to execute using terminal I get the error:
cannot execute binary file:
File details are as follows:
ELF 64-bit LSB pie executable, x86-64, version 1 (GNU/Linux),
dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for
GNU/Linux 3.2.0, BuildID[sha1]=820d7e089c6c3cdc19fa3e759ccae22fbc672652,
with debug_info, not stripped
I tried installing Rosetta, tried running with the command with a prefix arch -x86_64
but it resulted in the same error.
If I try to execute them on the terminal application directly, it shows the error:
zsh: exec format error:
Related
I am trying to do profiling of the code written in C++ with the target Architecture RISC-V. The code has been cross-compiled using RISC-V GNU Toolchain. My executable is unit_tests "ELF 64-bit LSB executable, UCB RISC-V, version 1 (GNU/Linux), dynamically linked,nterpreter /lib/ld-linux-riscv64-lp64d.so.1, for GNU/Linux 4.15.0, with debug_info, not stripped" this information is retrieved using the file command.
What I am trying to do is the profiling of this using gprof. But to do the gprof gmon.out needs to be generated, to generate gmon.out the executable should be run first. I cannot run the binary elf of other architecture in some different architecture. I need a suggestion for this on which emulator or simulator does this for me or I can run on?
I have tried installing qemu using the follwing link:
https://www.google.com/url?q=https://risc-v-getting-started-guide.readthedocs.io/en/latest/linux-qemu.html&sa=D&source=hangouts&ust=1597422417473000&usg=AFQjCNERr6pHYmj0SU6an3WkBRGQI52aTw
but not able to successfully install it.
Also have tried with spike but got "bad synccall" error. Any leads how can I resolve this issue.
I solved this issue using qemu in user mode. Following the instructions in the below link:
Manual-qemu-user
Where I could run the binary elf generated for target RISC-V, which I could run on x86 Linux machine.
I try to debug this file
and got error
not in executable format: file format not recognized
the 'file' command output
canary: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked,
interpreter /lib/ld-linux.so.2, BuildID[sha1]=377711637c79e57303ff92f946500aed1b42c73a, for
GNU/Linux 3.2.0, not stripped`
the other answer seem not working for me.
The ELF binary executable format is standard in Linux and other Unixes. It is not compatible with macOS, which uses the Mach-O binary format.
Whatever you are attempting to analyze must be recompiled into a Mach-O binary.
macOS Catalina is not supporting 32bit Applications anymore.
I guess this is true for executables too.
See 32-Bit Apps will no longer work on macOS Catalina: Here’s what to do
I am using a 64bit Intel based machine and want to compile and run 32bit C code in my command prompt. I have bash installed via (Windows Subsystems for Linux) and am using gcc and have the gcc-multilib installed so I can compile using the -m32 tag. The program compiles fine but comes up with this error when I try to run:
bash: ./32test: cannot execute binary file: Exec format error
WSL only supports 64-bit ELF binaries.
https://github.com/Microsoft/BashOnWindows/issues/390
You can try to build with a native Windows compiler or in Cygwin instead.
I'm trying to debug a Fortran 95 program using gdb 4.8. When I encounter a breakpoint (or the error I'm trying to debug), I cannot print any information on local variables using the info command. I also get a No symbol tape information available error when running bt full.
I don't believe this is related to the version of gdb as I first tried installing the version from Homebrew and got the same error. I then removed the Homebrew installation and compiled and installed the latest available version of gdb from source. My Fortran file is compiled with the -g flag and the -fbacktrace flag and has no explicit optimization flag, but I have attempted to compile with -O0, -O1, -O2, and -O0. All give the same error.
Possibly related is the fact that, upon running the code, I get loads of warnings. Here is a small excerpt:
warning: `/private/tmp/gcc-dmSW1S/gcc-4.9.2/build/x86_64-apple-darwin14.0.0/libgfortran/.libs/pow_c8_i4.o': can't open to read symbols: No such file or directory.
warning: `/private/tmp/gcc-dmSW1S/gcc-4.9.2/build/x86_64-apple-darwin14.0.0/libgfortran/.libs/pow_c8_i8.o': can't open to read symbols: No such file or directory.
warning: `/private/tmp/gcc-dmSW1S/gcc-4.9.2/build/x86_64-apple-darwin14.0.0/libgfortran/.libs/pow_i16_i16.o': can't open to read symbols: No such file or directory.
warning: `/private/tmp/gcc-dmSW1S/gcc-4.9.2/build/x86_64-apple-darwin14.0.0/libgfortran/.libs/pow_i16_i4.o': can't open to read symbols: No such file or directory.
warning: `/private/tmp/gcc-dmSW1S/gcc-4.9.2/build/x86_64-apple-darwin14.0.0/libgfortran/.libs/pow_i16_i8.o': can't open to read symbols: No such file or directory.
warning: `/private/tmp/gcc-dmSW1S/gcc-4.9.2/build/x86_64-apple-darwin14.0.0/libgfortran/.libs/pow_i4_i16.o': can't open to read symbols: No such file or directory.
warning: `/private/tmp/gcc-dmSW1S/gcc-4.9.2/build/x86_64-apple-darwin14.0.0/libgfortran/.libs/pow_i4_i4.o': can't open to read symbols: No such file or directory.
warning: `/private/tmp/gcc-dmSW1S/gcc-4.9.2/build/x86_64-apple-darwin14.0.0/libgfortran/.libs/pow_i4_i8.o': can't open to read symbols: No such file or directory.
warning: `/private/tmp/gcc-dmSW1S/gcc-4.9.2/build/x86_64-apple-darwin14.0.0/libgfortran/.libs/pow_i8_i16.o': can't open to read symbols: No such file or directory.
I have gcc installed by Homebrew but which gcc returns /usr/bin rather than /usr/local/bin, so this is is probably the default Mac install. /private/tmp/gcc-dmSW1S/ does not exist. Can provide any other information needed.
You are using a sufficiently ancient version of gdb that it won't be able to read debug symbols from your objects compiled with gcc 4.9. The 4.x version of GDB are at least 15 years old and and date back to the gcc 2.95 / egcs era of compilers. Numerous ABI and debug symbol changes make gdb 4.x unsuitable for debugging objects compiled with GCC 4.9.
For objects compiled with GCC 4.9 and default debug symbol output (DWARF4 iirc), you'll want GDB 7.5.1 or newer. The current GDB release is 7.9.
I download the w_scan project(a small command line utility used to perform frequency scans for DVB and ATSC transmissions.) from http://wirbel.htpc-forum.de/w_scan/index_en.html. I also install gcc-arm-linux-gnueabi on my Ubuntu x86_64. I use the ./configure --host=arm-linux CC=arm-linux-gnueabi-gcc command to cross-compile, and it generates a binary file. However, I copy that file to my target board and execute that file, it shows sh: ./w_scan: No such file or directory.
I use the file command to see information of that binary file, it shows ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.31, BuildID[sha1]=0x9a584b4720fadf5eb5b77034ac85092daeb728c9, not stripped.
I found that error message stands the configuration of cross-compile doesn't correct.(reference http://ubuntuforums.org/showthread.php?t=1141792). How can I fix my configuration and correct cross-compile that project, THANKS!
./configure --host=arm-linux CC=arm-linux-gnueabi-gcc
make CFLAGS=-static
copy that binary file to my target board, it can execute normally and successfully.
And the file w_scan will shows
ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.31, BuildID[sha1]=0x67b7e9f93015607f891c0b77493d9e47059ef6a1, not stripped.