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  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Problem with generating and installing OS specific header
From: Andrew Johnson <[email protected]>
To: Benjamin Franksen <[email protected]>
Cc: [email protected]
Date: Wed, 12 Mar 2014 15:24:07 -0500
Hi Ben,

On 03/12/2014 09:41 AM, Benjamin Franksen wrote:
> This is a question about the EPICS build system. I am doing this:
> 
> INC_vxWorks += bla.h
> 
> bla.h:
> 	touch bla.h
> 
> in a Makefile (boring stuff deleted).
> 
> When I run make I get
> 
> make[2]: *** No rule to make target `../O.Common/bla.h', needed by 
> `inc'.  Stop.
> make[1]: *** [install.vxWorks-68040] Error 2
> make: *** [bugApp.install] Error 2
> 
> 
> I don't understand this. Why does the build system need 
> ../O.Common/bla.h? bla.h is supposed to be OS-specific

I suspect the error message mentions O.Common because of the order in
which the rules for $(INSTALL_INCLUDE)/% are defined in RULES_BUILD; the
first such rule is the one that looks for the file in $(COMMON_DIR) and
GNUMake uses that rule to generate the error message when it can't find
any rules that match.

As I said in my response to Mark we think you're doing something that we
haven't had to support before, although we obviously should. Our rules
for generated include files are not currently compatible with the
INC_<osclass> mechanism.

Janet found that the fix is to modify base/configure/CONFIG_ADDONS as
follows (removing several lines; we wil commit this change to the 3.14
branch):

=== modified file 'configure/CONFIG_ADDONS'
--- configure/CONFIG_ADDONS     2011-11-14 18:33:07 +0000
+++ configure/CONFIG_ADDONS     2014-03-12 18:25:06 +0000
@@ -377,17 +377,6 @@ endif
 endif

 #
-#      concat specific include files
-#
-ifneq ($(strip $(INC_$(OS_CLASS))),)
-INC += $(subst -nil-,,$(INC_$(OS_CLASS)))
-else
-ifdef INC_DEFAULT
-INC+=$(INC_DEFAULT)
-endif
-endif
-
-#
 #      concat specific library contents (if defined) to SYS_PROD_LIBS
 #
 # SYS_PROD_LIBS deprecated

After making that change your original inc-bug succeeds, although the
bla.h file gets created once for every target architecture, so if you
have 4 vxWorks targets it does the work 4 times and the installed file
will be whichever one was built last. There had better not be anything
in the generated file which has to be different for different CPUs
running the same OS.

To avoid doing the work many times, change your rule for bla.h to this:

$(COMMON_DIR)/os/vxWorks/bla.h:
	$(MKDIR) -p $(dir $@)
	touch $@

This should now only create and install the file once for each OS. You
still need the above patch though, and this would have problems with
parallel builds all generating the same target file at the same time. To
fix that, the rule needs to become this:

$(COMMON_DIR)/os/vxWorks/bla.h:
	$(MKDIR) -p $(dir $@)
	touch $(notdir $@)
	$(MV) $(notdir $@) $@

Assuming that in practice instead of touch you'll be doing something
that takes some time to execute; the mv is atomic so won't fail in
parallel situations.

Of course when I build that using make -j on my lightly loaded system
all the vxWorks architecture builds run simultaneously and all execute
the rule, but at least they won't tread on each other's toes while doing
so. Note that our installer script uses a similar copy-then-rename
technique to avoid problems in parallel builds.

- Andrew
-- 
Advertising may be described as the science of arresting the human
intelligence long enough to get money from it. -- Stephen Leacock

References:
Problem with generating and installing OS specific header Benjamin Franksen

Navigate by Date:
Prev: RE: MAXv model-3 - error reading axis position after 5 attempts Jens . Eden
Next: Re: Andor SDK3 Zyla Pearson, Matthew R.
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: Problem with generating and installing OS specific header Benjamin Franksen
Next: Another build-system bug in 3.14.12 Benjamin Franksen
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 17 Dec 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·