ROracle system library dependency found in CLI R but not in RStudio

Following some system update (perhaps when we transitioned RHEL 7 to 8) I'm now finding the ROracle package broken, but only if I call it from RStudio (server edition).

From RStudio, I get this error:

> library(ROracle)
Error: package or namespace load failed for ‘ROracle’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/usr/lib64/R/library/ROracle/libs/ROracle.so':
  libclntsh.so.19.1: cannot open shared object file: No such file or directory

When I load the same library from CLI R, it works just fine. So something about the differences in start-up between RStudio and CLI R should indicate the problem, but I cannot find it.

I've checked that the system environment variables LD_LIBRARY_PATH and ORACLE_HOME are both set and identical in both situations. Any suggestions on how I can further troubleshoot?

Curious, usually LD_LIBRARY_PATH is the culprit. What does this show in both environments?

ldd /usr/lib64/R/library/ROracle/libs/ROracle.so

You might also check .libPaths() to make sure you're using the same package libraries in both cases!

Things are mostly looking the same there, too. For a moment I thought this "execution permission" warning was a clue, but it also shows up in both places. Below I'm limiting the ldd with a grep oracle, if you need the full output I can re-post.

I do wonder if invoking ldd using system() is giving a misleading response (does that involve having a different environment?) but I don't know how else to run it from R. If I run the ldd directly at a Bash prompt I get the same result.

Outputs from RStudio:

> Sys.getenv('LD_LIBRARY_PATH')
[1] "/usr/lib/oracle/current/client64/lib:/usr/lib64/R/lib:/lib:/usr/lib/jvm/jre/lib/amd64/server:/usr/lib/jvm/jre/lib/amd64:/usr/lib/jvm/java/lib/amd64:/usr/java/packages/lib/amd64:/lib:/usr/lib"
> system('ldd /usr/lib64/R/library/ROracle/libs/ROracle.so | grep oracle')
ldd: warning: you do not have execution permission for `/usr/lib64/R/library/ROracle/libs/ROracle.so'
	libclntsh.so.19.1 => /usr/lib/oracle/current/client64/lib/libclntsh.so.19.1 (0x00007f4ef159a000)
	libnnz21.so => /usr/lib/oracle/current/client64/lib/libnnz21.so (0x00007f4ef04d9000)
	libclntshcore.so.21.1 => /usr/lib/oracle/current/client64/lib/libclntshcore.so.21.1 (0x00007f4eef1e3000)
> library(ROracle)
Loading required package: DBI
Error: package or namespace load failed for ‘ROracle’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/usr/lib64/R/library/ROracle/libs/ROracle.so':
  libclntsh.so.19.1: cannot open shared object file: No such file or directory
> packageVersion('ROracle')
[1] ‘1.3.1’

CLI R on the same system:

> Sys.getenv('LD_LIBRARY_PATH')
[1] "/usr/lib/oracle/current/client64/lib:/usr/lib64/R/lib:/lib:/usr/lib/jvm/jre/lib/amd64/server:/usr/lib/jvm/jre/lib/amd64:/usr/lib/jvm/java/lib/amd64:/usr/java/packages/lib/amd64:/lib:/usr/lib"
> system('ldd /usr/lib64/R/library/ROracle/libs/ROracle.so | grep oracle')
ldd: warning: you do not have execution permission for `/usr/lib64/R/library/ROracle/libs/ROracle.so'
        libclntsh.so.19.1 => /usr/lib/oracle/current/client64/lib/libclntsh.so.19.1 (0x00007fcf17697000)
        libnnz21.so => /usr/lib/oracle/current/client64/lib/libnnz21.so (0x00007fcf165d6000)
        libclntshcore.so.21.1 => /usr/lib/oracle/current/client64/lib/libclntshcore.so.21.1 (0x00007fcf152e0000)
> library(ROracle)
Loading required package: DBI
> packageVersion('ROracle')
[1] ‘1.3.1’

Going ahead and adding the full ldd outputs..

RStudio

