I have a collection of binaries I installed on a Linux machine. They require the libgfortran
library, but on execution display the following message:
error while loading shared libraries: libgfortran.so.2: cannot open shared object file: No such file or directory
The machine already had libgfortran
installed, but the name of the library file was libgfortran.so.1.0.0
(and libgfortran.so.1
linked to it).
To my surprise, by simply making a symbolic link libgfortran.so.2
to libgfortran.so.1
, as follows:
ln -s /usr/lib64/libgfortran.so.1 /usr/lib64/libgfortran.so.2
this solved my problem and the binaries were able to run, apparently without error.
My question is - why did they even run at all?
Is there not an inbuilt mechanism to detect when the API version is different, or is it only based on the filename?
If there is API detection - then should there not have been a symbol error?
Indeed, what is the purpose of having different major versions between libraries if they are in fact compatible?
(Note to answerers: my question is not about libgfortran
in particular, this is just an illustrative example.)