[dpdk-dev] [PATCH v3 7/8] mk: sort object files when building deps lists

Luca Boccassi lboccass at Brocade.com
Tue Jun 27 12:43:17 CEST 2017


On Tue, 2017-06-27 at 01:20 +0200, Thomas Monjalon wrote:
> 23/06/2017 20:41, lboccass at brocade.com:
> > From: Luca Boccassi <luca.boccassi at gmail.com>
> > 
> > In order to achieve reproducible builds, always use the same
> > order when listing object files to build dependencies lists.
> > 
> > Signed-off-by: Luca Boccassi <luca.boccassi at gmail.com>
> > ---
> >  mk/rte.app.mk     | 4 ++--
> >  mk/rte.hostapp.mk | 4 ++--
> >  mk/rte.shared.mk  | 4 ++--
> >  3 files changed, 6 insertions(+), 6 deletions(-)
> > 
> > --- a/mk/rte.app.mk
> > +++ b/mk/rte.app.mk
> > @@ -263,8 +263,8 @@ LDLIBS_NAMES += $(patsubst -Wl$(comma)-
> > l%,lib%.a,$(filter -Wl$(comma)-l%,$(LDLIB
> >  
> >  # list of found libraries files (useful for deps). If not found,
> > the
> >  # library is silently ignored and dep won't be checked
> > -LDLIBS_FILES := $(wildcard $(foreach dir,$(LDLIBS_PATH),\
> > -	$(addprefix $(dir)/,$(LDLIBS_NAMES))))
> > +LDLIBS_FILES := $(sort $(wildcard $(foreach dir,$(LDLIBS_PATH),\
> > +	$(addprefix $(dir)/,$(LDLIBS_NAMES)))))
> 
> You cannot sort libraries.
> Check - for instance - this comment above in this file:
> 	# Eliminate duplicates without sorting, only keep the last
> occurrence
> 	filter-libs = \

Not sure I follow - what's the reason for avoiding to sort the list of
libs to link against?

> Why sorting them?
> What is random in libraries list?

The issue is that the output of wildcard is not fully deterministic. It
can depend on the filesystem, and even on the locale settings [1].
Before GNU Make 3.82 (2009) it used to automatically sort the output,
but that was removed (to make it faster... sigh). [2]



-- 
Kind regards,
Luca Boccassi

[1] https://reproducible-builds.org/docs/stable-inputs/
[2] http://comments.gmane.org/gmane.comp.gnu.make.bugs/4260


More information about the dev mailing list