> system('ldd /usr/lib64/R/library/ROracle/libs/ROracle.so')
ldd: warning: you do not have execution permission for `/usr/lib64/R/library/ROracle/libs/ROracle.so'
	linux-vdso.so.1 =>  (0x00007fffc62ca000)
	libclntsh.so.19.1 => /usr/lib/oracle/current/client64/lib/libclntsh.so.19.1 (0x00007f82e5faf000)
	libR.so => /usr/lib64/R/lib/libR.so (0x00007f82e5931000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f82e5563000)
	libnnz21.so => /usr/lib/oracle/current/client64/lib/libnnz21.so (0x00007f82e4eee000)
	libdl.so.2 => /lib64/libdl.so.2 (0x00007f82e4cea000)
	libm.so.6 => /lib64/libm.so.6 (0x00007f82e49e8000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f82e47cc000)
	librt.so.1 => /lib64/librt.so.1 (0x00007f82e45c4000)
	libaio.so.1 => /lib64/libaio.so.1 (0x00007f82e43c2000)
	libresolv.so.2 => /lib64/libresolv.so.2 (0x00007f82e41a8000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f82ea5a6000)
	libclntshcore.so.21.1 => /usr/lib/oracle/current/client64/lib/libclntshcore.so.21.1 (0x00007f82e3bf8000)
	libRblas.so => /usr/lib64/R/lib/libRblas.so (0x00007f82e1658000)
	libgfortran.so.3 => /lib64/libgfortran.so.3 (0x00007f82e1336000)
	libquadmath.so.0 => /lib64/libquadmath.so.0 (0x00007f82e10fa000)
	libreadline.so.6 => /lib64/libreadline.so.6 (0x00007f82e0eb4000)
	libtre.so.5 => /lib64/libtre.so.5 (0x00007f82e0ca4000)
	libpcre2-8.so.0 => /lib64/libpcre2-8.so.0 (0x00007f82e0a2d000)
	libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f82e07cb000)
	liblzma.so.5 => /lib64/liblzma.so.5 (0x00007f82e05a5000)
	libbz2.so.1 => /lib64/libbz2.so.1 (0x00007f82e0395000)
	libz.so.1 => /lib64/libz.so.1 (0x00007f82e017f000)
	libicuuc.so.50 => /lib64/libicuuc.so.50 (0x00007f82dfe06000)
	libicui18n.so.50 => /lib64/libicui18n.so.50 (0x00007f82dfa07000)
	libgomp.so.1 => /lib64/libgomp.so.1 (0x00007f82df7e1000)
	libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f82df5cb000)
	libtinfo.so.5 => /lib64/libtinfo.so.5 (0x00007f82df3a1000)
	libicudata.so.50 => /lib64/libicudata.so.50 (0x00007f82dddce000)
	libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f82ddac6000)

CLI R

> system('ldd /usr/lib64/R/library/ROracle/libs/ROracle.so')
ldd: warning: you do not have execution permission for `/usr/lib64/R/library/ROracle/libs/ROracle.so'
        linux-vdso.so.1 =>  (0x00007ffe43ce2000)
        libclntsh.so.19.1 => /usr/lib/oracle/current/client64/lib/libclntsh.so.19.1 (0x00007f4c9abc0000)
        libR.so => /usr/lib64/R/lib/libR.so (0x00007f4c9a542000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f4c9a174000)
        libnnz21.so => /usr/lib/oracle/current/client64/lib/libnnz21.so (0x00007f4c99aff000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007f4c998fb000)
        libm.so.6 => /lib64/libm.so.6 (0x00007f4c995f9000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f4c993dd000)
        librt.so.1 => /lib64/librt.so.1 (0x00007f4c991d5000)
        libaio.so.1 => /lib64/libaio.so.1 (0x00007f4c98fd3000)
        libresolv.so.2 => /lib64/libresolv.so.2 (0x00007f4c98db9000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f4c9f1b7000)
        libclntshcore.so.21.1 => /usr/lib/oracle/current/client64/lib/libclntshcore.so.21.1 (0x00007f4c98809000)
        libRblas.so => /usr/lib64/R/lib/libRblas.so (0x00007f4c96269000)
        libgfortran.so.3 => /lib64/libgfortran.so.3 (0x00007f4c95f47000)
        libquadmath.so.0 => /lib64/libquadmath.so.0 (0x00007f4c95d0b000)
        libreadline.so.6 => /lib64/libreadline.so.6 (0x00007f4c95ac5000)
        libtre.so.5 => /lib64/libtre.so.5 (0x00007f4c958b5000)
        libpcre2-8.so.0 => /lib64/libpcre2-8.so.0 (0x00007f4c9563e000)
        libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f4c953dc000)
        liblzma.so.5 => /lib64/liblzma.so.5 (0x00007f4c951b6000)
        libbz2.so.1 => /lib64/libbz2.so.1 (0x00007f4c94fa6000)
        libz.so.1 => /lib64/libz.so.1 (0x00007f4c94d90000)
        libicuuc.so.50 => /lib64/libicuuc.so.50 (0x00007f4c94a17000)
        libicui18n.so.50 => /lib64/libicui18n.so.50 (0x00007f4c94618000)
        libgomp.so.1 => /lib64/libgomp.so.1 (0x00007f4c943f2000)
        libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f4c941dc000)
        libtinfo.so.5 => /lib64/libtinfo.so.5 (0x00007f4c93fb2000)
        libicudata.so.50 => /lib64/libicudata.so.50 (0x00007f4c929df000)
        libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f4c926d7000)

