【问题标题】:automake error message in autotools自动工具中的自动生成错误消息
【发布时间】:2016-10-21 16:00:26
【问题描述】:

我是第一次尝试使用 Autotools。我设法用手写的 Makefile.in 编译了我的代码。并使用 autoconf(./configure make)。

但是现在,我决定使用Automake 生成Makefile.in 使用Makefile.am

我的 Makefile.am:

bin_PROGRAMS=hello_portable
hello_portable_SOURCES=hello_portable.c

我的 configure.ac 由 autoscan 自动生成:

AC_PREREQ([2.69])
AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])
AM_INIT_AUTOMAKE(summary, 1.0.0)
AC_CONFIG_SRCDIR([hello_portable.c])
AC_CONFIG_HEADERS([config.h])

# Checks for programs.
AC_PROG_CC

# Checks for libraries.

# Checks for header files.
AC_CHECK_HEADERS([sys/time.h])

# Checks for typedefs, structures, and compiler characteristics.

# Checks for library functions.
AC_CHECK_FUNCS([gettimeofday])

AC_OUTPUT

当我为了生成 Makefile.in 进行 automake 时

# automake --add-missing

configure.ac: error: no proper invocation of AM_INIT_AUTOMAKE was found.
configure.ac: You should verify that configure.ac invokes AM_INIT_AUTOMAKE,
configure.ac: that aclocal.m4 is present in the top-level directory,
configure.ac: and that aclocal.m4 was recently regenerated (using aclocal)
Makefile.am: error: required file './NEWS' not found
Makefile.am: error: required file './README' not found
Makefile.am: error: required file './AUTHORS' not found
Makefile.am: error: required file './ChangeLog' not found
/usr/share/automake-1.14/am/depend2.am: error: am__fastdepCC does not appear in AM_CONDITIONAL
/usr/share/automake-1.14/am/depend2.am:   The usual way to define 'am__fastdepCC' is to add 'AC_PROG_CC'
/usr/share/automake-1.14/am/depend2.am:   to 'configure.ac' and run 'aclocal' and 'autoconf' again
/usr/share/automake-1.14/am/depend2.am: error: AMDEP does not appear in AM_CONDITIONAL
/usr/share/automake-1.14/am/depend2.am:   The usual way to define 'AMDEP' is to add one of the compiler tests
/usr/share/automake-1.14/am/depend2.am:     AC_PROG_CC, AC_PROG_CXX, AC_PROG_OBJC, AC_PROG_OBJCXX,
/usr/share/automake-1.14/am/depend2.am:     AM_PROG_AS, AM_PROG_GCJ, AM_PROG_UPC
/usr/share/automake-1.14/am/depend2.am:   to 'configure.ac' and run 'aclocal' and 'autoconf' again

我做错了什么。

【问题讨论】:

  • 作为一个起点:Makefile.am:错误:找不到所需的文件'./INSTALL'。你有所有这些文件吗?
  • 没有。这些是什么。我应该只触摸这些文件吗?
  • 使用 --add--missing 命令行参数,生成它们。 Makefile.am 中的第二行应该开始 hello_portable_SOURCES
  • 嗨@arved 查看我的编辑。我按照你说的修改了文件。一些错误已解决,但仍有一些错误。
  • AM_INIT_AUTOMAKE([foreign]) 放宽了 GNU (gnits) 标准。即,您不需要官方“GNU”软件包所需的文件NEWS、README、AUTHORS、ChangeLog。推荐使用autoreconf -fvi进行再生。

标签: linux autotools configure autoconf automake


【解决方案1】:

您需要在 configure.ac 中添加几行:

AC_PREREQ([2.69])
AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])
AM_INIT_AUTOMAKE(summary, 1.0.0)
AC_CONFIG_SRCDIR([hello_portable.c])
AC_CONFIG_HEADERS([config.h])
#LINE1!!!!!!!!!!
AM_INIT_AUTOMAKE([1.9])

# Checks for programs.
AC_PROG_CC

# Checks for libraries.

# Checks for header files.
AC_CHECK_HEADERS([sys/time.h])

# Checks for typedefs, structures, and compiler characteristics.

# Checks for library functions.
AC_CHECK_FUNCS([gettimeofday])
#LINE2!!!!!!!!!!!
AC_CONFIG_FILES([Makefile])

AC_OUTPUT

这样修改后就可以运行了:

touch NEWS README AUTHORS ChangeLog && autoreconfig -i && ./configure

顺便说一下 GNU hello world,你可以用它作为例子: https://www.gnu.org/software/hello/

【讨论】:

  • 如果可能,PS 使用 cmake 更简单。
  • 好的,唯一的问题是 AM_INIT_AUTOMAKE([1.9]) 版本的 automake。工作。谢谢
【解决方案2】:

您必须逐行修复它。 首先,创建Makefile.am所需的所有新文件。(此步骤您也可以运行'automake --add-missing'以便自动添加丢失的文件) $ touch NEWS README AUTHORS ChangeLog 其次,您必须在 automake 之前运行 aclocal。 $ aclocal 最后,您可以运行 automake。 $ automake

【讨论】:

    猜你喜欢
    • 2020-01-26
    • 1970-01-01
    • 2011-03-24
    • 2014-03-13
    • 1970-01-01
    • 2016-05-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多