Every once in a while, I’ll import an R
or Python
library and I’ll get an error telling me that it can’t find some scary fortran library. This happened in R
:
If I really needed that library I would either cry and/or try to uninstall and install everything again, hoping things would get solved. I eventually learned the proper fix, so I though I’d share it with you. I use a Mac, but I’m guessing very similar (if not the same) steps apply for Linux.
The usual problem is that you have the dynamic library (dylib
) but the compiled .so
file is looking at it in the wrong place.
For this example, let’s look at minqa.so
, which is trying to find libgfortran.3.dylib
in gcc/4.9/
.
To check the references of minqa.so
, we run on the terminal:
which printed:
Ok. I looked at my lib/gcc
folder and realized I had version 5, not 4.9. The libgfortran3.dylib
was there in the 5 folder. How can I communicate the good news to minqa.so
?
You might need to put sudo
before that command.
In general the syntax is
If you don’t know where the dylib
library is, you can search for it with Spotlight or with locate
on the command line.
Also, sometimes the dylib
won’t even have a location and the otool
step will output only libgfortran.3.dylib
. The same steps above apply, but the old_location
will just be the name of the dynamic library.
You can read more about this issue in this stackoverflow question