Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Got message unable to load shared object stats.so when R starts

Tags:

r

load

I am using R-3.0.2 compiled from source code on Linux 64 and I got the following message when R starts:

Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/home/hlfernandez/Eclipse/workspace/Bioscope/R/linux/x64/R-3.0.2/library/stats/libs/stats.so':
  libgfortran.so.3: cannot open the shared object file: No existe el archivo o el directorio
Durante la inicialización - Mensajes de aviso perdidos
package ‘stats’ in options("defaultPackages") was not found 

Does anybody have any idea about the source of the problem? It is rare that it says that the file or directory does not exist because it actually exists.

My operating system is Kubuntu 13.10, maybe I have any missing library.

like image 794
hlfernandez Avatar asked Jan 24 '14 12:01

hlfernandez


2 Answers

Somehow your system configuration or running environment has changed between the time you compiled R and the time you are using it, in particular the libgfortran.so.3 library is no longer discoverable. Likely if you do

$ R CMD ldd /path/to/R_HOME/library/stats/libs/stats.so

you'll get a list of successfully discovered link dependencies

linux-vdso.so.1 =>  (0x00007fff213ff000)
libRlapack.so => /path/to/R_HOME/lib/libRlapack.so (0x00007fcafa557000)

and then a failure

    libgfortran.so.3 => ???

indicating that libgfortran.so.3 is not found. You could go looking for it

locate libgfortran.so.3

and then figure out what you've done to make it inaccessible to R (maybe ldconfig would be your friend). But libgfortran would most likely be in a standard location, so you've probably removed it in some other operation and need to reinstall it, or recompile R against the new location of libgfortran.

Specify the location of libgfortran using the system command ldconfig (sudo privileges required) or the environment variable LD_LIBRARY_PATH. But really these shouldn't be necessary, libgfortan should have been installed using your OS package manager and in a way that does not require special additional configuration.

like image 98
Martin Morgan Avatar answered Sep 22 '22 02:09

Martin Morgan


EDIT: I have discovered that putting the missing libraries in the directory R/lib solves the problem, thank you very much for the help!

If i run the ldd command I get:

bin/R CMD ldd ./library/stats/libs/stats.so
/home/hlfernandez/Eclipse/workspace/Bioscope/R/linux/x64/R-3.0.2

linux-vdso.so.1 =>  (0x00007fff47dfe000)

libRlapack.so => /home/hlfernandez/Eclipse/workspace/Bioscope/R/linux/x64/R-3.0.2/lib/libRlapack.so (0x00007fb595bb0000)

libRblas.so => /home/hlfernandez/Eclipse/workspace/Bioscope/R/linux/x64/R-3.0.2/lib/libRblas.so (0x00007fb595983000)

libgfortran.so.3 => not found

libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fb595665000)

libR.so => /home/hlfernandez/Eclipse/workspace/Bioscope/R/linux/x64/R-3.0.2/lib/libR.so (0x00007fb5950c3000)

libgomp.so.1 => /usr/lib/x86_64-linux-gnu/libgomp.so.1 (0x00007fb594eb4000)

libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fb594c97000)

libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fb5948ce000)

libgfortran.so.3 => not found

libreadline.so.6 => /lib/x86_64-linux-gnu/libreadline.so.6 (0x00007fb59468c000)

librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fb594483000)

 libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fb59427f000)

/lib64/ld-linux-x86-64.so.2 (0x00007fb596205000)

 libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007fb594056000)

As you have said, there is a failure with libgfortran.so.3. ¿Is there a way to manually indicate where the libgfortran3.so file is located?

like image 43
hlfernandez Avatar answered Sep 24 '22 02:09

hlfernandez