2017-02-04 4 views
0

Je travaille sur Ubuntu 16.04 (dans un conteneur docker). Libroffice est installé et fonctionne correctement.Problème de bibliothèque partagée avec la fonction système dans R

Je peux l'utiliser avec la ligne de commande:

[email protected]:/# libreoffice --version 
LibreOffice 5.2.4.2.1 20m0(Build:2) 
[email protected]:/# libreoffice --headless --convert-to pdf --outdir . rapport.docx                
convert /rapport.docx -> /rapport.pdf using filter : writer_pdf_Export 
[email protected]:/# 

Mais si j'essaie de faire la même chose dans R:

R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch" 
Copyright (C) 2016 The R Foundation for Statistical Computing 
Platform: x86_64-pc-linux-gnu (64-bit) 

R is free software and comes with ABSOLUTELY NO WARRANTY. 
You are welcome to redistribute it under certain conditions. 
Type 'license()' or 'licence()' for distribution details. 

    Natural language support but running in an English locale 

R is a collaborative project with many contributors. 
Type 'contributors()' for more information and 
'citation()' on how to cite R or R packages in publications. 

Type 'demo()' for some demos, 'help()' for on-line help, or 
'help.start()' for an HTML browser interface to help. 
Type 'q()' to quit R. 

[Previously saved workspace restored] 

> system("whoami") 
root 
> system(paste0("libreoffice --version")) 
/usr/lib/libreoffice/program/soffice.bin: error while loading shared libraries: libreglo.so: cannot open shared object file: No such file or directory 
> system(paste0("libreoffice --headless --convert-to pdf --outdir . rapport.docx")) 
/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 

Je ne comprends pas cette erreur de bibliothèque partagée ... Toute idée ?

Cordialement

Répondre

0

situé à seulement le chemin de la bibliothèque, en permanence par l'ajout d'un fichier se terminant par .conf dans le répertoire /etc/ld.so.conf.d/, ou tout simplement pour une commande via la variable d'environnement LD_LIBRARY_PATH:

[email protected]:~$ LD_LIBRARY_PATH=/usr/lib/libreoffice/program/ R 

R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch" 
Copyright (C) 2016 The R Foundation for Statistical Computing 
Platform: x86_64-pc-linux-gnu (64-bit) 

R is free software and comes with ABSOLUTELY NO WARRANTY. 
You are welcome to redistribute it under certain conditions. 
Type 'license()' or 'licence()' for distribution details. 

    Natural language support but running in an English locale 

R is a collaborative project with many contributors. 
Type 'contributors()' for more information and 
'citation()' on how to cite R or R packages in publications. 

Type 'demo()' for some demos, 'help()' for on-line help, or 
'help.start()' for an HTML browser interface to help. 
Type 'q()' to quit R. 

R> system(paste0("libreoffice --version")) 
LibreOffice 5.2.2.2 20m0(Build:2) 

R> 

Edit: En fait, peut-être que quelque chose d'autre ne va pas à votre fin, car ici, il fonctionne également avec l'env.var:

[email protected]:~$ R 

R version 3.3.2 (2016-10-31) -- "Sincere Pumpkin Patch" 
Copyright (C) 2016 The R Foundation for Statistical Computing 
Platform: x86_64-pc-linux-gnu (64-bit) 

R is free software and comes with ABSOLUTELY NO WARRANTY. 
You are welcome to redistribute it under certain conditions. 
Type 'license()' or 'licence()' for distribution details. 

    Natural language support but running in an English locale 

R is a collaborative project with many contributors. 
Type 'contributors()' for more information and 
'citation()' on how to cite R or R packages in publications. 

Type 'demo()' for some demos, 'help()' for on-line help, or 
'help.start()' for an HTML browser interface to help. 
Type 'q()' to quit R. 

R> system(paste0("libreoffice --version")) 
LibreOffice 5.2.2.2 20m0(Build:2) 

R> 
+0

merci! parfait (j'utilise un peu 'sudo ldconfig' après avoir édité'/etc/ls.so.conf.d/libc.conf') –

+0

Oui, vous devez lancer 'ldconfig' après avoir apporté des modifications. 'ldconfig -p | grep libreglo' est aussi un bon chèque. Et dis bonjour à Romain pour moi. –

+0

Je le ferai;) Cordialement –