Compiling R from source: RStudio doesn't find the libraries if started directly

I have compiled R 4.1.0 from source against the Intel MKL.

I have put:

source /opt/intel/oneapi/mkl/latest/env/vars.sh intel64

in ~/.bashrc.

If I open a .R file with RStudio, no problem.

But if I open RStudio directly, it is unable to start R correctly, giving me the error:

/usr/lib/rstudio/bin/rsession: error while loading shared libraries: libmkl_gf_lp64.so.1: cannot open shared object file: No such file or directory

Why is that? Doesn't RStudio run ~/.bashrc when started directly?

Doesn't RStudio run ~/.bashrc when started directly?

No, it doesn't. Whatever environment variables are being set in vars.sh need to get forwarded to RStudio when you open it "directly". I'm not sure what OS you're on, but I'm guessing Linux, so the answer is different depending on your specific distribution and launcher. Here's one for Ubuntu that has the shape of the solution you'll need:

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.