可能未定义的宏:AC_PROG_LIBTOOL

eea*_*ach 8 linux autotools libtool

我想构建protobuf,所以我只是在目录中克隆包和cd。当我输入 ./autogen.sh 时,发生了一些错误。 当我输入 ./autogen.sh 时, 我收到回调:

configure.ac:104: error: possibly undefined macro: AC_PROG_LIBTOOL
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
autoreconf: /home/zhangxl/my/autoconf/bin/autoconf failed with exit status: 1
Run Code Online (Sandbox Code Playgroud)

有人说我应该安装 libtool,但我已经安装了 autoconf、automake、libtool 和 m4,但它们都是从源代码构建的,因为我无法获得 sudo 密码。 在此处输入图像描述 这是我的 .bashrc 文件:

export PATH=$PATH:/home/zhangxl/my/libtool/bin
export CPLUS_INCLUDE_PATH=/hpme/zhangxl/my/libtool/include:$CPLUS_INCLUDE_PATH
export LIBRARY_PATH=/home/zhangxl/my/libtool/lib:$LIBRARY_PATH
export LD_LIBRARY_PATH=/home/zhangxl/my/libtool/lib:$LD_LIBRARY_PATH
Run Code Online (Sandbox Code Playgroud)

我想可能 .bashrc 文件不正确,所以我想寻求帮助,非常感谢您的回答。

Loc*_*cke 57

确保您已libtool安装。如果在您的系统上找不到它,则可能会产生此错误消息。autoconflibtool就我而言,错误看起来有点像这样:

autoreconf: configure.ac: not using Libtool
autoreconf: running: /usr/bin/autoconf
...
configure.ac:41: error: possibly undefined macro: AC_PROG_LIBTOOL
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
Run Code Online (Sandbox Code Playgroud)

我通过使用 apt 安装解决了这个问题libtool

autoreconf: configure.ac: not using Libtool
autoreconf: running: /usr/bin/autoconf
...
configure.ac:41: error: possibly undefined macro: AC_PROG_LIBTOOL
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
Run Code Online (Sandbox Code Playgroud)


uml*_*ute 11

libtool不仅仅是一个(一组)二进制文件。它还包括几个 m4 宏(供 autotools 使用),其中包括AC_PROG_LIBTOOL宏。

由于您没有对 libtool 进行“正确”安装,因此 autoconf 没有找到这些额外的宏。

寻找诸如libtool.m4, ltoptions.m4... 之类的文件(可能在某处/home/zhangxl/my/libtool/share/aclocal/并将路径添加到autoreconf调用中。例如:

autoreconf  -f -i -Wall,no-obsolete -I/home/zhangxl/my/libtool/share/aclocal/
Run Code Online (Sandbox Code Playgroud)

(如果您想知道:autoreconf正在被 调用autogen.sh,接近该脚本的结尾;所以当您调用 时autogen.sh,大多数事情已经成功,只有调用autoreconf失败,这就是上面一行修复的内容。如果您希望能够要autogen.sh再次调用,您必须使用autoreconf更改行,如上所示)


Joh*_*ger 0

当我输入 ./autogen.sh 时,发生了一些错误。

Autotools 的设计目标是它们不是普通构建的一部分。自动工具用于构建构建系统,这是包维护者的责任。只想构建项目的人根本不应该(根据 Autotools 哲学)调用 Autotools —— 相反,他们应该使用已经提供给他们的构建系统,包括脚本configure、Makefile 和头模板..

因此,首先要尝试的应该始终是解压缩发行版的干净副本,并且在不运行autogen.shautoreconf或类似的情况下执行标准configure; make; make install序列。在这种情况下,甚至不需要在构建主机上安装 Autotools。仅当需要针对您的环境修改现有构建系统,或者首先没有提供任何构建系统时,您才应该考虑(重新)构建构建系统。

如果您确实需要重建构建系统(这并不像 GNU 所希望的那样罕见),那么最顺利的方法是使用与软件包维护者使用的相同版本的 Autotools。在某种程度上,较新的版本通常是可行的替代品,但有时它们需要对自动工具输入进行调整。旧版本可能会出现问题。但是,您必须清楚地意识到,这使您处于包维护者的角色,而不仅仅是包构建者。重建构建系统让您需要解决特定于该工作的问题。

有时,通过指示 Autotools 替换安装到项目源代码树中的脚本和本地 m4 宏,可以部分或全部解决版本兼容性问题。如果项目提供了autogen.sh,它可能会也可能不会这样做。从源树的根运行的命令autoreconf --install --force将处理所有这些 Autotools 部分,但可能不会执行其他操作autogen.sh。可能值得您花一些时间来检查您的特定功能,并且按顺序运行和autogen.sh可能会很有用。autoreconfautogen.sh

我认为 .bashrc 文件可能不正确

It is unlikely that the particular error message you presented reflects a problem with your environment configuration. It could reflect an issue with your DIY local Autotools -- more likely Libtool than the others -- but there is a fair chance that it reflects an incompatibility between the Autotools versions used by the package's maintainers and the ones you have built.