简体   繁体   English

在配置脚本中硬编码的automake版本(am__api_version)

[英]automake version (am__api_version) hardcoded in configure script

I'm currently working on a Linux project using autotools. 我目前正在使用autotools开发Linux项目。 The code is submitted in SCM (Perforce) and we have the configure script, Makefile.am, Makefile.in - the usual autotools boilerplate. 代码在SCM(Perforce)中提交,我们有配置脚本Makefile.am,Makefile.in - 通常的autotools样板。 Recently, somebody has changed Makefile.am, but forgot to regenerate Makefile.in; 最近,有人改变了Makefile.am,但忘了重新生成Makefile.in; when I tried to build, I got this error: 当我尝试构建时,我收到此错误:

WARNING: `automake-1.11' is missing on your system.  You should only need it if
         you modified `Makefile.am', `acinclude.m4' or `configure.ac'.
         You might want to install the `Automake' and `Perl' packages.
         Grab them from any GNU archive site.
 cd . && /bin/bash ./config.status Makefile depfiles

I see the automake version is hardcoded in the configure script (and seems to come from aclocal.m4): 我看到automake版本在configure脚本中是硬编码的(似乎来自aclocal.m4):

am__api_version='1.11'

So I guess I need automake-1.11 (not 1.10, not anything newer) to regenerate the Makefile.in file. 所以我想我需要使用automake-1.11(不是1.10,而不是更新的)来重新生成Makefile.in文件。

Why is that? 这是为什么? Why should we be tied to a specific automake version? 我们为什么要绑定特定的automake版本? We're mostly building on Ubuntu 14.04, where 1.14 is the default version installed. 我们主要在Ubuntu 14.04上构建,其中1.14是安装的默认版本。 Is there a way to tell the build system to simply use whatever version of automake is installed? 有没有办法告诉构建系统简单地使用任何版本的automake? Or is it safe to maybe remove the am__api_version definition from aclocal.m4? 或者从aclocal.m4中删除am__api_version定义是否安全?

The problem is that you are trying to recreate Makefile.in with other version of autotools. 问题是您正在尝试使用其他版本的autotools重新创建Makefile.in It would lead to version mismatch as aclocal.m4 was built with different version and it is used to generate the remaining files. 它会导致版本不匹配,因为aclocal.m4是使用不同的版本aclocal.m4 ,它用于生成剩余的文件。

Instead of recreating only Makefile.in , try to also recreate aclocal.m4 and all remaining autotools generated files: 而不是只重新创建Makefile.in ,尝试重新创建aclocal.m4和所有剩余的autotools生成的文件:

autoreconf --force --install   

The important question is why would someone fix am__api_versions . 重要的问题是为什么有人会修复am__api_versions The most probable answer is: Because automake tends to alter the macro's arguments or even remove entirely macros of previous release. 最可能的答案是:因为automake倾向于改变宏的参数,甚至删除以前版本的完全宏。 In each release announcement of automake there is a section called automake每个发布公告中都有一个名为

WARNING: Future backward-incompatibilities! 警告:未来的后向兼容性!

and an other one called 另一个叫

Obsolete features removed 删除了过时的功能

You can refer to releases 1.12 , 1.13 , 1.14 你可以参考版本1.121.131.14

So the configure.ac or Makefile.am might contain some macros which have become obsolete in later releases. 所以configure.acMakefile.am可能包含一些在以后的版本中已经过时的宏。 When encountering this problem you have two possibilities. 遇到这个问题时,你有两种可能性。 Either find out which feature replaced the obsolete one or stick to one version of automake . 要么找出哪个功能取代了过时的功能,要么坚持使用一个版本的automake Most developers do not feel that autotools files are part of the projects source code. 大多数开发人员并不认为autotools文件是项目源代码的一部分。 They just wish to keep the working version running and stick to the current am version. 他们只是希望保持工作运行的版本,并坚持到现在am的版本。

Note that all distributions support older versions of automake . 请注意,所有发行版都支持旧版本的automake In ubuntu you can find: 在ubuntu中你可以找到:

$ apt-cache search automake | grep automake
automake - Tool for generating GNU Standards-compliant Makefiles
automake1.4 - A tool for generating GNU Standards-compliant Makefiles
automake1.9 - A tool for generating GNU Standards-compliant Makefiles
automake1.10 - Tool for generating GNU Standards-compliant Makefiles
automake1.11 - Tool for generating GNU Standards-compliant Makefiles

Meaning that you can install the requested version of automake . 这意味着您可以安装所需的automake版本。

So, you could remove the line am__api_version='1.11' and find out which macro is obsolete. 因此,您可以删除行am__api_version='1.11'并找出哪个宏已过时。 Then you will have to decide which of the above two solutions you will follow. 然后,您将必须决定您将遵循以上两种解决方案中的哪一种。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM