error: version mismatch. This is Automake 1.15.1 but the definition ... comes from Automake 1.14.1

error: version mismatch. This is Automake 1.15.1 but the definition ... comes from Automake 1.14.1

另一个 Autotools 问题...我正在使用 Fedora 27,我正在尝试构建 libidn and libidn2. I need configure; make; make install to actually work. The machines I need it to work on only have Autoconf, Automake, Autopoint, Libtool and compiler tools. They don't have anything else, like <something>2html or <something>2pdf so I cannot build documentation. I also cannot run autoreconf per the manual 因为它也坏了。

我不知道为什么这些工具会尝试构建文档,因为我使用 --disable-gtk-doc --disable-gtk-doc-html --disable-gtk-doc-pdf 禁用了它们。我尝试使用 HELP2MAN=trueMAKEINFO=true 解决它,但 Autotools 找到了另一种破解方法:

gmake[2]: Entering directory '/home/Build-Scripts/libidn-1.33/doc'
echo '# This file is automatically generated.  DO NOT EDIT!          -*- makefile -*-' > Makefile.gdoc
echo >> Makefile.gdoc
echo 'gdoc_TEXINFOS =' >> Makefile.gdoc
echo 'gdoc_MANS =' >> Makefile.gdoc
echo >> Makefile.gdoc
for file in ../lib/idna.c ../lib/nfkc.c ../lib/pr29.c ../lib/punycode.c ../lib/stringprep.c ../lib/tld.c ../lib/toutf8.c ../lib/version.c ../lib/idn-free.c ../lib/strerror-idna.c ../lib/strerror-pr29.c ../lib/strerror-punycode.c ../lib/strerror-stringprep.c ../lib/strerror-tld.c; do \
  shortfile=`basename $file`; \
  echo "#" >> Makefile.gdoc; \
  echo "### $shortfile" >> Makefile.gdoc; \
  echo "#" >> Makefile.gdoc; \
  echo "gdoc_TEXINFOS += texi/$shortfile.texi" >> Makefile.gdoc; \
  echo "texi/$shortfile.texi: $file" >> Makefile.gdoc; \
  echo 'TABmkdir -p `dirname $@`' | sed "s/TAB/ /" >> Makefile.gdoc; \
  echo 'TAB$(PERL) ./gdoc -texinfo $(GDOC_TEXI_EXTRA_ARGS) $< > $@' | sed "s/TAB/       /" >> Makefile.gdoc; \
  echo >> Makefile.gdoc; \
  functions=`perl ./gdoc -listfunc $file`; \
  for function in $functions; do \
    echo "# $shortfile: $function" >> Makefile.gdoc; \
    echo "gdoc_TEXINFOS += texi/$function.texi" >> Makefile.gdoc; \
    echo "texi/$function.texi: $file" >> Makefile.gdoc; \
    echo 'TABmkdir -p `dirname $@`' | sed "s/TAB/       /" >> Makefile.gdoc; \
    echo 'TAB$(PERL) ./gdoc -texinfo $(GDOC_TEXI_EXTRA_ARGS) -function'" $function"' $< > $@' | sed "s/TAB/     /" >> Makefile.gdoc; \
    echo >> Makefile.gdoc; \
    echo "gdoc_MANS += man/$function.3" >> Makefile.gdoc; \
    echo "man/$function.3: $file" >> Makefile.gdoc; \
    echo 'TABmkdir -p `dirname $@`' | sed "s/TAB/       /" >> Makefile.gdoc; \
    echo 'TAB$(PERL) ./gdoc -man $(GDOC_MAN_EXTRA_ARGS) -function'" $function"' $< > $@' | sed "s/TAB/  /" >> Makefile.gdoc; \
    echo >> Makefile.gdoc; \
  done; \
  echo >> Makefile.gdoc; \
done
gmake Makefile
gmake[3]: Entering directory '/home/Build-Scripts/libidn-1.33/doc'
 cd .. && automake --gnu doc/Makefile
