linux - calling R from within Matlab -
i trying run r script within matlab, , same error poster: calling r matlab
as far can tell situations same, except system running linuxmint (release 14 nadia, kernel 3.5.0-17-generic) , solution in post not work me. make further suggestion? i'm stumped.
like poster in above thread, call works shell not within matlab.
r_script.r contains:
foo <- rnorm( 100 ) cat( sd( foo ), '\n' ) cat( mean( foo ), '\n' )
the error message within matlab:
>> system( 'rscript /tmp/r_script.r' ) error in dyn.load(file, dllpath = dllpath, ...) : unable load shared object '/usr/lib/r/library/stats/libs/stats.so': /usr/local/matlab/r2013a/sys/os/glnxa64/libgfortran.so.3: version `gfortran_1.4' not found (required /usr/lib/liblapack.so.3) during startup - warning message: package ‘stats’ in options("defaultpackages") not found error: not find function "rnorm" execution halted ans = 1 >> !unset dyld_library_path; >> system( 'rscript /tmp/r_script.r' ) error in dyn.load(file, dllpath = dllpath, ...) : unable load shared object '/usr/lib/r/library/stats/libs/stats.so': /usr/local/matlab/r2013a/sys/os/glnxa64/libgfortran.so.3: version `gfortran_1.4' not found (required /usr/lib/liblapack.so.3) during startup - warning message: package ‘stats’ in options("defaultpackages") not found error: not find function "rnorm" execution halted ans = 1
ok, responses amro , dwin got me pointed in right direction , i've solved problem. problem matlab seems include own version of libgfortran.so.3, must out of date compared version on system (and expected r). many amro , dwin helping me out.
for poor soul comes along later:
i able determine running ldd on /usr/lib/r/library/stats/libs/stats.so both inside , outside of matlab.
!ldd /usr/lib/r/library/stats/libs/stats.so (from inside matlab) returns:
<snip> libgfortran.so.3 => /usr/local/matlab/r2013a/sys/os/glnxa64/libgfortran.so.3 (0x00007faff0bbc000) </snip>
and ldd /usr/lib/r/library/stats/libs/stats.so (from shell) returns:
<snip> libgfortran.so.3 => /usr/lib/x86_64-linux-gnu/libgfortran.so.3 (0x00007f3c9b308000) </snip>
adding system libgfortran.so.3 beginning of matlab's ld_library_path (not end) solved problem. within matlab:
>> setenv( 'ld_library_path', strcat( '/usr/lib/x86_64-linux-gnu:', getenv( 'ld_library_path' ) ) ) >> !/usr/bin/rscript /tmp/r_script.r 0.8317391 0.09262757
Comments
Post a Comment