在Fedora 27中安装R中的xml2

我在运行Fedora 27的RStudio中安装xml2时遇到问题.在运行install.packages(‘xml2’)时,我收到以下错误:

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’

我注意到在/usr/lib64 /中,我只有libicui18n.so.57,所以我尝试在那里复制一个libicui18n.so.58,我收到以下错误:

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’

我注意到同样的问题 – 我有版本.57,而不是这个库的.58版本.在我一遍又一遍地重复之前,这实际上是一个共享库问题吗?或者,有没有办法一次解决这个问题?

我已经安装了xml2(libxml2-devel-2.9.5-2.fc27.x86_64).

最佳答案 既然没有人回答这个问题,而且我找到了一个hacky解决方案,我想我会更新一下有效的方法.

看来我的问题是,即使安装了libxml2-devel,我在/usr/lib64中的库版本也不是RStudio的xml2包所需的版本.例如,关于上面我的问题中提到的特定包,libicuuc.so.58,只能在/usr/lib64中找到libicuuc.so.57.

运行找到libicuuc.so.58,我发现anaconda3有正确版本的库,所以我只是简单地将〜/ anaconda3 / lib添加到$LD_LIBRARY_PATH,大致跟随instructions here,从而暂时解决了上述问题.

这有点hacky,但导致安装成功.

编辑(重要):在.bashrc中将〜/ anaconda3 / lib添加到LD_LIBRARY_PATH会导致登录循环,大概是因为Fedora试图使用错误的库.为了解决这个问题,我添加了以下几行:

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

到R_HOME / etc / ldpaths.

点赞