EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: building ioc library - multiple inclusion of Main?
From: "Johnson, Andrew N. via Tech-talk" <tech-talk at aps.anl.gov>
To: "David A. Slimmer" <slimmer at fnal.gov>
Cc: EPICS tech-talk <tech-talk at aps.anl.gov>
Date: Mon, 10 Aug 2020 19:52:14 +0000
Hi David,

On Aug 10, 2020, at 2:00 PM, David A. Slimmer via Tech-talk <tech-talk at aps.anl.gov> wrote:

I’ve been trying to track down the reason for multiple inclusions of the xxxMain.o when I build a library.
The output of the build looks like this:
 
/usr/bin/ar -rc    libaaitest.a      devAaiIQM.o aaitest_registerRecordDeviceDriver.o aaitestMain.o aaitestMain.o
 
Where aaitestMain.o appears twice, and causes a “multiple definition of ‘main’ “ problem.
 
Here is my App/src/Makefile:

So here you’re asking it to build a library called aaitest:

# Build an IOC support library
 
LIBRARY_IOC += aaitest

And here are the source files that should make up that library:

aaitest_SRCS += devAaiIQM.cpp

Then here you’re asking it to build a binary, also called aaitest:

# Build the IOC application
 
PROD_IOC = aaitest

And here are the source files to be included in that binary:

aaitest_SRCS += aaitest_registerRecordDeviceDriver.cpp

aaitest_SRCS_DEFAULT += aaitestMain.cpp
aaitest_SRCS_vxWorks += -nil-

The last 2 are just ways of telling the build system to include your Main.cpp program but only when not building for VxWorks. However they are equivalent to something like this:

ifneq ($(OS_CLASS),vxWorks)
  aaitest_SRCS += aaitestMain.cpp
endif

Any ideas would be appreciated –

You need to rename either your library or your IOC binary, since both of them use the same aaitest_SRCS variable to tell the build what source files to compile for the target object.

HTH,

- Andrew

-- 
Complexity comes for free, simplicity you have to work for.


References:
building ioc library - multiple inclusion of Main? David A. Slimmer via Tech-talk

Navigate by Date:
Prev: EPICS Training for a noob? Fleming, Steven via Tech-talk
Next: Re: EPICS Training for a noob? Kyle Hesse via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
Navigate by Thread:
Prev: building ioc library - multiple inclusion of Main? David A. Slimmer via Tech-talk
Next: EPICS Training for a noob? Fleming, Steven via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  <20202021  2022  2023  2024 
ANJ, 10 Aug 2020 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·