【问题标题】:Ubuntu 14.04 configure: error: "libxml not found"Ubuntu 14.04 配置:错误:“找不到 libxml”
【发布时间】:2019-03-14 16:28:33
【问题描述】:

尝试按如下方式安装 XML 包我收到错误 configure: error: "libxml not found"。似乎 R 正在从 Anaconda 获取 libxml2 安装。我该如何解决这个问题?

R version 3.4.4 (2018-03-15) -- "Someone to Lean On"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

> install.packages("XML")
Installing package into ‘/home/bravegag/R/x86_64-pc-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/XML_3.98-1.19.tar.gz'
Content type 'application/x-gzip' length 1600788 bytes (1.5 MB)
==================================================
downloaded 1.5 MB

* installing *source* package ‘XML’ ...
** package ‘XML’ successfully unpacked and MD5 sums checked
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for sed... /bin/sed
checking for pkg-config... /usr/bin/pkg-config
checking for xml2-config... /opt/dev/anaconda/2018.12/bin/xml2-config
USE_XML2 = yes
SED_EXTENDED_ARG: -E
Minor 9, Patch 8 for 2.9.8
Located parser file -I/opt/dev/anaconda/2018.12/include/libxml2 -I/opt/dev/anaconda/2018.12/include/parser.h
Checking for 1.8:  -I/opt/dev/anaconda/2018.12/include/libxml2 -I/opt/dev/anaconda/2018.12/include
Using libxml2.*
checking for gzopen in -lz... yes
checking for xmlParseFile in -lxml2... no
checking for xmlParseFile in -lxml... no
configure: error: "libxml not found"
ERROR: configuration failed for package ‘XML’
* removing ‘/home/bravegag/R/x86_64-pc-linux-gnu-library/3.4/XML’

The downloaded source packages are in
    ‘/tmp/RtmpannHh6/downloaded_packages’
Warning message:
In install.packages("XML") :
  installation of package ‘XML’ had non-zero exit status
> 

我也明白了:

$ type xml2-config
xml2-config is /opt/dev/anaconda/2018.12/bin/xml2-config

但是在 R 环境中设置配置并没有帮助:

Sys.setenv(XML_CONFIG="/opt/dev/anaconda/2018.12/bin/xml2-config")

更新 我已经在系统中安装了 libxml2,请参阅:

bravegag@zeus:~$ sudo apt-get install libxml2
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libxml2 is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
bravegag@zeus:~$ sudo apt-get install libxml2-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libxml2-dev is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.

【问题讨论】:

  • 你是如何启动上面的 R shell 的?使用bravegag@zeus:~$ 还是在 conda virtualenv 会话中?对于非 Windows 发行版,请考虑通过 apt-get 而不是从 Anaconda 安装 R。顺便说一句,Ubuntu 14.04 将于 2019 年 4 月 30 日结束生命周期。考虑升级发行版。
  • @Parfait 直接从 shell 启动或从 RStudio 启动,结果相同。我使用 apt-get 安装了 R。我已尝试升级到 16.x,但升级过程失败,错误需要再次放大。目前,正确安装 XML 包会很棒...

标签: r xml ubuntu-14.04 xml-libxml


【解决方案1】:

确保您的系统已安装 libxml-devlibxml2-dev 软件包。即

sudo apt-get install libxml2-dev

我无法确定哪个是 14.04 的正确版本(libxml 或 libxml2),但您需要确保已安装 -dev 版本。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-11-25
    • 2017-03-23
    • 1970-01-01
    • 2014-06-21
    • 2016-01-31
    • 1970-01-01
    相关资源
    最近更新 更多