library not found although I use ldconfig and /etc/ld.so.conf.d/lib.conf

1.4k views Asked by At

I'm using Fedora 25.

I have a binary that needs multiple libraries. The binary can't find libRblas.so:

$ ldd XPore-Engine | less | grep not
libvtkRenderingAnnotation.so.1 => /usr/lib64/vtk/libvtkRenderingAnnotation.so.1 (0x00007fac12563000)
libRblas.so => not found
libRblas.so => not found
libRblas.so => not found

The library path is properly configured with a .conf file:

$ cat /etc/ld.so.conf.d/R-x86_64.conf
/usr/lib64/R/lib
$ ll /usr/lib64/R/lib
lrwxrwxrwx. 1 root root     11 dic 16 20:46 libopenblas.so.0 -> libRblas.so
lrwxrwxrwx. 1 root root     27 oct 31 21:16 libRblas.so -> /usr/lib64/libopenblas.so.0
-rwxr-xr-x. 1 root root 1989312 oct 31 21:16 libRlapack.so
-rwxr-xr-x. 1 root root  178856 oct 31 21:16 libRrefblas.so
-rwxr-xr-x. 1 root root 2911536 oct 31 21:16 libR.so

And I load the configuration with ldconfig:

$ ldconfig -v | grep libRblas
        libopenblas.so.0 -> libRblas.so

However, after executing ldd again it returns the same output saying that libRblas.so wasn't found.

How can I fix this?

1

There are 1 answers

0
Jesús Martín Berlanga On BEST ANSWER

I've found a workaround provided by Tom in the Read Hat Bugzilla bug-tracking system at https://bugzilla.redhat.com/show_bug.cgi?id=1404662.

Yeah, so it looks like while R is perfectly happy using libRblas.so as a > symlink to libopenblas.so.0, externally, nothing else is. The speedup from using openblas is significant, so the fix is to build a copy of openblas that has the libRblas.so filename and soname, and use that instead of the symlink. I have a new build of openblas going which adds this, then I'll do a new round of R builds that depend on it.

As a temporary workaround, you can run (as root): rm -f /usr/lib64/R/lib/libRblas.so mv /usr/lib64/R/lib/libRrefblas.so /usr/lib64/R/lib/libRblas.so

That will restore the unoptimized libRblas.so that R provides.

Oh, and run /sbin/ldconfig (as root) after moving libRrefblas.so so that the ldcache is updated.