configure.ac:25: error: version mismatch.  This is Automake 1.15.1,
configure.ac:25: but the definition used by this AM_INIT_AUTOMAKE
configure.ac:25: comes from Automake 1.14.1.  You should recreate
configure.ac:25: aclocal.m4 with aclocal and run automake again.
gmake[3]: *** [Makefile:1494: Makefile.in] Error 63
gmake[3]: Leaving directory '/home/Build-Scripts/libidn-1.33/doc'
gmake[2]: *** [Makefile:2205: Makefile.gdoc] Error 2
gmake[2]: Leaving directory '/home/Build-Scripts/libidn-1.33/doc'
gmake[1]: *** [Makefile:1333: all-recursive] Error 1
gmake[1]: Leaving directory '/home/Build-Scripts/libidn-1.33'
gmake: *** [Makefile:1235: all] Error 2

我发现 难以置信 很难相信 Automake-1.14 是必需的;不能使用 Automake-1.15。我不关心包版本检查,所以接下来我想尝试跳过它们。

我该如何解决这个问题?

回到 10,000 英尺,Autotools 是否有任何具有用户界面经验的人为他们的某些决策提供意见?或者,Autotools 有什么问题以至于他们觉得有必要破坏我的构建,因为我的 Automake 版本比配置的包更新?谁做出了那个英明的决定?


配置方式如下:

    PKG_CONFIG_PATH="/usr/local/lib64/pkgconfig" \
    CPPFLAGS="-I/usr/local/include -DNDEBUG" \
    CFLAGS= -m64 -march=native -fPIC" \
    CXXFLAGS= -m64 -march=native -fPIC" \
    LDFLAGS="-L/usr/local/lib64 -m64 -Wl,-R,/usr/local/lib64 -Wl,--enable-new-dtags" \
    LIBS="-ldl -lpthread" \
./configure --prefix="/usr/local" --libdir="/usr/local/lib64" \
    --enable-shared
    # --disable-gtk-doc --disable-gtk-doc-html --disable-gtk-doc-pdf

下面是 make 的调用方式:

MAKE_FLAGS=("-j" "$MAKE_JOBS")
MAKE_FLAGS+=("ACLOCAL=aclocal")
MAKE_FLAGS+=("AUTOCONF=autoconf")
MAKE_FLAGS+=("AUTOHEADER=autoheader")
MAKE_FLAGS+=("AUTOMAKE=automake")
MAKE_FLAGS+=("PERL=perl")
MAKE_FLAGS+=("HELP2MAN=true")
MAKE_FLAGS+=("MAKEINFO=true")

