R V3.4.0-2 Unable to Find Libgfortran.So.3 on Arch

R v3.4.0-2 unable to find libgfortran.so.3 on Arch

Indeed, gfortran 7 bumps the ligfortran version to version 4. See http://gcc.1065356.n8.nabble.com/patch-fortran-PR77828-Linking-gfortran-7-compiled-program-with-libgfortran-of-5-x-allowed-but-crashes-td1311625.html It is not backwards compatible and some APIs have changed.

If you install an older version of gfortran you will get libgfortran.so.3. It is completely fine to have multiple versions in your system. Maybe there is a way how to rebuild R for version 4, but it will be possibly more work. See other answers how to rebuild the software https://stackoverflow.com/a/50744705/721644

R v3.4.0-2 unable to find libgfortran.so.3 Arch

I just had this issue, except my error message was with libgfortran.so.4. There are many ways this error can happen, because there are various packages from AUR which can overwrite a package from the Arch repos. In my specific case, I had overwritten lapack with atlas-lapack.

Here's how I figured that out.

First, I installed pax-utils so that I can have the lddtree tool. Then I ran lddtree /usr/lib64/R/bin/exec/R, which gave me this output:

/usr/lib64/R/bin/exec/R (interpreter => /lib64/ld-linux-x86-64.so.2)
libR.so => /usr/lib/R/lib/libR.so
libblas.so.3 => /lib64/libblas.so.3
libgfortran.so.4 => None
libatlas.so => /lib64/libatlas.so
# etc...

It lookes like libblas.so.3 was the culprit. Next, I ran pacman -Qo /usr/lib/libblas.so.3, which told me /usr/lib/libblas.so.3 is owned by atlas-lapack 3.10.3-1. So, I uninstalled atlas-lapack and rebuilt R again, and it automaically chose lapack from the Arch repos over the atlas version in AUR.

Octave 4.2.1 octave-gui : cannot find libgfortran.so.3

From the comments it became apparent that the solution from the referenced question R v3.4.0-2 unable to find libgfortran.so.3 on Arch needs to be appended, because the way the older GCC versions will be typically installed in Arch Linux is in a different path.

So, one must find, where the older version is installed, like

   /usr/lib/gcc/x86_64-pc-linux-gnu/5.4.0/libgfortran.so.3

(depending on the exact GCC version)

and then add the version to LD_LIBRARY_PATH or make a symlik of the library from the above path to /usr/lib64/.

Can't get R to recognize installed libgfortran when installing packages

"How do I convince R to look for gcc 8 instead of gcc 7?"

You should not do that! Those libraries are NOT compatible, that's why soname is changed. The ABI is different. You need the correct version of GCC which was used to compile your R package. See very similar (but Linux) questions and answers like R v3.4.0-2 unable to find libgfortran.so.3 on Arch How to install libgfortran.so.4 on ubuntu 16.06

You really need the compatible library or update your R to a version that uses GCC 8.

How to install libgfortran.so.4 on ubuntu 16.06

This is an inverse problem to R v3.4.0-2 unable to find libgfortran.so.3 on Arch

So you must install GCC 7 including the Fortran part, that includes libgfortran 4.

There are answers describing how to do that at other StackExchange sites:

  • Answer 1
  • Answer 2
  • Answer 3

conda gfortran on osx failed link issue

Your gfortran is too new for your version of Python. Your Python requires libgfortran version 3, but GCC 7 has libgfortran version 4. You will have to install GCC version 6 or older.

See a similar issue on Linux R v3.4.0-2 unable to find libgfortran.so.3 on Arch



Related Topics



Leave a reply



Submit