3

I am trying to run R from Matlab using the system command. When I enter the command system('R'), I get the following error:

/usr/lib64/R/bin/exec/R: /usr/local/MATLAB/R2014a/sys/os/glnxa64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /lib64/libicuuc.so.52) /usr/lib64/R/bin/exec/R: /usr/local/MATLAB/R2014a/sys/os/glnxa64/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /lib64/libicui18n.so.52)

R works when I use it outside of the Matlab. I am using Linux.

horchler
  • 18,384
  • 4
  • 37
  • 73
Bob
  • 69
  • 1
  • 5
  • Could you add the relevant MATLAB code? – Yellows Feb 11 '15 at 17:43
  • 1
    I just tried running `system('R')` on OS X 10.10.2 and R2014b and it worked fine. You should probably also edit your question to include further details about your OS, Matlab version (R2014a, I assume), and R version. I wonder if this might be off-topic for here and better suited for [SuperUser](http://superuser.com)? Also, does [this](http://stackoverflow.com/questions/23494103/version-cxxabi-1-3-8-not-found-required-by) help? – horchler Feb 11 '15 at 18:49
  • I found the answer that I needed https://stackoverflow.com/questions/9959306/how-to-tell-mex-to-link-with-the-libstdc-so-6-in-usr-lib-instead-of-the-one-i. Matlab was using it own version of libstdc++.so.6 so I had to load the system version instead of the Matlab version – Bob Feb 12 '15 at 04:49

1 Answers1

4

The answer can be found at How to tell mex to link with the libstdc++.so.6 in /usr/lib instead of the one in the MATLAB directory?

Essentially, Matlab uses it's own version of libstdc++.so.6 when it runs commands from system, so you have to make sure the system uses the libstdc++.so.6 in the default location on the computer.

% Save library paths
MatlabPath = getenv('LD_LIBRARY_PATH');
% Make Matlab use system libraries
setenv('LD_LIBRARY_PATH',getenv('PATH'))
system( 'R' )
% Reassign old library paths
setenv('LD_LIBRARY_PATH',MatlabPath)
Torsten Knodt
  • 477
  • 1
  • 5
  • 20
Bob
  • 69
  • 1
  • 5