if ! "$MAKE" "${MAKE_FLAGS[@]}"
then
    echo "Failed to build IDN"
    [[ "[=12=]" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1
fi

这条消息:

This is Automake 1.15.1 but the definition … comes from Automake 1.14.1

...说Automake是运行ning,不是configure; make; make install的普通部分。正如我之前所说,如果可能,您应该更愿意避免重建构建系统,而且通常确实是可能的。 Autotools 主要用于包维护者,而不是包构建者。原则上,构建者只使用维护者通过 Autotools 创建的工件。

I'm working on Fedora 27 and I am trying to build libidn and libidn2. I need configure; make; make install to actually work. The machines I need it to work on only have Autoconf, Automake, Autopoint and Libtool. They don't have anything else so I cannot run autoreconf because that is broken too.

例如,我刚刚抓取了 libidn (v 1.33) 的 Fedora 27 源 RPM,用它在我的 CentOS 7 机器上解压了源分发的副本,更改为生成的目录,并成功执行了 ./configure; make(但没有尝试 make install)。 Autoconf 和 A​​utomake 安装在我的机器上,但没有像我期望的那样 运行。

但是,如果 Autotools 实际上安装在构建机器上,并且如果它们的输入(configure.acMakefile.am 等)看起来比它们的输出(configure, Makefile.in, 等等),那么一个 Autotools 派生的构建系统可能确实会尝试重建这些输出( 重建自身)。如果构建机器上存在的 Autotools 版本与最初用于准备构建系统的版本不同,这可能需要一些帮助。

当这不起作用时——通常是因为 Autotools 版本不匹配——通常求助于 运行 autoreconf --install --force。我不清楚你的 autoreconf 是如何或为什么被破坏以防止这种情况发生的。在 Fedora 27 上,autoreconfautoconf 打包在一起,所以如果你有后者,那么你也应该有前者。尽管如此,autoreconf 只是其他几个工具的便利包装。你真的不需要它。例如,您应该能够通过命令

更新构建系统中与 Automake 相关的部分
automake -f -c

。您可能希望通过 运行ning Autoconf 跟进:

autoconf -f

作为一个可能的替代方案,如果 Autotools 输入实际上没有被修改,那么您可能只是遇到了时间戳问题。在那种情况下,您可以尝试解决那里的问题,也许是这样的:

find . -name configure -o name config.status -o name Makefile.in \
  | xargs touch

I find it incredibly hard to believe Automake-1.14 is required; and Automake-1.15.1 cannot be used. I don't care about the package version checks so I want to try to skip them next.

没关系,因为 no 版本的 Automake 是任何受支持平台的正常构建包的一部分。哪些平台是 "supported" 主要是构建系统的功能,而不是 Autotools 本身的功能,因此结果确实取决于构建该系统的人的技能和远见。而且您确实关心您描述的特定包版本检查,因为忽略或抑制它会带来导致 Automake 和/或 Autoconf 输出无法正常工作的高风险。

Autotools 在提供多平台支持方面的帮助可能比您意识到的要多,但它们无法自动确保通用 支持。 CMake 或 Scons 等替代方案也不能。

Stepping back to 10,000 feet, does Autotools have anyone with user interface experience to provide input for some of their decisions? Or, what is so broken with Autotools that they feel the need to break my build because my version of Automake is newer than the package was configured with? Who is the idiot who made that brilliant decision?

再次抱歉,您遇到了困难。但是 Autotools 无法破坏您的构建,因为它们 involved 在您的构建中。 Autotools 被以包维护者角色操作的人用来构建包的构建系统。如果生成的构建系统不能充分服务于您尝试构建包的机器和配置,那么这不是 Autotools 的错。

鉴于您似乎将大量基于 Autotools 的包移植到其构建系统不支持的环境中,是的,您接触了 Autotools,而那些仅为支持的环境构建包的人并不有。我倾向于认为你以某种方式获得了比必要更多的曝光,但这是一个单独的问题。无论如何,你是在包维护模式下操作,你需要从那个角度看情况。您只是构建包。

这是我修复它的方法。它适用于 libidnlibidn2.

首先,下载并解压libidn{2}。然后cd进入相应的目录。

其次,修复顶级configure.ac文件。这被称为 gdoc 的东西引用,即使在没有文档的情况下配置了东西:

# Fix AM_INIT_AUTOMAKE
sed -e 's/^AM_INIT_AUTOMAKE.*/AM_INIT_AUTOMAKE/g' configure.ac > configure.ac.fixed
mv configure.ac.fixed configure.ac
# Remove useless directive
sed -e '/AM_SILENT_RULES/d' configure.ac > configure.ac.fixed
mv configure.ac.fixed configure.ac
# Get rid of all docs Makefiles
sed -e '/^  doc\//d' configure.ac > configure.ac.fixed
mv configure.ac.fixed configure.ac
# Set time in the past to avoid re-configuration
touch -t 197001010000 configure.ac

三、configurelibidn{2}根据需要

第四,修正个别的Makefile。此步骤在递归 make 期间删除 for/each 调用中的 doc/ 目录:

for mfile in $(find "$PWD" -name Makefile);
do
    # Get rid of all docs directories
    sed -e 's| doc | |g' "$mfile" > "$mfile.fixed"
    mv "$mfile.fixed" "$mfile"
done

第五,运行make.