5

I'm having trouble installing xml2 in RStudio, running Fedora 27. On running install.packages('xml2'), I get the following error:

installing to /home/ryi/R/x86_64-redhat-linux-gnu-library/3.4/xml2/libs
** R
** inst
** preparing package for lazy loading
** help
Error : /tmp/Rtmp2sKZQZ/R.INSTALL689b37bd918d/xml2/man/read_xml.Rd:47: unable to load shared object '/home/ryi/R/x86_64-redhat-linux-gnu-library/3.4/xml2/libs/xml2.so':
  libicui18n.so.58: cannot open shared object file: No such file or directory
ERROR: installing Rd objects failed for package ‘xml2’
* removing ‘/home/ryi/R/x86_64-redhat-linux-gnu-library/3.4/xml2’
Warning in install.packages :
  installation of package ‘xml2’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/RtmpPs5Gzi/downloaded_packages’

I noticed in my /usr/lib64/, I have libicui18n.so.57 only, so I tried copying a libicui18n.so.58 there, and I got the following error:

installing to /home/ryi/R/x86_64-redhat-linux-gnu-library/3.4/xml2/libs
** R
** inst
** preparing package for lazy loading
** help
Error : /tmp/Rtmp908Ecf/R.INSTALL653812e0e41f/xml2/man/read_xml.Rd:47: unable to load shared object '/home/ryi/R/x86_64-redhat-linux-gnu-library/3.4/xml2/libs/xml2.so':
  libicuuc.so.58: cannot open shared object file: No such file or directory
ERROR: installing Rd objects failed for package ‘xml2’
* removing ‘/home/ryi/R/x86_64-redhat-linux-gnu-library/3.4/xml2’
Warning in install.packages :
  installation of package ‘xml2’ had non-zero exit status

The downloaded source packages are in
    ‘/tmp/RtmpPs5Gzi/downloaded_packages’

And I noticed the same problem -- I have version .57, not version .58 of this library as well. Before I repeat this over and over, is this in fact a shared library problem? Or, is there a way to fix this all at once?

I have xml2 installed (libxml2-devel-2.9.5-2.fc27.x86_64) already.

Robert Yi
  • 1,553
  • 1
  • 14
  • 18
  • It could be a permissions issue. Do not install via RStudio but run the install at command line with R.exe using `sudo`. – Parfait Dec 17 '17 at 04:03

2 Answers2

3

Since no one answered this yet and I've found a hacky solution, I thought I'd give an update on what worked.

It appears that my issue was that, even upon installing libxml2-devel, the version of the libraries I had in /usr/lib64 were not the same version required by RStudio's xml2 package. For example, regarding the particular package being mentioned in my question above, libicuuc.so.58, only libicuuc.so.57 could be found in /usr/lib64.

Running locate libicuuc.so.58, I found that anaconda3 has the correct versions of the libraries, so I got around the above problem temporarily by simply adding ~/anaconda3/lib to $LD_LIBRARY_PATH, roughly following instructions here.

This is a bit hacky, but led to successful installation.

Edit (IMPORTANT): Adding ~/anaconda3/lib to LD_LIBRARY_PATH in .bashrc caused a login loop, presumably because Fedora was trying to use the wrong libraries. To fix this, I added the lines:

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/ryi/anaconda3/lib/
export LD_LIBRARY_PATH

to R_HOME/etc/ldpaths.

Robert Yi
  • 1,553
  • 1
  • 14
  • 18
-1

I have solved this problem by install the ICU4C by source:

  1. downloading ICU4C 58.2 from: ICU-Project
  2. compiled
  3. added the library location to $LD_LIBRARY_PATH,

the install will be work.