Back to Tech Corner
SAS Programming

Issue of Missing libRblas.so and libRlapack.so on RHEL 8.x

When the SAS program searches for the R BLAS and LAPACK libraries, it expects these libraries to be called libRblas.so and libRlapack.so. The shared objects libRblas.so & libRlapack.so used to be loaded by R, however with RHEL 8.x and R 4.2.x Red Hat provisions its own distribution which changed the names of these shared objects and SAS when searching for these .so fails.

Install

  1. Download and install R for Linux from source code from The Comprehensive R Archive Network (CRAN): http://cran.r-project.org. (Different distros available).
    1. To install R on your Linux system
      1. Either install R from a precompiled binary distribution or compile R from source code:
      2. Precompiled binary distributions are available for several popular implementations of Linux. If you are using SAS software in a 64-bit Linux environment, you must download a 64-bit binary distribution of R. Otherwise, download a 32-bit binary distribution.
      3. Details for compiling R from source code are contained in the R Installation and Administration manual, which is available from CRAN (URL given above).
      4. The SAS interface to R requires that R be compiled into a dynamic (shared) library, which is not the default configuration on some operating systems. You can use the configure program to build R as a shared library by using the option --enable-R-shlib as follows: ./configure --enable-R-shlib
      5. Ensure appropriate path for your R_Home environment variable.
      6. Add SAS option -RLANG to the appropriate sasv9_usermods.cft under your SASApp path and under SAS Foundation path sasv9_local.cfg

Issue

Once the setup is complete, during SAS & R test the following error is observed:

ERROR /*opt/sas/sashome/SASFoundation/9.4/utilities/bin/tkrproxy: error while loading shared libraries: libRblas.so: cannot open shared object file: No such file or directory*

Resolution

First check the following

  1. Does R independent of SAS executes? If YES
  2. What is the installed version? Looking for 4.2.2 "Innocent and Trusting" name given to the build
  3. Installed R is 64 bit?
  4. Value of R_HOME?
  5. libRlapack.so & libRblas.so reside in In R_HOME? (Expecting none found).

The file you are missing, /lib64/R/lib/libRblas.so is provided by:

Steps 1:

$ rpm -q --whatprovides /lib64/R/lib/libRblas.so

openblas-Rblas-0.3.15-4.el8.x86_64

install this package

Step 2:

For libRlapack.so, create a symbolic link:

ln -s /usr/lib64/R/modules/lapack.so /usr/lib64/R/lib//usr/lib64/R/lib/libRlapack.so

Re test with a sample R code, a test code is given below:

SAMPLE R test Code

proc options option=rlang; run;

proc iml;

x = 1:3;

m = {1 2 3, 4 5 6, 7 8 9};

q = m * t(x);

print(q);

submit / R;

rx <- matrix( 1:3, nrow=1)

rm <- matrix( 1:9, byrow=TRUE)

rq <- t(rx) %*% t(rm)

print(rq)

endsubmit;