login Signup

what is a statcache job?

I occasionally see conflicts on directories created during my build, even though there is a order-only dependency on the directory. For a makefile like:

     mkdir -p $@

 ${OBJDIR}/foo.c: | ${OBJDIR}
     generate_foo -o $@
 ${OBJDIR}/foo.o: ${OBJDIR}/foo.c
     $(CC) $(CFLAGS) -o $@ $<

I often see a conflict on ${OBJDIR} for the ${OBJDIR}/foo.o rule. The job is recorded as type statcache, with the target name "@@/path/to/objdir:. This job took no time to complete (elapsed time == 0), and its rerun job is run immediately (typically the very next job). This will also be a statcache job that took no time to complete. Later I will see the "real" annotation records for ${OBJDIR}/foo.c and ${OBJDIR}/foo.o.

While these conflicts don't seem to cause build performance issues, I am curious what a statcache job is and whether I should spend any effort refactoring makefiles to avoid the conflicts.

avatar image By johntconklin 140 asked Aug 29, 2014 at 09:41 PM
more ▼
(comments are locked)
10|750 characters needed characters left

2 answers: sort voted first

Because of differences in the way that Electric Make works internally compared to GNU make, emake must go through some contortions in order to correctly emulate GNU make behavior in every case. statcache jobs are an artifact of those contortions. GNU make caches file attributes internally, and that affects later decisions about which targets are up-to-date and which are not. It may even cause GNU make to incorrectly consider a file as non-existing when that file has been created by some other step in the build! statcache jobs exist to allow emake to make sure it populates its version of the filesystem attribute cache at the same logical time that GNU make would when run serially.

There are some known deficiencies in the implementation of statcache jobs up through ElectricAccelerator 7.2.2. Note that statcache jobs were only introduced in ElectricAccelerator 7.0. Those deficiencies can result in conflicts, although if you have a good history file then you shouldn't see conflicts on statcache jobs anymore. As of Accelerator 10.1 all known issues with conflicts on statcache jobs and history relating to the stat cache at large have been addressed, so if you're using something older than that you should upgrade.

avatar image By eric melski ♦♦ 6k answered Sep 02, 2014 at 02:22 PM
more ▼
(comments are locked)
10|750 characters needed characters left
Your answer
toggle preview:

Up to 8 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.