[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
help, automake generated a buggy Makefile?
From: |
Steven Woody |
Subject: |
help, automake generated a buggy Makefile? |
Date: |
Sun, 14 Oct 2007 11:51:45 +0800 |
hi,
i wrote a simple sample program as well as a cpp-unit test, and then
use automake in both cygwin and linux to generate `configure' and
Makefile.in. it works well in these platforms, but has problem when
do configure/make in MinGW's MSYS. It seems the Makeifle generated
from `./configure' script is not fully correct for MinGW's MSYS though
is okay for cygwin and Linux. i guess what makes differ is that in
MinGW the executable should have .exe as extension name. below are full
story.
i started from a very simple Makefile.am
TESTS = AllTests
check_PROGRAMS = $(TESTS)
AllTests_SOURCES = \
AllTests.cpp
CXXFLAGS = `cppunit-config --cflags` -Wall
LIBS = `cppunit-config --libs`
and a simple configure.ac,
AC_INIT( [ motconv ], [ 0.1 ], [ address@hidden ] )
AM_INIT_AUTOMAKE( [ -Wall -Werror foreign ] )
AC_PROG_RANLIB
AC_PROG_CXX
AC_PROG_INSTALL
AC_LANG_PUSH([C++])
AC_CHECK_HEADERS([limits])
AC_LANG_POP
AC_CONFIG_HEADER( configure.h )
AC_CONFIG_FILES( [ Makefile test/Makefile ])
AC_OUTPUT
i did 'autoreconf -i' in Linux and let it produce a `configure' script.
then what i did is to run the `configure' script under the MinGW's
shell prompt, after that i do `make check', but got following outputs,
Making check in test
make[1]: Entering directory `d:/motconv/test'
c:/MinGW/bin/make AllTests.exe
make[2]: Entering directory `d:/motconv/test'
if g++ -DHAVE_CONFIG_H -I. -I. -I.. `cppunit-config --cflags`
-Wall -MT AllTests.o -MD -MP -MF ".deps/AllTests.Tpo" -c -o
AllTests.o AllTests.cpp; \
then mv -f ".deps/AllTests.Tpo" ".deps/AllTests.Po"; else rm
-f ".deps/AllTests.Tpo"; exit 1; fi
g++ `cppunit-config --cflags` -Wall -o AllTests.exe
AllTests.o `cppunit-config --libs`
make[2]: Leaving directory `d:/motconv/test'
c:/MinGW/bin/make check-TESTS
make[2]: Entering directory `d:/motconv/test'
g++ `cppunit-config --cflags` -Wall AllTests.cpp -o AllTests
d:/_tmp/ccA7baaa.o:AllTests.cpp:(.text+0x181): undefined reference
to `CppUnit::TextTestRunner::TextTestRunner(CppUnit::Outputter*)'
d:/_tmp/ccA7baaa.o:AllTests.cpp:(.text+0x1c5): undefined reference
to `CppUnit::TestFactoryRegistry::getRegistry(std::string const&)'
d:/_tmp/ccA7baaa.o:AllTests.cpp:(.text+0x26e): undefined reference
to `CppUnit::TestRunner::addTest(CppUnit::Test*)'
d:/_tmp/ccA7baaa.o:AllTests.cpp:(.text+0x279): undefined reference
to `CppUnit::TextTestRunner::result() const'
d:/_tmp/ccA7baaa.o:AllTests.cpp:(.text+0x307): undefined reference
to `CppUnit::CompilerOutputter::CompilerOutputter(CppUnit::TestResultCollector*,
std::ostream&, std::string const&)'
d:/_tmp/ccA7baaa.o:AllTests.cpp:(.text+0x350): undefined reference
to `CppUnit::TextTestRunner::setOutputter(CppUnit::Outputter*)'
d:/_tmp/ccA7baaa.o:AllTests.cpp:(.text+0x42e): undefined reference
to `CppUnit::TextTestRunner::run(std::string, bool, bool, bool)'
d:/_tmp/ccA7baaa.o:AllTests.cpp:(.text+0x47d): undefined reference
to `CppUnit::TextTestRunner::~TextTestRunner()'
d:/_tmp/ccA7baaa.o:AllTests.cpp:(.text+0x56d): undefined reference
to `CppUnit::TextTestRunner::~TextTestRunner()'
collect2: ld returned 1 exit status
make[2]: *** [AllTests] Error 1
make[2]: Leaving directory `d:/motconv/test'
make[1]: *** [check-am] Error 2
make[1]: Leaving directory `d:/motconv/test'
make: *** [check-recursive] Error 1
the problem is in line,
g++ `cppunit-config --cflags` -Wall AllTests.cpp -o AllTests
it forgot to append `cppunit-config --libs' which is what i assigment
to the LIBS variable. and, i believe it actually should not do any compile
or link when do `make check-TESTS' because the AllTests.exe has already
generated, i guess the Makefile try to find AllTests but dont know that
AllTests.exe is actually AllTests. On another hand, you might noticed
that the Makefile can generate AllTests.exe correctly when it do seperated
compile/link stages:
c:/MinGW/bin/make AllTests.exe
make[2]: Entering directory `d:/motconv/test'
if g++ -DHAVE_CONFIG_H -I. -I. -I.. `cppunit-config --cflags`
-Wall -MT AllTests.o -MD -MP -MF ".deps/AllTests.Tpo" -c -o
AllTests.o AllTests.cpp; \
then mv -f ".deps/AllTests.Tpo" ".deps/AllTests.Po"; else rm
-f ".deps/AllTests.Tpo"; exit 1; fi
g++ `cppunit-config --cflags` -Wall -o AllTests.exe
AllTests.o `cppunit-config --libs`
i hope you experts get know what i mean. thanks in advance!
** my automake version is 1.10 **
--
woody
then sun rose thinly from the sea and the old man could see the other
boats, low on the water and well in toward the shore, spread out
across the current.
- help, automake generated a buggy Makefile?,
Steven Woody <=
- Re: help, automake generated a buggy Makefile?, Ralf Wildenhues, 2007/10/15
- Re: help, automake generated a buggy Makefile?, Steven Woody, 2007/10/15
- Re: help, automake generated a buggy Makefile?, Ralf Wildenhues, 2007/10/15
- Re: help, automake generated a buggy Makefile?, Steven Woody, 2007/10/15
- Re: help, automake generated a buggy Makefile?, Steven Woody, 2007/10/15
- Re: help, automake generated a buggy Makefile?, Ralf Wildenhues, 2007/10/15
- Re: help, automake generated a buggy Makefile?, Steven Woody, 2007/10/15