How can I find out which shared library R has found? My present situation is as follows:
We are attempting to provide an R environment with several different interfaces, while providing as much consistency as possible (e.g., we would like to have the same libraries available in all interfaces): we can invoke R from a console, we can run RStudio, and we can run R notebooks under Jupyter notebooks. All three interfaces are supported by the same Unix-alike hardware and operating system (RedHat). Different users have different interface preferences.
Under our current configuration, we can run R from the console and load the vroom
package just fine:
$ R
> library(vroom)
> # no news is good news
However, under current conditions, library(vroom)
fails under our RStudio setup:
> library(vroom)
Error: package or namespace load failed for ‘vroom’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/PATH-PREFIX-REDACTED/miniconda3-1/envs/r/lib/R/library/vroom/libs/vroom.so':
miniconda3-1/envs/r/lib/R/lib/libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /PATH-PREFIX-REDACTED/miniconda3-1/envs/r/lib/R/library/vroom/libs/vroom.so)
The error from RStudio gives me a clue about why it is failing. But how can I find out why the console version is succeeding (which libstdc++.so.6
did it find)?
I have read a little (on StackOverflow [1, 2] and elsewhere [3]) about how dyn.load
might be working, but I still do not understand why the consolde R successfully loads vroom
when none of the libstdc++.so.6
on LD_LIBRARY_PATH
have GLIBCXX_3.4.30
(according to my understanding of the output of objdump -x
).
Additional Information
The .libPaths()
is the same in both "console" and "RStudio" R:
> .libPaths()
# [1] "PATH-PREFIX-REDACTED/R_LIBS_SITE/R4.2"
# [2] "PATH-PREFIX-REDACTED/miniconda3-1/envs/r/lib/R/library"
AFAICT (ls <directory>
), the vroom package is installed under only the "miniconda" path of .libPaths()
, so I am afraid @Mikael-Jagan's point is sorta moot (however, +1 for pointing out the new-to-me tool of ldd
): apparently the same vroom.so
is being loaded under "console" and "RStudio" R. And now I am more confused, because shouldn't the vroom package then be finding the same libstdc++.so.6
in either case?
$ # PATHNAMES, USER NAMES, AND GROUP NAMES HAVE BEEN CHANGED
$ # TO PROTECT THE INNOCENT.
$ # REFORMATTED FOR LEGIBILITY ON A WINDOW OF USUAL SIZE.
$ pwd
/PATH-PREFIX-REDACTED/miniconda3-1/envs/r/lib/R/library/vroom/libs/
$ ldd vroom.so | grep 'libstdc*'
libstdc++.so.6 => /PATH-PREFIX-REDACTED/miniconda3-
1/envs/r/lib/R/library/vroom/libs/../../../../libstdc++.so.6
(0x00002b2277b8a000)
$ cd /beohome/a/ScientificProgramSupport/local/miniconda3-
1/envs/r/lib/R/library/vroom/libs/../../../..
$ ls -lF libstdc*
lrwxrwxrwx 1 admin admin 19 Oct 25 15:51 libstdc++.so ->
libstdc++.so.6.0.30*
lrwxrwxrwx 1 admin admin 19 Oct 25 15:51 libstdc++.so.6 ->
libstdc++.so.6.0.30*
lrwxrwxrwx 1 admin admin 19 Oct 28 12:38 libstdc++.so.6.0.21 ->
libstdc++.so.6.0.24
-rwxrwxr-x 3 admin admin 12212840 Oct 23 06:08 libstdc++.so.6.0.30*
$ objdump -x libstdc++.so.6 | grep ' GLIBCXX_3\.4\.30'
32 0x00 0x0297f840 GLIBCXX_3.4.30
0000000000000000 g O *ABS* 0000000000000000
GLIBCXX_3.4.30
And now I am even more confused, because it looks to like ldd
and objdump
together are telling me that GLIBCXX_3.4.30
is part of the libstdc++.so.6
that vroom.so
should find.