|
|
Linking Problem With Autoconf / Automake
I have recently converted my C++ project to use Autoconf / Automake and have
hit a strange problem.
The program will only link if I include one particular library four times in
the myprog_LDADD statement in the Makefile.am in my top level directory. If
I remove the last occurrence, I get undefined symbols.
I was aware that it is sometimes necessary to repeat libraries in the list
of libraries, but I thought it would be sufficient for each library to
occur twice.
Can anyone help? What is happenong?
I have included my Makefile.am below. I have highlighted the offending
library with ****
I'm fairly new to Autoconf / Automake, so I may well be doing something
completely wrong!
Chris Gordon-Smith
www.simsoup.info
=======================================
SUBDIRS = Utilities Kernel User_Interface_Presentation
User_Interface_Manager \
Statistics Persistent_Data_Manager Global_Include
METASOURCES = AUTO
bin_PROGRAMS = simsoup
simsoup_SOURCES = main.cpp
noinst_HEADERS =
AM_CPPFLAGS = -I./Global_Include \
-I./Utilities \
-I./Utilities/Logger \
-I./User_Interface_Presentation/SimSoup_GUI/API \
-I./User_Interface_Manager/Form_Manager \
-I./User_Interface_Manager/Form_Manager/User_Actions_API \
-I./Kernel/Kernel_Manager \
-I./Statistics \
-I./Persistent_Data_Manager
simsoup_LDADD = ./Kernel/Kernel_Manager/libKernel_Manager.a
\
./Kernel/Kernel_API/libKernel_API.a
\
./Kernel/Reactor/libReactor.a
\
./Kernel/Simulation/libSimulation.a
\
./Kernel/Simulation/Action_Request/libAction_Request.a
\
./Kernel/Simulation/ActReq_Rqstr/libActReq_Rqstr.a
\
./Kernel/Simulation/Attribute/libAttribute.a
\
./Kernel/Tracker/libTracker.a
\
./User_Interface_Manager/Form_Manager/libForm_Manager.a
\
./User_Interface_Manager/Network_Painter/libNetwork_Painter.a
\
./User_Interface_Presentation/GUI_Tools/libGUI_Tools.a
\
./User_Interface_Presentation/SimSoup_GUI/libSimSoup_GUI.a
\
./Utilities/libUtilities.a
\
./Utilities/List/libList.a
\
./Utilities/Logger/libLogger.a
\
./Statistics/libStatistics.a
\
./Persistent_Data_Manager/libPersistent_Data_Manager.a
\
./Kernel/Chemistry/libChemistry.a
\
\
./Kernel/Kernel_Manager/libKernel_Manager.a
\
./Kernel/Kernel_API/libKernel_API.a
\
./Kernel/Reactor/libReactor.a
\
./Kernel/Simulation/libSimulation.a
\
./Kernel/Simulation/Action_Request/libAction_Request.a
\
./Kernel/Simulation/ActReq_Rqstr/libActReq_Rqstr.a
\
./Kernel/Simulation/Attribute/libAttribute.a
\
./Kernel/Tracker/libTracker.a
\
./User_Interface_Manager/Form_Manager/libForm_Manager.a
\
./User_Interface_Manager/Network_Painter/libNetwork_Painter.a
\
./User_Interface_Presentation/GUI_Tools/libGUI_Tools.a
\
./User_Interface_Presentation/SimSoup_GUI/libSimSoup_GUI.a
\
./Utilities/libUtilities.a
\
./Utilities/List/libList.a
\
./Utilities/Logger/libLogger.a
\
./Statistics/libStatistics.a
\
./Persistent_Data_Manager/libPersistent_Data_Manager.a
\
./Kernel/Chemistry/libChemistry.a
\
./Kernel/Chemistry/libChemistry.a
\
./Kernel/Chemistry/libChemistry.a // ****FAILS TO
LINK IF THIS IS REMOVED
simsoup_LDFLAGS = -L./Kernel/Chemistry \
-L./Kernel/Kernel_Manager \
-L./Kernel/Kernel_API \
-L./Kernel/Reactor \
-L./Kernel/Simulation \
-L./Kernel/Simulation/Action_Request \
-L./Kernel/Simulation/ActReq_Rqstr \
-L./Kernel/Simulation/Attribute \
-L./Kernel/Tracker \
-L./User_Interface_Manager/Form_Manager \
-L./User_Interface_Manager/Network_Painter \
-L./User_Interface_Presentation/GUI_Tools \
-L./User_Interface_Presentation/SimSoup_GUI \
-L./Utilities \
-L./Utilities/List \
-L./Utilities/Logger \
-L./Statistics \
-L./Persistent_Data_Manager \
-L/usr/lib \
-L/lib \
-L/usr/local/lib \
\
`pkg-config gtkmm-2.4 --libs` \
`pkg-config gsl --libs`
=====================
|
|
0
|
|
|
|
Reply
|
use.address (75)
|
9/13/2008 4:37:53 PM |
|
Chris Gordon-Smith wrote:
> I have recently converted my C++ project to use Autoconf / Automake and
> have hit a strange problem.
>
> The program will only link if I include one particular library four times
> in the myprog_LDADD statement in the Makefile.am in my top level
> directory. If I remove the last occurrence, I get undefined symbols.
>
> I was aware that it is sometimes necessary to repeat libraries in the list
> of libraries, but I thought it would be sufficient for each library to
> occur twice.
>
> Can anyone help? What is happenong?
>
> I have included my Makefile.am below. I have highlighted the offending
> library with ****
>
> I'm fairly new to Autoconf / Automake, so I may well be doing something
> completely wrong!
>
> Chris Gordon-Smith
> www.simsoup.info
>
Problem now fixed. It seems to have been something my IDE was doing to the
build files, rather than a 'real' problem. Invoking the build from the
command line works fine.
Apologies for any inconvenience.
Chris Gordon-Smith
www.simsoup.info
|
|
0
|
|
|
|
Reply
|
use.address (75)
|
9/13/2008 4:58:21 PM
|
|
On 13 Sep, 17:58, Chris Gordon-Smith <use.addr...@my.homepage> wrote:
> Chris Gordon-Smith wrote:
> > I have recently converted my C++ project to use Autoconf / Automake and
> > have hit a strange problem.
>
> Problem now fixed. It seems to have been something my IDE was doing to the
> build files, rather than a 'real' problem. Invoking the build from the
> command line works fine.
One more data point to convince me that most IDE's are
more trouble than they are worth.
One point: in your Makefile.am, you have:
AM_CPPFLAGS = -I./Global_Include
\
-I./Utilities
\
<snip>
It is probably better to use:
-I$(srcdir)/Global_include
since using '.' makes a VPATH build impossible.
(ie, you must run configure from the top srcdir, and
won't be able to do:
mkdir build && cd build && ../srcdir/configure
which is a really convenient feature that people
expect to work.)
|
|
0
|
|
|
|
Reply
|
bill.pursell (771)
|
9/14/2008 6:51:20 AM
|
|
William Pursell wrote:
> On 13 Sep, 17:58, Chris Gordon-Smith <use.addr...@my.homepage> wrote:
>> Chris Gordon-Smith wrote:
>
>> > I have recently converted my C++ project to use Autoconf / Automake and
>> > have hit a strange problem.
>>
>> Problem now fixed. It seems to have been something my IDE was doing to
>> the build files, rather than a 'real' problem. Invoking the build from
>> the command line works fine.
>
> One more data point to convince me that most IDE's are
> more trouble than they are worth.
>
> One point: in your Makefile.am, you have:
> AM_CPPFLAGS = -I./Global_Include
> \
> -I./Utilities
> \
> <snip>
>
> It is probably better to use:
> -I$(srcdir)/Global_include
>
> since using '.' makes a VPATH build impossible.
> (ie, you must run configure from the top srcdir, and
> won't be able to do:
> mkdir build && cd build && ../srcdir/configure
> which is a really convenient feature that people
> expect to work.)
Thanks. I'll adopt $(srcdir) as you suggest throughout.
Regarding IDEs, my view is that a very good code explorer is essential,
along with a facility that can navigate in one key press / button click to
a line of code referenced in a complier / linker message.
With a lot of tweaking, I managed to get a usable code explorer setup with
Emacs, using Emacs Code Browser(ECB). Eventually however I concluded that
it was not as effective as the KDevelop code browser, mainly because it
presents a less integrated view and in some cases behaves unpredictably.
Apart from this, I prefer to take control of what is going on in a number of
aress. This applies particularly to the build. KDevelop does a good job of
producing a set of Makefiles without the programmer needing to know
anything about Make, Autoconf or Automake. However, I was only able to
create a source distribution when I began to understand what was actually
happening, and I don't let my IDE change the build files (except by mistake
as above).
Chris Gordon-Smith
www.simsoup.info
|
|
0
|
|
|
|
Reply
|
use.address (75)
|
9/14/2008 8:20:31 AM
|
|
|
3 Replies
39 Views
(page loaded in 0.055 seconds)
|
|
|
|
|
|
|
|
|