未找到包 'libxml-2.0'

No package 'libxml-2.0' found

我正在尝试将 libvisio 添加到我的 mac os x 来自 https://wiki.documentfoundation.org/DLP/Libraries/libvisio

我已经添加了下面列出的所有依赖项:

boost
gperf
icu
librevenge
libxml2
perl
doxygen

添加依赖项后,我正在尝试运行发出命令。

$ ./autogen.sh ''# only needed for building from git''
$ ./configure
$ make
$ make install

但是我对第二个命令有问题$ ./configure

出现以下错误。

configure: error: Package requirements (
    libxml-2.0
) were not met:

No package 'libxml-2.0' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables LIBXML_CFLAGS
and LIBXML_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

我试图用 $ brew install libxml 安装 libxml2,但它说 Warning: libxml2-2.9.3 already installed

我正在使用 OS X 10.11.4

有人可以帮助我吗?谢谢


No package 'libxml-2.0' found

表示没有“/usr/lib/pkgconfig/libxml-2.0.pc”,通常出现在libxml2开发文件中。喜欢 "libxml2-devel" ?


因此,您已经使用 brew 安装了 libxml2。正如 brew 在安装 libxml2 时告诉您的那样:

margold@home-macbook ~ $ brew install libxml2
(...)
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.

OS X already provides this software and installing another version in
parallel can cause all kinds of trouble.

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

    LDFLAGS:  -L/usr/local/opt/libxml2/lib
    CPPFLAGS: -I/usr/local/opt/libxml2/include
(...)

这意味着 brew 没有将 libxml2 符号链接到 /usr/local/lib 和 /usr/local/include,并且可能也没有在那里链接 pkg-config 文件,这就是 libvisio 找不到它的原因。

所以你必须在 运行 ./configure 时指定 libxml2 的位置,就像 brew 和 libvisio 告诉你的那样:

./configure LIBXML_CFLAGS=-I/usr/local/opt/libxml2/include LIBXML_LIBS=-L/usr/local/opt/libxml2/lib

(您系统上的路径可能有所不同,因此请检查!)

其他解决方法:

  • 直接用brew安装libvisio
  • 将 libxml 的 inlcude/lib/pkg-config 文件符号链接到 /usr/local/ 你自己

这应该也可以,因为我没有 brew:

yum install libxml2-devel

对于Ubuntu,以下帮助了我:

apt-get install libxml2-dev

我在 PHP 7.4 从 Ubuntu 16.04 上的源代码构建时遇到了这个问题,我通过使用与上面建议的 OSX 相同的方式修复了这个问题 + 安装 libxml2-dev 的开发包

sudo apt-get install libxml2-dev
./configure LIBXML_CFLAGS=-I/usr/include LIBXML_LIBS=-L/usr/lib/x86_64-linux-gnu/ ....

高山

apk add libxml2-dev