[dpdk-dev,v7,6/6] mk: install symlinks before build step
diff mbox

Message ID 20170905205159.8606-7-luca.boccassi@gmail.com
State Superseded, archived
Headers show

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Luca Boccassi Sept. 5, 2017, 8:51 p.m. UTC
From: Luca Boccassi <luca.boccassi@gmail.com>

A race condition can happen during parallel builds, where a header
might be installed in RTE_OUT/include before CFLAGS is recursively
expanded. This causes GCC to sometimes pick the header path as
SRCDIR/... and sometimes as RTE_OUT/include/... making the build
unreproducible, as the full path is used for the expansion of
__FILE__ and in the DWARF directory listing.

Installing all symlinks before all builds solves the problem. It is
still suboptimal, as the (fixed) path recorded in the DWARF dir
listing will include the user-configurable build output directory,
and thus will result in a different binary between different users
despite all other conditions being equal, but it is a simpler
approach that will anyway be obsolete once the build system is
switched to Meson.

Suggested-by: Ferruh Yigit <ferruh.yigit@intel.com>
Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
---
 mk/rte.lib.mk | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Thomas Monjalon Oct. 12, 2017, 2:58 a.m. UTC | #1
05/09/2017 22:51, luca.boccassi@gmail.com:
>  .PHONY: install
> +ifeq ($(SYMLINK-FILES-y),)
>  install: build _postinstall
> +else
> +install: _preinstall build _postinstall
> +endif

I think you cannot be sure that "_preinstall" will be finished
before the "build" target starts in parallel make.
Am I missing something?
Luca Boccassi Oct. 12, 2017, 12:19 p.m. UTC | #2
On Thu, 2017-10-12 at 04:58 +0200, Thomas Monjalon wrote:
> 05/09/2017 22:51, luca.boccassi@gmail.com:
> >  .PHONY: install
> > +ifeq ($(SYMLINK-FILES-y),)
> >  install: build _postinstall
> > +else
> > +install: _preinstall build _postinstall
> > +endif
> 
> I think you cannot be sure that "_preinstall" will be finished
> before the "build" target starts in parallel make.
> Am I missing something?

Yes, you are right, good catch. I'll add a dependency:

build: _preinstall

Which should take care of it, retest and send a new version.

Patch
diff mbox

diff --git a/mk/rte.lib.mk b/mk/rte.lib.mk
index 13115d146..643da47da 100644
--- a/mk/rte.lib.mk
+++ b/mk/rte.lib.mk
@@ -59,14 +59,19 @@  endif
 
 
 _BUILD = $(LIB)
-_INSTALL = $(INSTALL-FILES-y) $(SYMLINK-FILES-y) $(RTE_OUTPUT)/lib/$(LIB)
+PREINSTALL = $(SYMLINK-FILES-y)
+_INSTALL = $(INSTALL-FILES-y) $(RTE_OUTPUT)/lib/$(LIB)
 _CLEAN = doclean
 
 .PHONY: all
 all: install
 
 .PHONY: install
+ifeq ($(SYMLINK-FILES-y),)
 install: build _postinstall
+else
+install: _preinstall build _postinstall
+endif
 
 _postinstall: build