I was working on an application, made some changes and now it won't even run anymore. I've reverted the changes, rebuilt the entire application, and still no luck. I don't understand how this error could arise? I erased the .o files and did a brand new build and it's still not working. I didn't change the build settings, I only modified some .cpp files.
How can I resolve the issue of my executable no longer being executable?
ls -l
-rwx--x--x 1 root root 6344081 Sep 16 23:35 z*
gdb output
[root@ipfrmk /]# gdb z
GNU gdb (GDB) 7.10
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "arm-buildroot-linux-gnueabihf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
"/z": not in executable format: File truncated
(gdb) run z
Starting program: z
No executable file specified.
Use the "file" or "exec-file" command.
This doesn't relate to my issue because I am not changing from any sort of 32-bit to 64-bit or vice versa
Most of the issues I see are for "file format not recognized" or some sort of truncated core file issue and those don't apply to my issue I don't believe...
File Output
[root@ipfrmk /]# file z
z: ERROR: ELF 32-bit LSB executable, ARM, EABI5 version 1 (GNU/Linux), statically linked, interpreter lib/ld-linux-armhf.so.3 error reading (Invalid argument)
There is plenty of file system space available (the app is about 63kb)
Filesystem Size Used Available Use% Mounted on
/dev/root 487.8M 189.9M 272.9M 41% /
I checked the md5sum match on both the build machine and the device
Build VM
# md5sum /app/z
e901ef35e43d91545fb9d968c078dce2 /app/z
Device Machine
[root@ipfrmk /]# md5sum z
e901ef35e43d91545fb9d968c078dce2 z
Update:
Previous suspects have been eliminated: filesystems have enough space and md5sum
matches between the build and target hosts.
This leaves only one likely possibility: the build toolchain has been corrupted in some way, and produces broken binary.
In particular, I missed this part of the output:
z: ERROR: ELF 32-bit LSB executable, ARM, EABI5 version 1 (GNU/Linux), \
statically linked, interpreter lib/ld-linux-armhf.so.3 error reading (Invalid argument)
The binary can't be both statically linked
and having an ld/ld-linux-armhf.so.3
interpreter. And the interpreter should be an absolute path.
Previous answer:
Most of the issues I see are for "file format not recognized" or some sort of truncated core file issue and those don't apply to my issue I don't believe...
The two very common reasons for this error:
ftp
in ASCII mode, resulting in a corrupt file.Verifying that e.g. md5sum
on the build host and the target matches would eliminate both possibilities.