Apache OpenOffice (AOO) Bugzilla – Issue 117845
[gbuild] invalid link-target dep-files can be generated
Last modified: 2016-08-27 18:32:16 UTC
it's possible to break one's build with an invalid dependency file. this is most likely to happen on fast many-core boxes. the link-target dep-file is created by cat'ing the dep-files of the objects contained in the link-target. there are 2 rules that create the object dep-files: - an explicit rule that writes a phony dependency to cause the object to be built - the object compile rule also writes the dep-file as a side effect, but this is not tracked in dependencies. the problem is that the object compile command can execute concurrently with the link-target dep-file cat command. the result is that the link-target dep-file contains partial lines, which cause syntax errors. there are 2 obvious fixes: as suggested by b_michaelsen, replace this (unnecessary) dependency: >$(call gb_LinkTarget_get_dep_target,%) : | \ > $(call gb_LinkTarget_get_headers_target,%) with its inverse: >$(call gb_LinkTarget_get_headers_target,%) : | \ > $(call gb_LinkTarget_get_dep_target,%) the other possibility is to remove the explicit object dep-file rule entirely, and introduce a rule that builds the object dep-file from the object file using "touch" to ensure it's newer. the current explicit dep-file rule is completely unnecessary, because the dependency of the link-target on the object file causes it to be updated anyway. with the first variant, make restarts itself at the very beginning, after building all link-target dep-files. with the second variant, make restarts itself after building all object files, before linking. i think i prefer the second variant, because make starts doing useful work earlier.
discussing with mba revealed another argument for the second variant: on windows, writing out all these phony dep-files takes ages, so it takes a long time for the build to actually start. btw, another problem in this area is that the line: $(firstword $(MAKEFILE_LIST)) : $(call gb_LinkTarget_get_dep_target,$(1)) does not seem to have any effect at all. a simple -include is all that is needed. now with the fix it works like this: first GNU make will try to build all the include makefiles, i.e., the gb_LinkTarget_get_dep_target. these depend on the object dep-files, which in turn depend on the object files. so first all object files will be built, then make restarts itself to load the generated included dep-files, then it builds everything else. another problem is also fixed, which first caused this fix to work on 3.82, bot not on 3.81. the error rule for the GenCxxFile does not work, and has never done what it was intended for. the reason is by now familiar: the prerequisite of the GenCxxFile is (in contrast to the other compile rules) itself a target. fixed in CWS gnumake4 http://hg.services.openoffice.org/hg/cws/gnumake4/rev/371ab623e90d this fix revealed yet another problem, because now the dependecy tree is ordered somewhat differently, and in sw there were some objects that were linked both into sw and swd. before these were compiled from the sw library, now they are compiled from the swd library, so they don't get the right DLLIMPLEMENTATION. also fixed: http://hg.services.openoffice.org/hg/cws/gnumake4/rev/0c13175d5e5e
getting rid of value "enhancement" for field "severity". For enhancement the field "issue type" shall be used.
This patch causes a MASSIVE build performance regression on Windows, roughly DOUBLING the total build time in branches/gbuild-reintegration, and increasing the main/sw build time almost 6-fold, from 38 minutes to 218: r1409590 in braches/gbuild, merged in r1735004 in branches/gbuild-reintegration gnumake4: #i117845#: LinkTarget.mk: refactor dep-files: introduce dependency from object dep-file to object. It is sufficient to patch only the CxxObject section in Linktarget.mk to reproduce it. Parallelization has little effect: "make -j4" on a 4 core box is only slightly faster than -j2 (187 minutes vs 218), even though 4 instances of cl.exe are found running on sporadic checks.
"truckman" committed SVN revision 1758061 into trunk: #i117845# [gbuild] invalid link-target dep-files can be generated
Performance regression fixed in r1758061 by adding a target-specific $(PCH_NAME) to the dep_target so that it gets inherited by the source compiles to trigger the use of the -Yu compiler flag.
Resolved for 4.2.0.