Found another clue, and I think it goes back to differences between an RStudio session start-up and CLI R. I've been setting LD_LIBRARY_PATH, ORACLE_HOME, and TNS_ADMIN in my ~/.Rprofile, so naturally when I check those variables in both environments I see the same thing. But if I comment out those settings in .Rprofile, I get different results, with the variables properly set in CLI R and not in RStudio.

In RStudio I get (note no Oracle in the LD_LIBRARY_PATH):

LD_LIBRARY_PATH 
"/usr/lib64/R/lib:/lib:/usr/lib/jvm/jre/lib/amd64/server:/usr/lib/jvm/jre/lib/amd64:/usr/lib/jvm/java/lib/amd64:/usr/java/packages/lib/amd64:/lib:/usr/lib" 
ORACLE_HOME 
"" 
TNS_ADMIN 
"" 

And in CLI R I get:

LD_LIBRARY_PATH
"/usr/lib64/R/lib:/usr/lib/jvm/jre/lib/amd64/server:/usr/lib/jvm/jre/lib/amd64:/usr/lib/jvm/java/lib/amd64:/usr/java/packages/lib/amd64:/lib:/usr/lib:/usr/lib/oracle/current/client64/lib"
ORACLE_HOME
"/usr/lib/oracle/current/client64"
TNS_ADMIN
"/usr/lib/oracle/network/admin"

My guess is that during startup something Oracle-related reads environment variables prior to ~/.Rprofile being read. Because of the way CLI R sessions start and what configuration files it looks for, those variables are picked up, but because RStudio sessions start somehow differently they are not.

FWIW we do not have a R_HOME/etc/Renviron.site or R_HOME/etc/Rprofile.site, and I do not have a ~/.Renviron file.

Actually, CLI R doesn't seem to care whatsoever what I have set for environment variables. If I remove all of the Oracle parts, ROracle still loads just fine without error.

> Sys.setenv(LD_LIBRARY_PATH = "/usr/lib64/R/lib:/lib:/usr/lib/jvm/jre/lib/amd64/server:/usr/lib/jvm/jre/lib/amd64:/usr/lib/jvm/java/lib/amd64:/usr/java/packages/lib/amd64:/lib:/usr/lib")
> Sys.setenv(ORACLE_HOME = "")
> Sys.setenv(TNS_ADMIN = "")
> Sys.getenv(c('LD_LIBRARY_PATH', 'ORACLE_HOME', 'TNS_ADMIN'))
LD_LIBRARY_PATH
"/usr/lib64/R/lib:/lib:/usr/lib/jvm/jre/lib/amd64/server:/usr/lib/jvm/jre/lib/amd64:/usr/lib/jvm/java/lib/amd64:/usr/java/packages/lib/amd64:/lib:/usr/lib"
ORACLE_HOME
""
TNS_ADMIN
""
> library(ROracle)
Loading required package: DBI
>

It also doesn't seem to matter what I set those variables to in RStudio, I still get the same cannot open shared object file error.

I think the error message

libclntsh.so.19.1: cannot open shared object file: No such file or directory

is interesting. According to the ldd output this file is found at

