OSX上的libxml2和libxml2-dev

时间:2012-07-29 01:47:39

标签: c++ macos

尝试构建Unix QuickFIX引擎时,在./bootstrap

之后出现以下错误
warning:macro 'AM_PATH_XML2' not found in library

据我所知,libxml2已经附带了XCode OS X Mountain Lion。我发现一个答案建议下载libxml2-dev,虽然我找不到使用HomeBrew的软件包 我对OS X和Xcode的编程以及移植Unix应用程序都比较陌生,所以我不确定我到底有什么。

3 个答案:

答案 0 :(得分:8)

我做了

brew install libxml2

然后我四处寻找AM_PATH_XML2中的宏/usr/local/Cellar/libxml2/2.8.0/share/aclocal/libxml.m4。这是所有开发包的内容,然后我与我在本地的Ubuntu / Vagrant虚拟对比,工作正常并记得:

brew link --force libxml2

将符号链接放在/usr/local/share/aclocal

现在我正在建设,但我也需要汽车制造商,所以回顾一下

brew install automake autoconf libtool libxml2                                                            
brew link libxml2       

答案 1 :(得分:2)

该警告来自Autoconf,并抱怨configure.in文件引用宏AM_PATH_XML2,但未定义。它应该在quickfix源文件aclocal.m4中定义,所以看起来你的autoconf版本没有找到它。 您可以尝试修改bootstrap以运行autoconf -I .

答案 2 :(得分:1)

我只是在尝试在Mac上构建oath-toolkit时遇到此问题。使用libxml.m4安装后,我可以通过为brew install libxml2创建符号链接来克服此错误。

ln -s /usr/local/opt/libxml2/share/aclocal/libxml.m4 /usr/local/share/aclocal/libxml.m4

我知道这个问题被问了7年多了,但是花了我一段时间才整理出这个解决方案。希望对您有所帮助。我能够在运行aclocal时重现该问题。 configure.ac:38: warning: macro 'AM_PATH_XML2' not found in library错误。然后,我运行aclocal --print-ac-dir返回了/usr/local/Cellar/automake/1.16.1_1/share/aclocal。该目录包含一个dirlist文件。

cat /usr/local/Cellar/automake/1.16.1_1/share/aclocal/dirlist 
/usr/local/share/aclocal
/usr/share/aclocal

第一个目录包含所有其他符号链接。

ls -al /usr/local/share/aclocal
lrwxr-xr-x   1 cameron  admin   48 Sep 20 08:39 cmake.m4 -> ../../Cellar/cmake/3.15.3/share/aclocal/cmake.m4
lrwxr-xr-x   1 cameron  admin   52 Sep 20 09:01 dirlist -> ../../Cellar/automake/1.16.1_1/share/aclocal/dirlist
lrwxr-xr-x   1 cameron  admin   53 Sep 20 09:02 libtool.m4 -> ../../Cellar/libtool/2.4.6_1/share/aclocal/libtool.m4
lrwxr-xr-x   1 cameron  admin   52 Sep 20 09:02 ltargz.m4 -> ../../Cellar/libtool/2.4.6_1/share/aclocal/ltargz.m4
lrwxr-xr-x   1 cameron  admin   50 Sep 20 09:02 ltdl.m4 -> ../../Cellar/libtool/2.4.6_1/share/aclocal/ltdl.m4
lrwxr-xr-x   1 cameron  admin   55 Sep 20 09:02 ltoptions.m4 -> ../../Cellar/libtool/2.4.6_1/share/aclocal/ltoptions.m4
lrwxr-xr-x   1 cameron  admin   53 Sep 20 09:02 ltsugar.m4 -> ../../Cellar/libtool/2.4.6_1/share/aclocal/ltsugar.m4
lrwxr-xr-x   1 cameron  admin   55 Sep 20 09:02 ltversion.m4 -> ../../Cellar/libtool/2.4.6_1/share/aclocal/ltversion.m4
lrwxr-xr-x   1 cameron  admin   57 Sep 20 09:02 lt~obsolete.m4 -> ../../Cellar/libtool/2.4.6_1/share/aclocal/lt~obsolete.m4
lrwxr-xr-x   1 cameron  admin   51 Aug 27 20:15 pkg.m4 -> ../../Cellar/pkg-config/0.29.2/share/aclocal/pkg.m4

按照这种模式,我可以做到:

ln -s /usr/local/Cellar/libxml2/2.9.9_2/share/aclocal/libxml.m4 /usr/local/share/aclocal/libxml.m4

但是我选择使用此符号链接,以便此答案适用于各种版本。

ls -al /usr/local/opt/libxml2
lrwxr-xr-x  1 cameron  admin  25 Sep 20 09:35 /usr/local/opt/libxml2 -> ../Cellar/libxml2/2.9.9_2