1

I just got back to working in R on Arch, but got the following error when trying to open R

▶ R
/usr/lib64/R/bin/exec/R: error while loading shared libraries: libgfortran.so.3: cannot open shared object file: No such file or directory

This is my r info

▶ pacman -Qi r
Name            : r
Version         : 3.4.1-1
Description     : Language and environment for statistical computing and graphics
Architecture    : x86_64
URL             : http://www.r-project.org/
Licenses        : GPL
Groups          : None
Provides        : None
Depends On      : blas  lapack  bzip2  libpng  libjpeg  libtiff  ncurses  pcre  readline  zlib  perl  gcc-libs  libxt  libxmu
                  pango  xz  desktop-file-utils  zip  unzip
Optional Deps   : tk: tcl/tk interface [installed]
                  texlive-bin: latex sty files [installed]
                  gcc-fortran: needed to compile some CRAN packages [installed]
Required By     : rstudio-desktop-bin
Optional For    : None
Conflicts With  : None
Replaces        : None
Installed Size  : 58.13 MiB
Packager        : Antonio Rojas <arojas@archlinux.org>
Build Date      : Fri 30 Jun 2017 10:45:26 AM PDT
Install Date    : Sat 15 Jul 2017 11:47:54 PM PDT
Install Reason  : Explicitly installed
Install Script  : No
Validated By    : Signature

symlink

▶ ls -halt /usr/lib/libgfortran.so.*
-rwxr-xr-x 1 root root 7.1M Jun 30 05:20 /usr/lib/libgfortran.so.4.0.0
lrwxrwxrwx 1 root root   20 Jun 30 05:20 /usr/lib/libgfortran.so.4 -> libgfortran.so.4.0.0

I found the following question R v3.4.0-2 unable to find libgfortran.so.3 on Arch, but I was unable to follow the solution. When a tried to yaourt the r-devel package I was getting package build errors. I also tried to use a different version of gfortran, but ran into problems there. I was wondering if anyone could break the solution to this problem down a little more.

funilrys
  • 787
  • 9
  • 20
Alex
  • 2,603
  • 4
  • 40
  • 73
  • Check this out https://bbs.archlinux.org/viewtopic.php?id=226849 – Reuben_v1 Jul 17 '17 at 05:51
  • It might be worth checking that all relevant paths in your system's PATH variable was updated when you installed to the latest version of R – Martin Smith Jul 17 '17 at 05:57
  • Looks like the system is looking for 64 bit libraries but you have install 32 bit? – Raman Sailopal Jul 17 '17 at 08:49
  • @Reuben_v1 uninstalled then reinstalled the r package, but I am getting the same error. – Alex Jul 17 '17 at 14:41
  • Ah I see, check this out. I can see that even you are using v 4.0 as described here https://codedump.io/share/FBGw5Xlp72N1/1/r-v340-2-unable-to-find-libgfortranso3-on-arch – Reuben_v1 Jul 17 '17 at 20:24
  • @Reuben_v1 I gave the older version of gcc a shot, but I am not having much luck. Do know know of a way to revert gcc to an older version? – Alex Jul 18 '17 at 02:20

2 Answers2

1

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.

crypdick
  • 16,152
  • 7
  • 51
  • 74
  • 1
    The diagnostic maneuver also succeeds on Ubuntu with the small variation that R is in `/usr/lib/R/bin/exec/R` – IRTFM May 10 '19 at 15:48
0

Another possible explanation, in case it happens to someone else than me:

In my case, I didn't overwrite neither blas nor lapack. But the package that I had and who was providing both was openblas-lapack. For some reason, I was encountering the same problem by trying to use python numpy. The solution has been to replace this package by openblas and lapack separately.

Emile D.
  • 602
  • 2
  • 11
  • 20