简体   繁体   English

autotools中的automake错误消息

[英]automake error message in autotools

I am trying to use Autotools for the first time. 我第一次尝试使用Autotools。 I have managed to compile my code with Hand written Makefile.in. 我已经设法用Hand write Makefile.in编译我的代码。 and using autoconf (The ./configure make). 并使用autoconf(./configure make)。

However Now, i decided to use Automake to generate a Makefile.in using Makefile.am 但是现在,我决定使用Automake来生成Makefile.in使用Makefile.am

My Makefile.am: 我的Makefile.am:

bin_PROGRAMS=hello_portable
hello_portable_SOURCES=hello_portable.c

My configure.ac auto-generated by autoscan: 我的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

When I do automake in order to generate Makefile.in 当我做automake以生成Makefile.in

# 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

What did I do wrong. 我做错了什么。

You need add couple of lines to your configure.ac: 您需要在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

after such modification you can run: 经过这样的修改后你可以运行:

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

By the way there GNU hello world, you can use it as example: https://www.gnu.org/software/hello/ 顺便说一下GNU hello world,你可以用它作为例子: https//www.gnu.org/software/hello/

You have to fix it line by line. 你必须逐行修复它。 First, Creates all new files required by Makefile.am .(This step you can also run 'automake --add-missing' so as to add missing file automatically) $ touch NEWS README AUTHORS ChangeLog Second, You have to run aclocal prior to automake. 首先,创建Makefile.am所需的所有新文件。(这一步你也可以运行'automake --add-missing'以便自动添加丢失的文件) $ touch NEWS README AUTHORS ChangeLog其次,你必须先运行aclocal automake的。 $ aclocal Finally ,You can run automake. $ aclocal最后,您可以运行automake。 $ automake

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

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