library("RQuantLib") in RStudio Server failing vs library("RQuantLib") from R in commandline succeeding

I run RStudio Server (open source) with a common library on a Linux server and we use RQuantLib extensively as a dependency. After a recent update I started noticing the following .

Inside the RStudio Server IDE:

library("RQuantLib")

gives the following error:

Error: package or namespace load failed for ‘RQuantLib’ in dyn.load(file, DLLpath = DLLpath, ...):
unable to load shared object '/usr/lib/R/library/RQuantLib/libs/RQuantLib.so':
/usr/lib/R/library/RQuantLib/libs/RQuantLib.so: undefined symbol: _ZNK8QuantLib22InflationTermStructure8baseDateEv

Running from the Rstudio terminal yields the same result (although it does load if I run R as root)

Outside RStudio Server in Linux commandline

With the same user,

library("RQuantLib")

loads successfully:

RQuantLib 0.4.24 built with QuantLib version 1.35. See https://www.quantlib.org for more on QuantLib.

In both cases,

.libPaths()

yields

/usr/lib/R/library

In both cases RQuantLib.so has the same permissions:
-rwxrwxrwx 1 root root 117M Oct 3 12:55 RQuantLib.so

RStudio Server devtools::session_info():

I have tried:

  • altering the permissions with chmod -R 777
  • multiple google and perplexity AI searches, but haven't come up with any viable solutions
  • searching on here for RQuantLib related queries

I Am Looking For

Either a solution or some ideas on how to potentially troubleshoot, because I have no ideas left.

Can you post the output of

ldd /usr/lib/R/library/RQuantLib/libs/RQuantLib.so

from both the terminal in RStudio and the normal Linux CLI?

From Linux CLI

 ldd /usr/lib/R/library/RQuantLib/libs/RQuantLib.so
        linux-vdso.so.1 (0x00007ffda5bec000)
        libQuantLib.so.0 => /usr/local/lib/libQuantLib.so.0 (0x00007f0b39130000)
        libR.so => /lib/libR.so (0x00007f0b38cb4000)
        libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f0b38ad2000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f0b38983000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f0b38968000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f0b38776000)
        libblas.so.3 => /lib/x86_64-linux-gnu/libblas.so.3 (0x00007f0b36d75000)
        libreadline.so.8 => /lib/x86_64-linux-gnu/libreadline.so.8 (0x00007f0b36d25000)
        libpcre2-8.so.0 => /lib/x86_64-linux-gnu/libpcre2-8.so.0 (0x00007f0b36c94000)
        liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f0b36c6b000)
        libbz2.so.1.0 => /lib/x86_64-linux-gnu/libbz2.so.1.0 (0x00007f0b36c58000)
        libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f0b36c3c000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f0b36c34000)
        libicuuc.so.66 => /lib/x86_64-linux-gnu/libicuuc.so.66 (0x00007f0b36a4e000)
        libicui18n.so.66 => /lib/x86_64-linux-gnu/libicui18n.so.66 (0x00007f0b3674f000)
        libgomp.so.1 => /lib/x86_64-linux-gnu/libgomp.so.1 (0x00007f0b3670d000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f0b366ea000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f0b3b720000)
        libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6 (0x00007f0b366b8000)
        libicudata.so.66 => /lib/x86_64-linux-gnu/libicudata.so.66 (0x00007f0b34bf7000)

From R terminal:

ldd /usr/lib/R/library/RQuantLib/libs/RQuantLib.so 
        linux-vdso.so.1 (0x00007ffee6382000)
        libQuantLib.so.0 => /lib/libQuantLib.so.0 (0x00007f6f7b6f3000)
        libR.so => /usr/lib/R/lib/libR.so (0x00007f6f7b277000)
        libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f6f7b095000)
        libm.so.6 => /usr/lib/x86_64-linux-gnu/libm.so.6 (0x00007f6f7af46000)
        libgcc_s.so.1 => /usr/lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f6f7af2b000)
        libc.so.6 => /usr/lib/x86_64-linux-gnu/libc.so.6 (0x00007f6f7ad39000)
        libblas.so.3 => /usr/lib/x86_64-linux-gnu/libblas.so.3 (0x00007f6f79338000)
        libreadline.so.8 => /usr/lib/x86_64-linux-gnu/libreadline.so.8 (0x00007f6f792e8000)
        libpcre2-8.so.0 => /usr/lib/x86_64-linux-gnu/libpcre2-8.so.0 (0x00007f6f79257000)
        liblzma.so.5 => /usr/lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f6f7922e000)
        libbz2.so.1.0 => /usr/lib/x86_64-linux-gnu/libbz2.so.1.0 (0x00007f6f7921b000)
        libz.so.1 => /usr/lib/x86_64-linux-gnu/libz.so.1 (0x00007f6f791ff000)
        libdl.so.2 => /usr/lib/x86_64-linux-gnu/libdl.so.2 (0x00007f6f791f7000)
        libicuuc.so.66 => /usr/lib/x86_64-linux-gnu/libicuuc.so.66 (0x00007f6f79011000)
        libicui18n.so.66 => /usr/lib/x86_64-linux-gnu/libicui18n.so.66 (0x00007f6f78d12000)
        libgomp.so.1 => /usr/lib/x86_64-linux-gnu/libgomp.so.1 (0x00007f6f78cd0000)
        libpthread.so.0 => /usr/lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f6f78cad000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f6f7db93000)
        libtinfo.so.6 => /usr/lib/x86_64-linux-gnu/libtinfo.so.6 (0x00007f6f78c7b000)
        libicudata.so.66 => /usr/lib/x86_64-linux-gnu/libicudata.so.66 (0x00007f6f771ba000)

Sorry for the late reply. your message did not show up in my notifications.
From the ldd output we see that you seem to have two versions of QuantLib installed:

CLI (working)

 ldd /usr/lib/R/library/RQuantLib/libs/RQuantLib.so
        linux-vdso.so.1 (0x00007ffda5bec000)
        libQuantLib.so.0 => /usr/local/lib/libQuantLib.so.0 (0x00007f0b39130000)
[...]

Terminal (not working)

ldd /usr/lib/R/library/RQuantLib/libs/RQuantLib.so 
        linux-vdso.so.1 (0x00007ffee6382000)
        libQuantLib.so.0 => /lib/libQuantLib.so.0 (0x00007f6f7b6f3000)
[...]

Can you see if you can standardize on one QuantLib version on the server? Otherwise you can try to set LD_LIBRARY_PATH in such a way to have /usr/local/lib before /lib.