/usr/lib/oracle/current/client64/lib/libclntsh.so.19.1 

in both cases. However, the error message often indicates that the file cannot be loaded because of libraries it is linked against. Can you run

ldd /usr/lib/oracle/current/client64/lib/libclntsh.so.19.1 

in both environments?

Confirmed ldd /usr/lib/oracle/current/client64/lib/libclntsh.so.19.1 produces the same result in both environments, with no apparent missingness.

So I think the ldd outputs may be a bit deceiving, in the sense that if I set/unset LD_LIBRARY_PATH that does affect whether libclntsh.so.19.1 is found by ldd, but it does not affect whether library(ROracle) works - the library fails in either case. I can tell you if I totally unset the relevant environment variables I can produce that "not found" response by ldd on ROracle.so, but the result for running ldd on libclntsh.so.19.1 itself doesn't show anything missing under that situation. (Outputs on all that are shown below.)

In other words, I don't think ROracle is using the current setting of LD_LIBRARY_PATH at all, at least not in the way my current user sees that environment variable in my session. My thoughts on this are either

  • when ROracle is invoked it somehow spawns a child process that has its own separate set of environment variables, unaffected by those set in my own session?
  • the Oracle Instant Client hard-wires paths when it is installed, and those paths have changed since we first installed it (i.e. it isn't following the symlink /usr/lib/oracle/current but is instead looking for a specific version number path like /usr/lib/oracle/19.1, which we don't have (we are on 21).

But for the latter to be true, why would it work in CLI R but not RStudio?

BTW I was asked about .libPaths() earlier, but I hadn't yet included in my replies those are also confirmed both the same, and there is only one copy/version of ROracle in any of those directories (in /usr/lib64/R/library).

> Sys.getenv(c('LD_LIBRARY_PATH', 'ORACLE_HOME', 'TNS_ADMIN'))
	LD_LIBRARY_PATH	
	"/usr/lib/oracle/current/client64/lib:/usr/lib64/R/lib:/lib:/usr/lib/jvm/jre/lib/amd64/server:/usr/lib/jvm/jre/lib/amd64:/usr/lib/jvm/java/lib/amd64:/usr/java/packages/lib/amd64:/lib:/usr/lib"	
	ORACLE_HOME	
	"/usr/lib/oracle/current/client64"	
	TNS_ADMIN	
	"/usr/lib/oracle/network/admin" 
> system('ldd /usr/lib64/R/library/ROracle/libs/ROracle.so')
ldd: warning: you do not have execution permission for `/usr/lib64/R/library/ROracle/libs/ROracle.so'
	linux-vdso.so.1 =>  (0x00007ffeddff4000)
	libclntsh.so.19.1 => /usr/lib/oracle/current/client64/lib/libclntsh.so.19.1 (0x00007fd37dc94000)
	libR.so => /usr/lib64/R/lib/libR.so (0x00007fd37d616000)
	libc.so.6 => /lib64/libc.so.6 (0x00007fd37d248000)
	libnnz21.so => /usr/lib/oracle/current/client64/lib/libnnz21.so (0x00007fd37cbd3000)
	libdl.so.2 => /lib64/libdl.so.2 (0x00007fd37c9cf000)
	libm.so.6 => /lib64/libm.so.6 (0x00007fd37c6cd000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fd37c4b1000)
	librt.so.1 => /lib64/librt.so.1 (0x00007fd37c2a9000)
	libaio.so.1 => /lib64/libaio.so.1 (0x00007fd37c0a7000)
	libresolv.so.2 => /lib64/libresolv.so.2 (0x00007fd37be8d000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fd38228b000)
	libclntshcore.so.21.1 => /usr/lib/oracle/current/client64/lib/libclntshcore.so.21.1 (0x00007fd37b8dd000)
	libRblas.so => /usr/lib64/R/lib/libRblas.so (0x00007fd37933d000)
	libgfortran.so.3 => /lib64/libgfortran.so.3 (0x00007fd37901b000)
	libquadmath.so.0 => /lib64/libquadmath.so.0 (0x00007fd378ddf000)
	libreadline.so.6 => /lib64/libreadline.so.6 (0x00007fd378b99000)
	libtre.so.5 => /lib64/libtre.so.5 (0x00007fd378989000)
	libpcre2-8.so.0 => /lib64/libpcre2-8.so.0 (0x00007fd378712000)
	libpcre.so.1 => /lib64/libpcre.so.1 (0x00007fd3784b0000)
	liblzma.so.5 => /lib64/liblzma.so.5 (0x00007fd37828a000)
	libbz2.so.1 => /lib64/libbz2.so.1 (0x00007fd37807a000)
	libz.so.1 => /lib64/libz.so.1 (0x00007fd377e64000)
	libicuuc.so.50 => /lib64/libicuuc.so.50 (0x00007fd377aeb000)
	libicui18n.so.50 => /lib64/libicui18n.so.50 (0x00007fd3776ec000)
	libgomp.so.1 => /lib64/libgomp.so.1 (0x00007fd3774c6000)
	libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007fd3772b0000)
	libtinfo.so.5 => /lib64/libtinfo.so.5 (0x00007fd377086000)
	libicudata.so.50 => /lib64/libicudata.so.50 (0x00007fd375ab3000)
	libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007fd3757ab000)
> system('ldd /usr/lib/oracle/current/client64/lib/libclntsh.so.19.1')
	linux-vdso.so.1 =>  (0x00007ffe2e96e000)
	libnnz21.so => /usr/lib/oracle/current/client64/lib/libnnz21.so (0x00007f4949467000)
	libdl.so.2 => /lib64/libdl.so.2 (0x00007f4949263000)
	libm.so.6 => /lib64/libm.so.6 (0x00007f4948f61000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f4948d45000)
	librt.so.1 => /lib64/librt.so.1 (0x00007f4948b3d000)
	libaio.so.1 => /lib64/libaio.so.1 (0x00007f494893b000)
	libresolv.so.2 => /lib64/libresolv.so.2 (0x00007f4948721000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f4948353000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f494dec1000)
	libclntshcore.so.21.1 => /usr/lib/oracle/current/client64/lib/libclntshcore.so.21.1 (0x00007f4947da3000)
> library(ROracle)
Loading required package: DBI
Error: package or namespace load failed for ‘ROracle’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/usr/lib64/R/library/ROracle/libs/ROracle.so':
  libclntsh.so.19.1: cannot open shared object file: No such file or directory
> Sys.unsetenv(c('LD_LIBRARY_PATH', 'ORACLE_HOME', 'TNS_ADMIN'))
> system('ldd /usr/lib64/R/library/ROracle/libs/ROracle.so')
ldd: warning: you do not have execution permission for `/usr/lib64/R/library/ROracle/libs/ROracle.so'
	linux-vdso.so.1 =>  (0x00007ffc921f1000)
	libclntsh.so.19.1 => not found
	libR.so => /usr/lib64/R/lib/libR.so (0x00007f72f2777000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f72f23a9000)
	libRblas.so => not found
	libgfortran.so.3 => /lib64/libgfortran.so.3 (0x00007f72f2087000)
	libm.so.6 => /lib64/libm.so.6 (0x00007f72f1d85000)
	libquadmath.so.0 => /lib64/libquadmath.so.0 (0x00007f72f1b49000)
	libreadline.so.6 => /lib64/libreadline.so.6 (0x00007f72f1903000)
	libtre.so.5 => /lib64/libtre.so.5 (0x00007f72f16f3000)
	libpcre2-8.so.0 => /lib64/libpcre2-8.so.0 (0x00007f72f147c000)
	libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f72f121a000)
	liblzma.so.5 => /lib64/liblzma.so.5 (0x00007f72f0ff4000)
	libbz2.so.1 => /lib64/libbz2.so.1 (0x00007f72f0de4000)
	libz.so.1 => /lib64/libz.so.1 (0x00007f72f0bce000)
	librt.so.1 => /lib64/librt.so.1 (0x00007f72f09c6000)
	libdl.so.2 => /lib64/libdl.so.2 (0x00007f72f07c2000)
	libicuuc.so.50 => /lib64/libicuuc.so.50 (0x00007f72f0449000)
	libicui18n.so.50 => /lib64/libicui18n.so.50 (0x00007f72f004a000)
	libgomp.so.1 => /lib64/libgomp.so.1 (0x00007f72efe24000)
	libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x00007f72efc0e000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f72ef9f2000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f72f3007000)
	libtinfo.so.5 => /lib64/libtinfo.so.5 (0x00007f72ef7c8000)
	libicudata.so.50 => /lib64/libicudata.so.50 (0x00007f72ee1f5000)
	libstdc++.so.6 => /lib64/libstdc++.so.6 (0x00007f72edeed000)
