在ubuntu上编译libzmq时,生成configure和makefile的过程中报错:
libzmq-master$ ./autogen.sh autoreconf: Entering directory `.‘ autoreconf: configure.ac: not using Gettext autoreconf: running: aclocal -I config --force -I config autoreconf: configure.ac: tracing autoreconf: configure.ac: not using Libtool autoreconf: running: /usr/bin/autoconf --include=config --force configure.ac:28: error: possibly undefined macro: AC_SUBST If this token and others are legitimate, please use m4_pattern_allow. See the Autoconf documentation. configure.ac:74: error: missing some pkg-config macros (pkg-config package) configure.ac:83: error: possibly undefined macro: AC_LIBTOOL_WIN32_DLL configure.ac:84: error: possibly undefined macro: AC_PROG_LIBTOOL configure.ac:132: error: possibly undefined macro: AC_MSG_RESULT configure.ac:145: error: possibly undefined macro: AC_DEFINE configure.ac:253: error: possibly undefined macro: AC_CHECK_LIB configure.ac:335: error: possibly undefined macro: AC_CHECK_HEADERS configure.ac:337: error: possibly undefined macro: AC_MSG_ERROR configure.ac:521: error: missing some pkg-config macros (pkg-config package) configure.ac:526: error: possibly undefined macro: AC_SEARCH_LIBS configure.ac:555: error: possibly undefined macro: AC_MSG_NOTICE configure.ac:831: error: possibly undefined macro: AC_MSG_WARN configure:6458: error: possibly undefined macro: AC_DISABLE_STATIC configure:6462: error: possibly undefined macro: AC_ENABLE_STATIC autoreconf: /usr/bin/autoconf failed with exit status: 1 autogen.sh: error: autoreconf exited with status 1
按照网友的建议,
sudo apt install automake libtool m4 autoconf
发现全都安装了。尝试其他解决方案:原文链接
一般通过apt-get安装的软件都会在/usr目录下,既然提示无法找到AC_PROG_LIBTOOL,那么分析一般有两个原因:
1.安装包失败或者其他原因比如版本问题导致没有定义AC_PROG_LIBTOOL;
2.寻找路径有问题。
从这两点出发,可以在/usr目录下全局查找AC_PROG_LIBTOOL
可以看到在m4文件中能找到AC_PROG_LIBTOOL,那么就可能是路径问题;
大多数m4文件都在/usr/share/aclocal/目录下,但实际上configure的默认aclocal路径为/usr/local/share/aclocal,
那么可以有两种方法,
第一,将/usr/share/aclocal/下的*.m4文件都拷贝到usr/local/share/aclocal/目录下;
第二,指定aclocal的安装路径;
sudo cp /usr/share/aclocal/*.m4 /usr/local/share/aclocal/
再次./autogen.sh,就通过了。