在Fedora 27中安装R中的xml2

时间:2017-12-16 22:35:10

标签: r fedora libxml2 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)。

2 个答案:

答案 0 :(得分:2)

由于还没有人回答这个问题而且我找到了一个hacky解决方案,我想我会更新有效的方法。

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

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

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

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

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

R_HOME/etc/ldpaths

答案 1 :(得分:-1)

我已经通过按源安装ICU4C来解决了这个问题:

  1. ICU-Project
  2. 下载ICU4C 58.2
  3. 已编译
  4. 将库位置添加到$LD_LIBRARY_PATH

安装将成功。