jww*_*jww 3 autoconf autotools m4
我正在尝试从 GutHub 源构建libpsl。它需要一个autoreconf. Autotools 失败:
# Try to reconfigure. Autotools is so broken...
libtoolize --force && aclocal && autoheader && autoreconf --force --install
...
libtoolize: copying file 'm4/ltversion.m4'
libtoolize: copying file 'm4/lt~obsolete.m4'
configure.ac:62: error: possibly undefined macro: AC_MSG_ERROR
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
configure.ac:68: error: possibly undefined macro: AC_MSG_CHECKING
configure.ac:70: error: possibly undefined macro: AC_MSG_RESULT
configure.ac:87: error: possibly undefined macro: AC_LINK_IFELSE
configure.ac:88: error: possibly undefined macro: AC_LANG_PROGRAM
configure.ac:222: error: possibly undefined macro: AC_SEARCH_LIBS
...
Run Code Online (Sandbox Code Playgroud)
我发现Possible undefined macro: AC_MSG_ERROR and AS_IF and AC_MSG_ERROR: error: possible undefined macro,但猜测并不能解决我的问题。我花了大约 4 个小时来尝试猜测。
我想停止猜测并解决问题。我遇到的问题是,我找不到有关解决 Autotools 问题的信息或过程。协商,“排除故障” autoconf site:gnu.org。
我想出的最好办法是使用 运行命令-v,但我没有看到复制的尝试general.m4。如果我没记错的话,general.m4提供AC_MSG_ERROR这样我应该看到它被访问。所以我的程序有明显的漏洞或者缺陷。文件存在:
$ find /usr/local -name general.m4
/usr/local/share/autoconf/autoconf/general.m4
/usr/local/share/autoconf/autotest/general.m4
Run Code Online (Sandbox Code Playgroud)
如何解决Possibly undefined macro: AC_MSG_ERRORAutotools 的问题?
如何解决Autotools可能未定义的宏问题?
AC_MSG_ERROR
首先,如果可能的话,应该通过不重建构建系统来完全避免这种情况。Autotools 构建系统的目的是不需要将重建作为构建包的先决条件,因此第一个行动方案应该始终是尝试./configure; make完全不运行 Autotools。
如果您确实需要重建构建系统(有时这是必要的,因为即使是最好的 Autotools 黑客也不可能解释所有可能的当前和未来构建环境),那么第一部分是确保您拥有最新版本的 Autotools 并运行autoreconf --install --force(我看到你已经在做了)。这可确保您所拥有的 Autotools 版本的所有设置均正确。
这让我们回到了实际的问题,关于故障排除,特别是关于引用标准 Autoconf 宏(例如AC_MSG_ERROR. 您可以使用多种工具和方法,其中包括:
查看configure.ac警告中报告的行,尤其是最低的行,以及前面的行。此特定错误表示正在将文本发送到看起来像未展开的宏名称的输出文件中,因此问题通常是由不正确的引用或未封闭的宏参数列表引起的。
检查configureAutoconf 输出的脚本。找到它开始出错的地方(在这种情况下,未扩展的宏名称将帮助您找到它),并将其和前面的正确输出与您的内容configure.ac和它所依赖的任何外部宏定义的内容相关联。这可以帮助您查明错误的位置。
#您可以使用或注释掉 Autoconf 源代码行dnl,以应用二分法来跟踪错误行。
直接运行autoconf,带有额外的面向调试的选项。例如,
autoconf --verbose --force --warnings=all
Run Code Online (Sandbox Code Playgroud)
还有一个--debug保留临时文件的选项,但我怀疑它对您的目的不太有用。
在某些情况下,通过使用该选项跟踪对一个或多个宏的调用可能会有所帮助--trace,尽管我认为这与您询问的特定错误没有那么相关。请注意,跟踪输出取代了通常输出的配置脚本autoconf。
| 归档时间: |
|
| 查看次数: |
9161 次 |
| 最近记录: |