Typically, the "unable to execute... No such file or directory" means that either the executable binary itself or one of the libraries it needs does not exist. Libraries can also need other libraries themselves.
To see a list of libraries required by a specified executable or library, you can use the ldd
command:
$ ldd /usr/local/bin/i686-elf-gcc
If the resulting listing includes lines like
<library name> => not found
then the problem can be fixed by making sure the mentioned libraries are installed and in the library search path.
In this case, the libraries might be at /usr/local/lib
or /usr/local/lib64
, but for some reason that directory is not included in the library search path.
If you want the extra libraries to be available for specific programs or sessions only, you could use the LD_LIBRARY_PATH environment variable to identify the extra path(s) that should be searched for missing libraries. This will minimize the chance of conflicts with the system default libraries.
But if you want to add a library directory to the system default library search path, you should add it to /etc/ld.so.conf
file, or create a /etc/ld.so.conf.d/*.conf
file of your choice and then run the ldconfig
command as root to update the library search cache.
For example, if the missing libraries are found in /usr/local/lib64
and /etc/ld.so.conf.d
directory exists, you might want to create crosscompiler.conf
file like this:
# echo "/usr/local/lib64" > /etc/ld.so.conf.d/crosscompiler.conf
# ldconfig
root
. Can you please explain me the reason for running the command withsudo
? – Thushi Dec 29 '17 at 11:22i386*
file. – jimmij Dec 29 '17 at 11:22i686-elf-gcc
file – Thushi Dec 29 '17 at 11:24