Hi everyone,
Right now I'm trying to get my Autotools build to work with non-recursive automake, but I'm not having much luck.
Here's the error I'm getting:
Code:
jarrett@jarrett-Latitude-D520:~/Projects/WeightManager/build$ make
make all-am
make[1]: Entering directory `/home/jarrett/Projects/WeightManager/build'
depbase=`echo src/view/WMWindow.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
g++ -DHAVE_CONFIG_H -I. -I.. `wx-config --cxxflags` -g -O2 -g -O2 -MT src/view/WMWindow.o -MD -MP -MF $depbase.Tpo -c -o src/view/WMWindow.o ../src/view/WMWindow.cpp &&\
mv -f $depbase.Tpo $depbase.Po
g++ -g -O2 -g -O2 -o WeightManager src/view/WMWindow.o `wx-config --libs`
/usr/lib/gcc/i686-linux-gnu/4.6.1/../../../i386-linux-gnu/crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
collect2: ld returned 1 exit status
make[1]: *** [WeightManager] Error 1
make[1]: Leaving directory `/home/jarrett/Projects/WeightManager/build'
make: *** [all] Error 2
quick note: the `wx-config --libs` returns the library path and library names required for the linking process using the wxWidgets project...Similarly, `wx-config --cxxflags` returns the include paths needed for compiling the project using the wxWidgets project.
It looks like it's going into the 'src/view/' directory and trying to compile and link whatever is in there as if that is all of the source files for the project. However, there are other source files that need to be compiled, and the 'main' method is defined in 'src/WMMain.h'.
My directory structure looks like this:
.../WeightManager
Makefile.am
configure.ac
autogen.sh
.../WeightManager/src
Common.h
WMMain.h <-- contains the 'main' function
.../WeightManager/src/view
WMWindow.h
WMWindow.cpp
.../WeightManager/src/model
<empty>
.../WeightManager/src/controller
<empty>
Right now, I create a 'build' directory within the WeightManager directory, cd into it, run
../configure and then
make.
I had this working with a basic build (i.e. only WMMain.h), but adding the extra 'view' directory has caused problems.
Here's what my Makefile.am looks like:
Code:
# Tell automake to put the object files in the appropriate directories
AUTOMAKE_OPTIONS = subdir-objects
ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS}
WX_LIBS = `wx-config --libs`
WX_CPPFLAGS = `wx-config --cxxflags`
AM_CPPFLAGS = $(WX_CPPFLAGS)
LIBS = $(WX_LIBS)
bin_PROGRAMS = WeightManager
WeightManager_SOURCES = \
src/WMMain.h \
src/Common.h \
src/view/WMWindow.h src/view/WMWindow.cpp
dist_noinst_SCRIPTS = autogen.sh
And here's my configure.ac:
Code:
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.67])
AC_INIT([WeightManager],[0.1],[support@jarrettchisholm.com],[WeightManager],[http://www.weightmanager.jarrettchisholm.com/])
AC_CONFIG_AUX_DIR(config)
AC_CANONICAL_HOST
AM_INIT_AUTOMAKE([subdir-objects])
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
# Checks for libraries.
# Checks for header files.
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
# Checks for library functions.
# Check platform
case "$host" in
*-*-mingw*|*-*-cygwin*)
AC_DEFINE(PLATFORM_WIN32, 1, [Platform is Win32])
#opengl_LIBS="-lunsupported_platform"
PLATFORM_STRING="Win32"
;;
*-*-linux*)
AC_DEFINE(PLATFORM_LINUX, 1, [Platform is Linux])
#opengl_LIBS="-lGL -lGLU -lglut"
PLATFORM_STRING="Linux"
;;
*-*-darwin*)
AC_DEFINE(PLATFORM_APPLE, 1, [Platform is Apple])
#opengl_LIBS="-framework AGL -framework OpenGL -framework GLUT"
PLATFORM_STRING="Apple"
;;
*)
AC_MSG_WARN([*** Please add $host to configure.ac checks!])
;;
esac
#AC_SUBST(opengl_LIBS)
# Check architecture
case "$host" in
i?86-* | k?-* | athlon-* | pentium*-)
AC_DEFINE(ARCH_X86, 1, [Architecture is x86])
ARCH_SPECIFIC_CFLAGS=""
ARCH_STRING="X86"
;;
x86_64-*)
AC_DEFINE(ARCH_X86_64, 1, [Architecture is x86-64])
ARCH_SPECIFIC_CFLAGS="-DUSE_ADDR64"
ARCH_STRING="X86-64"
;;
ppc-* | powerpc-*)
AC_DEFINE(ARCH_PPC, 1, [Architecture is PowerPC])
ARCH_SPECIFIC_CFLAGS=""
ARCH_STRING="PowerPC"
;;
*)
AC_MSG_ERROR([Unknown Architecture])
;;
esac
AC_C_BIGENDIAN
# Setup configuration header
AC_CONFIG_SRCDIR([config.h.in])
AC_CONFIG_HEADERS([config.h])
# Configuration switches
# HACK - For some reason, wxwin.m4 wasn't installed properly when I installed
# wxWidgets-2.8.12. Therefore, I need to include this file manually to
# ensure that the wx specific m4 macros used below are defined.
m4_include(wxwin.m4)
# Check wxWidgets 2.8.x is installed
AM_OPTIONS_WXCONFIG
reqwx=2.8.0
AM_PATH_WXCONFIG($reqwx, wxWin=1)
if test "$wxWin" != 1; then
AC_MSG_ERROR([
wxWidgets must be installed on your system.
Please check that wx-config is in path, the directory
where wxWidgets libraries are installed (returned by
'wx-config --libs' or 'wx-config --static --libs' command)
is in LD_LIBRARY_PATH or equivalent variable and
wxWidgets version is $reqwx or above.
])
fi
# Check the build mode
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug],[build with debugging information (default NO)])],
[], [enable_debug=no])
AC_MSG_CHECKING([build mode])
AS_IF([test $enable_debug = yes], [build_mode=debug], [build_mode=optimize])
AC_MSG_RESULT([$build_mode])
# Set the compiler/linker flags
CXXFLAGS="$ARCH_SPECIFIC_CFLAGS $CXXFLAGS $CFLAGS"
CFLAGS="$ARCH_SPECIFIC_CFLAGS $CFLAGS"
CPPFLAGS="$ARCH_SPECIFIC_CFLAGS $CPPFLAGS"
# Create generated files
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
AC_MSG_NOTICE([
Please type 'make' to build WeightManager
])
Does anyone have any idea why I'm getting the error I'm getting?
I'm at a complete loss.
I appreciate any help you guys and gals can provide!
Thanks
Jarrett