Issues with executable: file not found after using chmod to fix permissions
Turns out the blackbox
executable was a 32-bit program, and I am running a 64-bit OS. Here's the (somewhat hacky) steps I took to resolve this issue (partially chronicled in this question on Superuser):
-
uname -m
told me I have a 64-bit OS, butfile blackbox
told me that this exe was 32-bit. -
ldd blackbox
(strangely) told me that the file was not a dynamic executable, even though I also saw this fromfile
. Tryingreadelf -l ./blackbox | grep ld-linux
told me[Requesting program interpreter: /lib/ld-linux.so.2]
, which was a shared library that I didn't have at that location. -
sudo apt-get install libc6-i386
to get that library file (found that with a package search on packages.ubuntu.com). - Now
ldd
gave me output, and I was missinglibstdc++.so.6
andlibgcc_s.so.1
(see my edit), so I needed to get these files. - After a bit more pacakage searching, I found that the
gcc-snapshot
package had the two files I was missing. This is probably a massive hammer for my tiny nail, and there are likely better solutions, butsudo apt-get install gcc-snapshot
got me the files I needed. - After running
ldd
again, this resolved the issue withlibgcc_s.so.1
, butlibstdc++.so.6
was still not found. I ended up going to the place whereldd
foundlibgcc_s.so.1
and runningsudo ln -s /usr/lib/gcc-snapshot/lib32/libstdc++.so.6 libstdc++.so.6
to get a symlink to the recently installed file.
Related videos on Youtube
wlyles
I am a Computer Engineering and Applied Mathematics major at Texas A&M University. My first experience with computer science was during my senior year in high school, and I have enjoyed and pursued it ever since.
Updated on September 18, 2022Comments
-
wlyles about 1 year
I have downloaded and extracted the Linux binary for the blackbox PDDL planner, and I'm trying to get the
blackbox
file to execute. I changed to the directory with the file and tried./blackbox
, which gave me a permissions error. No big deal, just runchmod 755 blackbox
to give it executable permissions. But then, when I try./blackbox
again, I get the following error:bash: ./blackbox: No such file or directory
It does the same when I give the command arguments. When I run
ls -l
though, I see theblackbox
file and it has-rwxr-xr-x
permissions, so I'm not sure why it's "losing" the file.I'm running Ubuntu 14.04 as a dual boot with Windows 7, if that matters.
EDIT: I found a helpful question over on Superuser, which has gotten me partially there. I ran
readelf -l ./blackbox | grep ld-linux
to find what I needed, then did a package content search to find out I needed thelibc6-i386
package. Now I can do the following:user@ubuntu:~/path$ ./blackbox ./blackbox: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory user@ubuntu:~/path$ ldd blackbox linux-gate.so.1 => (0xf77af000) libstdc++.so.6 => not found libm.so.6 => /lib32/libm.so.6 (0xf774f000) libgcc_s.so.1 => not found libc.so.6 => /lib32/libc.so.6 (0xf75a4000) /lib/ld-linux.so.2 (0xf77b0000)
-
steeldriver over 8 yearsIs your system 32 bit or 64 bit? what is the output of commands
file blackbox
andldd blackbox
? -
wlyles over 8 years@steeldriver I've solved part of the problem. Now I get output from
ldd
, which I've posted in an edit to the question
-
-
steeldriver over 8 yearsA less hacky solution would probably be to enable i386 multiarch using
sudo dpkg --add-architecture i386
, then update your repositoriessudo apt-get update
after which you could have explicitly installed thelibc6:i386
andlibstdc++6:i386
packages in the normal way