报错“configure.ac: error: possibly undefined macro“的解决方案

在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,就通过了。

  • 5
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值