> system('ldd /usr/lib/oracle/current/client64/lib/libclntsh.so.19.1')
	linux-vdso.so.1 =>  (0x00007ffe85426000)
	libnnz21.so => /usr/lib/oracle/21/client64/lib/libnnz21.so (0x00007f8ab3d8b000)
	libdl.so.2 => /lib64/libdl.so.2 (0x00007f8ab3b87000)
	libm.so.6 => /lib64/libm.so.6 (0x00007f8ab3885000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f8ab3669000)
	librt.so.1 => /lib64/librt.so.1 (0x00007f8ab3461000)
	libaio.so.1 => /lib64/libaio.so.1 (0x00007f8ab325f000)
	libresolv.so.2 => /lib64/libresolv.so.2 (0x00007f8ab3045000)
	libc.so.6 => /lib64/libc.so.6 (0x00007f8ab2c77000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f8ab87e5000)
	libclntshcore.so.21.1 => /usr/lib/oracle/21/client64/lib/libclntshcore.so.21.1 (0x00007f8ab26c7000)
> library(ROracle)
Error: package or namespace load failed for ‘ROracle’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/usr/lib64/R/library/ROracle/libs/ROracle.so':
  libclntsh.so.19.1: cannot open shared object file: No such file or directory

And here is the ldd output from CLI R, looks like it is the same, aside from the temp memory mappings:

