报错"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,就通过了。

 

posted @   朱果果  阅读(17043)  评论(0编辑  收藏  举报
编辑推荐:
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
阅读排行:
· winform 绘制太阳,地球,月球 运作规律
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· AI 智能体引爆开源社区「GitHub 热点速览」
· 写一个简单的SQL生成工具
历史上的今天:
2020-02-08 中断与异常
点击右上角即可分享
微信分享提示