why automake fails to generate Makefile.in - makefile

Trying to use automake/autoconf (versions 1.10 and 2.61, respectively). Everything is working OK, except automake is not generating Makefile.in.
There are some warnings generated, but I don't think they're significant. However, the last line makes me think it's generating something it shouldn't and stopping there. There is a md5.cc and md5.c file in the project.
xanadu:fsd wwilliam$ automake --add-missing
configure.ac:46: warning: AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS
/var/tmp/autoconf/autoconf-15~193/SRC/autoconf/lib/autoconf/specific.m4:421: AC_USE_SYSTEM_EXTENSIONS is expanded from...
/var/tmp/autoconf/autoconf-15~193/SRC/autoconf/lib/autoconf/functions.m4:1677: AC_FUNC_STRNLEN is expanded from...
configure.ac:46: the top level
configure.ac:46: warning: AC_RUN_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS
configure.ac:46: warning: AC_COMPILE_IFELSE was called before AC_GNU_SOURCE
/var/tmp/autoconf/autoconf-15~193/SRC/autoconf/lib/autoconf/specific.m4:340: AC_GNU_SOURCE is expanded from...
configure.ac:46: warning: AC_RUN_IFELSE was called before AC_GNU_SOURCE
configure.ac:46: warning: AC_COMPILE_IFELSE was called before AC_AIX
/var/tmp/autoconf/autoconf-15~193/SRC/autoconf/lib/autoconf/specific.m4:455: AC_AIX is expanded from...
configure.ac:46: warning: AC_RUN_IFELSE was called before AC_AIX
configure.ac:46: warning: AC_COMPILE_IFELSE was called before AC_MINIX
/var/tmp/autoconf/autoconf-15~193/SRC/autoconf/lib/autoconf/specific.m4:474: AC_MINIX is expanded from...
configure.ac:46: warning: AC_RUN_IFELSE was called before AC_MINIX
Makefile.am: object `md5.$(OBJEXT)' created by `md5.cc' and `md5.c'
Relevant contents of configure.ac:
AC_INIT(testapp, 1.1, user#blah.com)
AM_INIT_AUTOMAKE(testapp,1.1)
AC_OUTPUT(Makefile)
Contents of Makefile.am:
AUTOMAKE_OPTIONS = foreign
CFLAGS=-O2
bin_PROGRAMS = testapp
testapp_SOURCES = interface.cc interface.hh keymgr.cc keymgr.hh main.cc manage.cc manage.hh md5.c md5.cc md5.h mm.cc mm.hh mysqldb.cc mysqldb.h testapp.cc testapp.h
I've been googling the issue but haven't found anything helpful.
Commands run were:
autoscan
mv configure.scan configure.ac
(edit configure.ac)
autoconf
(edit Makefile.am)
aclocal
automake --add-missing
Anyone seen anything like this before or know perhaps how I could turn on some additional debugging to troubleshoot the problem?

Makefile.am: object `md5.$(OBJEXT)' created by `md5.cc' and `md5.c'
is an error message that causes Automake to abort. These two files would have to be compiled to md5.o, so that is a problem.
Can you rename one of these two files?

I have one program that I configure with automake. That program has a script to do the setup, which consists of:
aclocal -I config &&
libtoolize --automake &&
autoheader &&
automake --foreign --add-missing &&
autoconf
The difference, as I see it, is that in this the autoconf step is last, not in the middle.

It complains on line 46, which you do not provide to your question.
Anyhow, to fix this issue you have to add AC_USE_SYSTEM_EXTENSIONS in your configure.ac.
example:
AC_INIT(testapp, 1.1, user#blah.com)
AM_INIT_AUTOMAKE(testapp,1.1)
AC_OUTPUT(Makefile)
AC_USE_SYSTEM_EXTENSIONS
AC_PROG_C
...

Related

Configure errors

Mac OS X
I do configure and then make my odbc binary.
That is configure command:
./configure CFLAGS="-arch i386 -arch x86_64 -D par1=1024" --enable-pthreads --with-iodbc=/usr/local/iODBC --with-libpq=$pg_dir
But the result is:
...
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
./configure: line 4506: syntax error near unexpected token `with,'
./configure: line 4506: `PGAC_ARG_REQ(with, odbcver,'
make: *** [config.status] Error 2
...
What is the reason and what to check and fix?
I run
autoconf
----------
autoconf
aclocal.m4:21: warning: this file was generated for autoconf 2.68.
You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically `autoreconf'.
configure.ac:331: warning: AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body
../../lib/autoconf/lang.m4:197: AC_LANG_CONFTEST is expanded from...
../../lib/autoconf/general.m4:2598: _AC_COMPILE_IFELSE is expanded from...
../../lib/autoconf/general.m4:2608: AC_COMPILE_IFELSE is expanded from...
configure.ac:331: the top level
configure.ac:331: warning: AC_LANG_CONFTEST: no AC_LANG_SOURCE call detected in body
../../lib/autoconf/lang.m4:197: AC_LANG_CONFTEST is expanded from...
../../lib/autoconf/general.m4:2598: _AC_COMPILE_IFELSE is expanded from...
../../lib/autoconf/general.m4:2608: AC_COMPILE_IFELSE is expanded from...
../../lib/m4sugar/m4sh.m4:643: AS_IF is expanded from...
../../lib/autoconf/general.m4:2598: _AC_COMPILE_IFELSE is expanded from...
../../lib/autoconf/general.m4:2608: AC_COMPILE_IFELSE is expanded from...
configure.ac:331: the top level
configure.ac:64: error: possibly undefined macro: AC_DEFINE
If this token and others are legitimate, please use m4_pattern_allow.
See the Autoconf documentation.
The one of reasons is: the macro PGAC_ARG_REQ and some other were undefined, I have found the *.m4, copied and it works.
Thanks l'L'l for the great help!

How to build mesos on Mavericks

I cloned from git:
git clone git://git.apache.org/mesos.git
and also had done
brew install autoconf automake libtool
Then trying to follow the "Getting started" at
http://mesos.apache.org/gettingstarted/
And specifically :
Only if running from source code cloned from git,
run ./bootstrap otherwise skip to step 3
So I ran
./bootstrap
Here is a trimmed output of the results. I did not see any ERRORS as such but plenty of WARNings. End result exited with 1 and no configure script was generated:
autoreconf: configure.ac: adding subdirectory 3rdparty/stout to autoreconf
autoreconf: Entering directory `3rdparty/stout'
autoreconf: configure.ac: not using Libtool
autoreconf: running: /usr/local/Cellar/autoconf/2.69/bin/autoconf --warnings=all
autoreconf: configure.ac: not using Autoheader
autoreconf: running: automake --add-missing --copy --no-force --warnings=all
configure.ac:10: installing './missing'
autoreconf: Leaving directory `3rdparty/stout'
autoreconf: running: glibtoolize --copy
glibtoolize: putting auxiliary files in `.'.
glibtoolize: copying file `./ltmain.sh'
..
glibtoolize: copying file `m4/ltversion.m4'
glibtoolize: copying file `m4/lt~obsolete.m4'
..
m4/libtool.m4:694: LT_OUTPUT is expanded from...
configure.ac:28: the top level
configure.ac:87: warning: The macro `AC_LANG_SAVE' is obsolete.
configure.ac:87: You should run autoupdate.
../../lib/autoconf/lang.m4:128: AC_LANG_SAVE is expanded from...
m4/acx_pthread.m4:363: ACX_PTHREAD is expanded from...
configure.ac:87: the top level
configure.ac:87: warning: The macro `AC_LANG_C' is obsolete.
configure.ac:87: You should run autoupdate.
../../lib/autoconf/c.m4:72: AC_LANG_C is expanded from...
m4/acx_pthread.m4:363: ACX_PTHREAD is expanded from...
configure.ac:87: the top level
configure.ac:87: warning: The macro `AC_TRY_LINK' is obsolete.
configure.ac:87: You should run autoupdate.
../../lib/autoconf/general.m4:2688: AC_TRY_LINK is expanded from...
m4/acx_pthread.m4:363: ACX_PTHREAD is expanded from...
configure.ac:87: the top level
configure.ac:87: warning: The macro `AC_LANG_RESTORE' is obsolete.
configure.ac:87: You should run autoupdate.
../../lib/autoconf/lang.m4:134: AC_LANG_RESTORE is expanded from...
m4/acx_pthread.m4:363: ACX_PTHREAD is expanded from...
configure.ac:87: the top level
configure.ac:21: installing './ar-lib'
configure.ac:21: installing './compile'
configure.ac:8: installing './config.guess'
configure.ac:8: installing './config.sub'
configure.ac:18: installing './missing'
automake: warnings are treated as errors
3rdparty/Makefile.am:71: warning: source file '$(GTEST)/src/gtest-all.cc' is in a subdirectory,
3rdparty/Makefile.am:71: but option 'subdir-objects' is disabled
automake: warning: possible forward-incompatibility.
automake: At least a source file is in a subdirectory, but the 'subdir-objects'
automake: automake option hasn't been enabled. For now, the corresponding output
automake: object file(s) will be placed in the top-level directory. However,
automake: this behaviour will change in future Automake versions: they will
automake: unconditionally cause object files to be placed in the same subdirectory
automake: of the corresponding sources.
automake: You are advised to start using 'subdir-objects' option throughout your
automake: project, to avoid future incompatibilities.
3rdparty/Makefile.am:71: warning: source file '$(GMOCK)/src/gmock-all.cc' is in a subdirectory,
3rdparty/Makefile.am:71: but option 'subdir-objects' is disabled
3rdparty/Makefile.am:61: warning: source file '$(RY_HTTP_PARSER)/http_parser.c' is in a subdirectory,
3rdparty/Makefile.am:61: but option 'subdir-objects' is disabled
3rdparty/Makefile.am:118: warning: source file '$(STOUT)/tests/bytes_tests.cpp' is in a subdirectory,
..
3rdparty/Makefile.am:118: but option 'subdir-objects' is disabled
3rdparty/Makefile.am:118: warning: source file '$(STOUT)/tests/flags_tests.cpp' is in a subdirectory,
3rdparty/Makefile.am:118: but option 'subdir-objects' is disabled
..
3rdparty/Makefile.am:146: warning: source file '$(STOUT)/tests/proc_tests.cpp' is in a subdirectory,
3rdparty/Makefile.am:146: but option 'subdir-objects' is disabled
3rdparty/Makefile.am: installing './depcomp'
Makefile.am:29: warning: source file 'src/latch.cpp' is in a subdirectory,
Makefile.am:29: but option 'subdir-objects' is disabled
Makefile.am:29: warning: source file 'src/pid.cpp' is in a subdirectory,
Makefile.am:29: but option 'subdir-objects' is disabled
Makefile.am:29: warning: source file 'src/process.cpp' is in a subdirectory,
Makefile.am:29: but option 'subdir-objects' is disabled
Makefile.am:29: warning: source file 'src/statistics.cpp' is in a subdirectory,
Makefile.am:29: but option 'subdir-objects' is disabled
..
Makefile.am:101: warning: source file 'src/tests/shared_tests.cpp' is in a subdirectory,
Makefile.am:101: but option 'subdir-objects' is disabled
Makefile.am:101: warning: source file 'src/tests/statistics_tests.cpp' is in a subdirectory,
Makefile.am:101: but option 'subdir-objects' is disabled
Makefile.am:101: warning: source file 'src/tests/time_tests.cpp' is in a subdirectory,
Makefile.am:101: but option 'subdir-objects' is disabled
autoreconf: automake failed with exit status: 1
The Mesos team updated the "Getting Started" document with instructions on building and running Mesos on Mavericks.
GCC was replaced with Clang on Mavericks, and so you first have to install GCC 4.7+. You can use Homebrew to install it (Note: installing GCC takes a loooong time):
brew tap homebrew/versions
brew install gcc48
This is the gist of getting started on Mavericks:
# Make sure you have the right versions of automake and GCC.
# For example:
$ automake --version
automake (GNU automake) 1.12.6
...
$ aclocal --version
aclocal (GNU automake) 1.12.6
...
$ gcc-4.8 --version
gcc-4.8 (GCC) 4.8.1
...
# Follow bootstrap steps above.
# Configure and build.
$ mkdir build
$ cd build
# The prepending CC and CXX will select custom compilers to build Mesos with.
$ CC=gcc-4.8 CXX=g++-4.8 ../configure

Not able to enable C++11 using autoconf

I am trying to enable c++11 for gcc 4.6; I am using autconf and I added following to my configure.ac file
AC_PREREQ(2.61)
AC_INIT(SOLARCORE, 1.0.0, BUG-REPORT-ADDRESS)
AM_INIT_AUTOMAKE([1.10 no-define foreign])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([src/threading/node.h])
AC_CONFIG_HEADER([config.h])
AC_OUTPUT([Makefile src/threading/Makefile])
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
#AC_LANG_PUSH([C++])
AC_LANG([C++])
AC_GNU_SOURCE
AX_CXX_COMPILE_STDCXX_11(,[mandatory])
CXXFLAGS='-Wall -std=gnu++0x'
AC_TYPE_SIZE_T
AC_OUTPUT
I am getting following error
./configure: line 4949: syntax error near unexpected token ,mandatory'
./configure: line 4949:AX_CXX_COMPILE_STDCXX_11(,mandatory)'
I also tried AX_CXX_COMPILE_STDCXX_11([ext],[mandatory])
I want to enable C++11 so that I can use it. I tried without AX_CXX_COMPILE_STDCXX_11 and with just CXXFLAGS in my Makefile but it is not working. So please help. THanks.
Found the answer: Recent version of AX_CXX_COMPILE_STDCXX_11 doesnt need a argument.
Are you sure you have the latest version of the macro? Judging from the history available from the autoconf archive, the original version of the macro only expected one argument, not two. If you've not got the second or third revisions of the test, that might account for your trouble.

Autoreconf better way to find Boost::Date-time

I am trying to compile some code using autotools and am getting stuck when trying to include boost::date-time and boost::regex. I was given an configure.in file that defines that looks for boost::date-time this way
AC_CHECK_LIB(boost_date_time-gcc-mt, main, , [
AC_CHECK_LIB(boost_date_time-mt, main, , [
AC_CHECK_LIB(boost_date_time, main, , [
AC_MSG_ERROR("Linking against boost::date-time library failed.")])
])
])
which appears to be the standard way according to google. But when I run autoreconf:
$ autoreconf -f -s -i
libtoolize: putting auxiliary files in `.'.
libtoolize: linking file `./ltmain.sh'
libtoolize: Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.in and
libtoolize: rerunning libtoolize, to keep the correct libtool macros in-tree.
libtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
and ./configure:
$ CXXFLAGS="-g -w" ./configure --prefix=$INSTALL_PATH
...
checking for main in -lboost_date_time-gcc-mt... no
checking for main in -lboost_date_time-mt... no
checking for main in -lboost_date_time... no
configure: error: "Linking against boost::date-time library failed."
It cannot be found. I know they are there cause I compiled boost 1.53 from scratch. What could be an issue here?
Thanks a lot in advance.
There's an excellent boost.m4 macro. You can copy it into a top level ./m4 directory.
AC_CONFIG_MACRO_DIR([m4]) in configure.ac
ACLOCAL_AMFLAGS = -I m4 --install in the top-level Makefile.am
invoke aclocal with aclocal -I m4 --install
It's very easy to use the results in configure.ac, e.g., for Boost.Filesystem:
BOOST_REQUIRE([1.53], [ACTION-IF-NOT-FOUND])
AC_SUBST(BOOST_CPPFLAGS)
MY_PROJECT_CPPFLAGS+="$BOOST_CPPFLAGS"
BOOST_FILESYSTEM([mt])
AC_SUBST(BOOST_FILESYSTEM_LIBS)
AC_SUBST(BOOST_FILESYSTEM_LDFLAGS)
MY_PROJECT_LIBFLAGS+="$BOOST_FILESYSTEM_LDFLAGS $BOOST_FILESYSTEM_LIBS"
It will even add dependencies like Boost.System.
There are macros at the GNU Autoconf Archive for both boost::date-time and boost::regex. Perhaps they would be more suitable.
It cannot be found. I know they are there cause I compiled boost 1.53 from scratch. What could be an issue here?
You'll have to consult config.log to know that for sure. Since you are looking for the main functions in those libs (which aren't in those libs, but that's another issue), the AC_CHECK_LIB tests generate invalid C++ code, and that may be your problem.

gcc to use newlib instead of glibc?

I want to use newlib instead of glibc in order to compile small static binaries. (I do not intend to cross-compile as the binaries are to be used by the same computer.) I believe that I need to compile a separate gcc for this ?
I compiled gcc:
./configure --prefix=/home/myuser/Desktop/gcc-4.4.5 --libexecdir=/home/myuser/Desktop/gcc-4.4.5 --libdir=/home/myuser/Desktop/gcc-4.4.5 --with-gxx-include-dir=/home/myuser/Desktop/gcc-4.4.5 --enable-languages=c --enable-libmudflap --disable-multilib --disable-libssp --disable-nls --with-newlib --with-gnu-as --with-gnu-ld --with-system-zlib
make
It compiled without errors but now when I try to compile a simple Hello World! program it wants to use headers from /usr instead of the path I specified above. These are some of the errors:
In file included from /home/myprogram/Desktop/myprogram.c:1:
/usr/include/stdio.h:34:21: error: stddef.h: No such file or directory
In file included from /usr/include/stdio.h:75,
from /home/myprogram/Desktop/myprogram.c:1:
/usr/include/libio.h:53:21: error: stdarg.h: No such file or directory
In file included from /usr/include/stdio.h:75,
from /home/myprogram/Desktop/myprogram.c:1:
/usr/include/libio.h:332: error: expected specifier-qualifier-list before 'size_t'
/usr/include/libio.h:364: error: expected declaration specifiers or '...' before 'size_t'
/usr/include/libio.h:373: error: expected declaration specifiers or '...' before 'size_t'
What am I doing wrong ? Is compiling a new gcc necessary or can I use my existing gcc and use newlib instead of glibc ???
You shouldn't need to rebuild gcc for this; you just need to point your existing gcc at the right things (using -I, -L etc.) and tell it not pull in the usual system stuff (using -nostdlib).
The section entitled "Shared newlib" in the newlib README file has runes for building and linking against either shared or static newlib when compiled natively.
I would strongly recommend using crosstool-ng to build your GCC toolchain. If you choose x86 followed by "bare metal" as the operating system, you can safely use newlib as a libc.
Note that newlib does not work with an operating system - that is standard things, like IO, won't work out of the box.
You have to tell the compiler where it can find the include files:
gcc -IyourDirectoryHere -IanotherDirectoryHere
-I
(that is a minus followed by a capital i as in Italy)
More details: http://gcc.gnu.org/onlinedocs/gcc-3.2.3/gcc/Directory-Options.html

Resources