找不到包“libxml-2.0”

新手上路,请多包涵

我正在尝试从 https://wiki.documentfoundation.org/DLP/Libraries/libvisio 在我的 mac os x 中添加 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

有人可以帮我吗?谢谢

原文由 Rohan 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 1.7k
2 个回答

因此,您已经使用 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
  • inlcude/lib/pkg-config 文件的 libxml 符号链接到 —69aa9777d58adfe /usr/local/

原文由 margold 发布,翻译遵循 CC BY-SA 3.0 许可协议

对于 Ubuntu,以下内容帮助了我:

 apt-get install libxml2-dev

原文由 Xolani 发布,翻译遵循 CC BY-SA 4.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题