soffice fails ONLY when called from RStudio

Viewed 149

I'm using RStudio Version 1.3.1093 on a machine with Ubuntu 20.04. My R version is 4.0.3.

There's an unexpected behavior when I call this line of code from within RStudio:

system("soffice --headless --convert-to xlsx --outdir files/ files/EGP.xlsb")

It fails with the following messages:

/usr/lib/libreoffice/program/javaldx: error while loading shared libraries: libreglo.so: cannot open shared object file: No such file or directory
Warning: failed to read path from javaldx
/usr/lib/libreoffice/program/soffice.bin: error while loading shared libraries: libreglo.so: cannot open shared object file: No such file or directory
Warning message:
In system("soffice --headless --convert-to xlsx --outdir files/ files/EGP.xlsb") :
  error in running command

The error is exactly the same if I call the "naked" command from RStudio's terminal (soffice --headless --convert-to xlsx --outdir files/ files/EGP.xlsb):

user@machine:~/Right/Path/To/File$ soffice --headless --convert-to xlsx --outdir files/ files/EGP.xlsb
/usr/lib/libreoffice/program/javaldx: error while loading shared libraries: libreglo.so: cannot open shared object file: No such file or directory
Warning: failed to read path from javaldx
/usr/lib/libreoffice/program/soffice.bin: error while loading shared libraries: libreglo.so: cannot open shared object file: No such file or directory

However, if I do the same call from a terminal, it just works with no error and produces the expected output:

user@machine:~/Right/Path/To/File$ soffice --headless --convert-to xlsx --outdir files/ files/EGP.xlsb
convert /home/user/Right/Path/To/File/files/EGP.xlsb -> /home/user/Right/Path/To/File/files/EGP.xlsx using filter : Calc Office Open XML
Overwriting: /home/user/Right/Path/To/File/files/EGP.xlsx

I followed advice in this ask Ubuntu question, reagarding the need to update $LD_LIBRARY_PATH but the problem does not resolve.

Is RStudio missing the path to find libreoffice libraries, that somehow are clear for the system (as the terminal has no problems finding them)? How can I fix it? Thanks!

1 Answers
Related