Hi,
Sure, I’ve put it here, with a description of what I did:
https://github.com/mp49/epics_make_loop_test
This is just a simple module I created that reproduces the problem.
For this test I used fresh downloads of base 3.14.12.8, 3.15.9 and 7.0.7.
If you clone that, then edit the RELEASE file to point to your base versions, and you should see the problem happen (with 3.15.9+).
Cheers,
Matt
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
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