Issues with executable: file not found after using chmod to fix permissions

7,850

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, but file 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 from file. Trying readelf -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 missing libstdc++.so.6 and libgcc_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, but sudo apt-get install gcc-snapshot got me the files I needed.
  • After running ldd again, this resolved the issue with libgcc_s.so.1, but libstdc++.so.6 was still not found. I ended up going to the place where ldd found libgcc_s.so.1 and running sudo ln -s /usr/lib/gcc-snapshot/lib32/libstdc++.so.6 libstdc++.so.6 to get a symlink to the recently installed file.
Share:
7,850

Related videos on Youtube

wlyles
Author by

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, 2022

Comments

  • wlyles
    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 run chmod 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 the blackbox 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 the libc6-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
      steeldriver over 8 years
      Is your system 32 bit or 64 bit? what is the output of commands file blackbox and ldd blackbox?
    • wlyles
      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
    steeldriver over 8 years
    A less hacky solution would probably be to enable i386 multiarch using sudo dpkg --add-architecture i386, then update your repositories sudo apt-get update after which you could have explicitly installed the libc6:i386 and libstdc++6:i386 packages in the normal way