> system('ldd /usr/lib/oracle/current/client64/lib/libclntsh.so.19.1')
        linux-vdso.so.1 =>  (0x00007fff41169000)
        libnnz21.so => /usr/lib/oracle/current/client64/lib/libnnz21.so (0x00007fcb8b260000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007fcb8b05c000)
        libm.so.6 => /lib64/libm.so.6 (0x00007fcb8ad5a000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fcb8ab3e000)
        librt.so.1 => /lib64/librt.so.1 (0x00007fcb8a936000)
        libaio.so.1 => /lib64/libaio.so.1 (0x00007fcb8a734000)
        libresolv.so.2 => /lib64/libresolv.so.2 (0x00007fcb8a51a000)
        libc.so.6 => /lib64/libc.so.6 (0x00007fcb8a14c000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fcb8fcba000)
        libclntshcore.so.21.1 => /usr/lib/oracle/current/client64/lib/libclntshcore.so.21.1 (0x00007fcb89b9c000)

This is quite odd. Can you tell us more about the system upgrades you mentioned (RHEL 7 -> 8, Oracle client 19 -> 21)? Has ROracle been reinstalled after that? Have you considered using an ODBC driver together with the odbc package instead?

I don't really know much about the system upgrades, our IT handles all that. Also I am told that ODBC is not really an option on our system.

But neither of those things addresses the question of why is RStudio behaving different from CLI R? The ROracle package works in one setting and not the other, and as far as I can tell it is the same package that is being loaded (because of .libPaths() being the same and only one copy of the package existing on those paths).

One thing I hadn't mentioned above is that we have another server that is running the "Pro" version of RStudio Server, and all of the things I said above about environment variables, paths, and package version are the same there too, and on that server ROracle works on RStudio. So there may also be a clue about some difference in the pro/non-pro versions of RStudio Server.

Okay, our IT people figured it out. It turns out I was on the right track when I said

The rstudio service itself is a "user" on the system, and it needs to have those environment variables correctly set for itself. Once that was done, the package loaded in RStudio. The output of Sys.getenv('LD_LIBRARY_PATH'), etc., just doesn't seem to matter. I can unset all of those in both RStudio and CLI R and the package still loads.

Edit to add detail from our IT: They set ORACLE_HOME, LD_LIBRARY_PATH, and TNS_ADMIN in the Environment setting of the systemd service file for RStudio.

1 Like

This topic was automatically closed 7 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.