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  2020  2021  <20222023  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  2020  2021  <20222023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Db/Makefile infinite loop
From: Simon Rose via Tech-talk <tech-talk at aps.anl.gov>
To: "Pearson, Matthew" <pearsonmr at ornl.gov>, "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
Date: Wed, 19 Oct 2022 12:33:25 +0000

Hello Matthew –

 

I have tried to run your code and I do not get the infinite loop, but I find instead the expected output.  Can you please push the exact failing “epics module” online somewhere in order to test it out?

 

Cheers,

 

Simon

 

From: Tech-talk <tech-talk-bounces at aps.anl.gov> on behalf of "Pearson, Matthew via Tech-talk" <tech-talk at aps.anl.gov>
Reply to: "Pearson, Matthew" <pearsonmr at ornl.gov>
Date: Tuesday, 18 October 2022 at 20:28
To: "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
Subject: Db/Makefile infinite loop

 

Hi,

 

One of our support modules that built fine with base 3.14 is failing with base 7.0.7 (and base 3.15.9). This seems to be because the Db/Makefile has additional rules that define targets that already exist, in order to trigger a script to generate database templates before MSI is executed.

 

For example, if we have a database template file called “example.template”, and we want to build an “example.db”, and “example.template” is:

 

# Some database logic

include "example.generated"

 

And “example.generated” is only built at build time via a script. The script needs to run before MSI is run.

 

I’ve reproduced the problem with this simplified Db/Makefile:

 

TOP=../..

include $(TOP)/configure/CONFIG

 

DB += example.db

 

include $(TOP)/configure/RULES

 

example.template: example.generated

 

example.generated:

              echo "some text" > example.generated

 

 

So, the “example.template” target is defined, presumably as a trick to ensure that the script is run before MSI tries to build “example.db”. But “example.template” already exists in the Db directory.

 

With based 3.14 I get this output:

 

perl /home/controls/common/base/base-3.14.12.8/bin/linux-x86_64/makeMakefile.pl O.linux-x86_64 ../../..

mkdir O.Common

make -C O.linux-x86_64 -f ../Makefile TOP=../../.. \

    T_A=linux-x86_64 install

make[1]: Entering directory '/home/controls/inst/st99/st99-example/main/st99-exampleApp/Db/O.linux-x86_64'

echo "some text" > example.generated

#cp ../example.template .

Inflating database from example.template

msi    -I. -I.. -I../O.Common -I../../../db -I/home/controls/common/base/base-3.14.12.8/db example.template > example.tmp

mv example.tmp ../O.Common/example.db

Installing created db file ../../../db/example.db

make[1]: Leaving directory '/home/controls/inst/st99/st99-example/main/st99-exampleApp/Db/O.linux-x86_64'

 

which works fine.

 

However, with base 7.0.7 and 3.15.9 I get:

 

perl -CSD /home/controls/common/base/base-3.15.9/bin/linux-x86_64/makeMakefile.pl O.linux-x86_64 ../../..

mkdir O.Common

make -C O.linux-x86_64 -f ../Makefile TOP=../../.. \

    T_A=linux-x86_64 install

make[1]: Entering directory '/home/controls/inst/st99/st99-example/main/st99-exampleApp/Db/O.linux-x86_64'

echo "some text" > example.generated

#cp ../example.template .

/home/controls/common/base/base-3.15.9/bin/linux-x86_64/msi -D    -I. -I.. -I../O.Common -I../../../db -I/home/controls/common/base/base-3.15.9/db -o ../O.Common/example.db example.template > example.db.d

/home/controls/common/base/base-3.15.9/bin/linux-x86_64/msi -D    -I. -I.. -I../O.Common -I../../../db -I/home/controls/common/base/base-3.15.9/db -o ../O.Common/example.db example.template > example.db.d

/home/controls/common/base/base-3.15.9/bin/linux-x86_64/msi -D    -I. -I.. -I../O.Common -I../../../db -I/home/controls/common/base/base-3.15.9/db -o ../O.Common/example.db example.template > example.db.d

 

and it’s an infinite loop.

 

I believe this is because we have a Makefile target with the same name as the database template file, and the timestamp on that file never changes (because the Makefile rule is not touching the template file, only generating a different file). So this logic may be suspect from the start. Is there a better way to do this? Specially, how to run a script in the Db/Makefile before MSI without resorting to the above trick?

 

I have a workaround, which works for all base versions, which is to make a new copy of the template file so that Make is happy:

 

example.generated:

              echo "some text" > example.generated

              cp ../example.template .

 

 

However, why did it work for 3.14 and not 3.15+? Is it because the db.d format changed and it now references “example.template” whereas before it didn’t? For base 3.14 the O.linux-x86_64/example.db.d file is:

 

# DO NOT EDIT: This file created by mkmf.pl,v 1.5 2002/03/25 21:33:24 jba Exp $

 

../O.Common/example.db : example.generated

 

Whereas the same file using base 3.15 is:

 

../O.Common/example.db: ../example.template \

./example.generated

 

I assume that db.d file is used as a Makefile rule, and since “example.template” is now referenced the build system will repeatedly try to execute the “example.template” rule?

 

Cheers,

Matt

 

 

 

STS Integrated Control System Lead Engineer

Spallation Neutron Source

Oak Ridge National Lab

 


Replies:
RE: Db/Makefile infinite loop Pearson, Matthew via Tech-talk
References:
Db/Makefile infinite loop Pearson, Matthew via Tech-talk

Navigate by Date:
Prev: Re: OceanInsight Spectrometer EPICS support Josh Fiddler via Tech-talk
Next: Re: [EXTERNAL] Re: PVAccess via TCP search Kasemir, Kay 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  2020  2021  <20222023  2024 
Navigate by Thread:
Prev: Db/Makefile infinite loop Pearson, Matthew via Tech-talk
Next: RE: Db/Makefile infinite loop Pearson, Matthew 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  2020  2021  <20222023  2024 
ANJ, 19 Oct 2022 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·