我正在尝试从 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
有人可以帮我吗?谢谢
对于 Ubuntu,以下内容对我有帮助:
apt-get install libxml2-dev
这也应该有效,因为我没有酿造:
yum install libxml2-devel
高山用
apk add libxml2-dev
所以,您已经随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找不到它的原因。
所以你必须在运行时指定libxml2的位置
./configure
,就像brew和libvisio告诉你的那样:
./configure LIBXML_CFLAGS=-I/usr/local/opt/libxml2/include LIBXML_LIBS=-L/usr/local/opt/libxml2/lib
(您系统上的路径可能有所不同,因此请检查!)
解决此问题的其他方法:
inlcude/
、lib/
和 pkg-config
文件符号链接到 /usr/local/
自己我在 Ubuntu 16.04 上从源代码构建 PHP 7.4 时遇到了这个问题,我通过使用与上面建议的 OSX 相同的方式+为 libxml2-dev 安装开发包来修复该问题
sudo apt-get install libxml2-dev
./configure LIBXML_CFLAGS=-I/usr/include LIBXML_LIBS=-L/usr/lib/x86_64-linux-gnu/ ....
未找到包“libxml-2.0”
表示没有“/usr/lib/pkgconfig/libxml-2.0.pc”,通常在libxml2开发文件中找到。就像“libxml2-devel”。
为您建议命令
apt install -y \
autotools-dev \
automake \
libtool \
gperf \
libicu-dev \
librevenge-dev \
libxml2-dev \
libcppunit-dev \
perl \
g++ \
make \
libboost-all-dev