* [dpdk-dev] [PATCH v4 1/6] mk: sort list of shared objects in linker script
2017-06-28 13:56 ` [dpdk-dev] [PATCH v4 0/6] " lboccass
@ 2017-06-28 13:56 ` lboccass
2017-06-28 13:56 ` [dpdk-dev] [PATCH v4 2/6] mk: sort list of files in examples.dox lboccass
` (6 subsequent siblings)
7 siblings, 0 replies; 65+ messages in thread
From: lboccass @ 2017-06-28 13:56 UTC (permalink / raw)
To: dev; +Cc: Luca Boccassi
From: Luca Boccassi <luca.boccassi@gmail.com>
The output of wildcard might not be stable and depend on the
filesystem and other factors.
This means the content libdpdk.so linker script might change between
builds from the same sources.
Run the list through sort to ensure reproducibility.
Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
---
mk/rte.combinedlib.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mk/rte.combinedlib.mk b/mk/rte.combinedlib.mk
index 449358b33..2ab7ee8a1 100644
--- a/mk/rte.combinedlib.mk
+++ b/mk/rte.combinedlib.mk
@@ -42,7 +42,7 @@ endif
RTE_LIBNAME := dpdk
COMBINEDLIB := lib$(RTE_LIBNAME)$(EXT)
-LIBS := $(filter-out $(COMBINEDLIB), $(notdir $(wildcard $(RTE_OUTPUT)/lib/*$(EXT))))
+LIBS := $(filter-out $(COMBINEDLIB), $(sort $(notdir $(wildcard $(RTE_OUTPUT)/lib/*$(EXT)))))
all: FORCE
$(Q)echo "GROUP ( $(LIBS) )" > $(RTE_OUTPUT)/lib/$(COMBINEDLIB)
--
2.11.0
^ permalink raw reply [flat|nested] 65+ messages in thread
* [dpdk-dev] [PATCH v4 2/6] mk: sort list of files in examples.dox
2017-06-28 13:56 ` [dpdk-dev] [PATCH v4 0/6] " lboccass
2017-06-28 13:56 ` [dpdk-dev] [PATCH v4 1/6] mk: sort list of shared objects in linker script lboccass
@ 2017-06-28 13:56 ` lboccass
2017-06-28 13:56 ` [dpdk-dev] [PATCH v4 3/6] mk: sort headers before wildcard inclusion lboccass
` (5 subsequent siblings)
7 siblings, 0 replies; 65+ messages in thread
From: lboccass @ 2017-06-28 13:56 UTC (permalink / raw)
To: dev; +Cc: Luca Boccassi
From: Luca Boccassi <luca.boccassi@gmail.com>
The result of find might not be stable depending on external
conditions.
Pipe it through LC_ALL=C sort to ensure reproducible results when
generating examples.dox.
Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
---
mk/rte.sdkdoc.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mk/rte.sdkdoc.mk b/mk/rte.sdkdoc.mk
index c0eaa3502..de31b78cf 100644
--- a/mk/rte.sdkdoc.mk
+++ b/mk/rte.sdkdoc.mk
@@ -93,7 +93,7 @@ $(API_EXAMPLES): api-html-clean
$(Q)mkdir -p $(@D)
@printf '/**\n' > $(API_EXAMPLES)
@printf '@page examples DPDK Example Programs\n\n' >> $(API_EXAMPLES)
- @find examples -type f -name '*.c' -printf '@example %p\n' >> $(API_EXAMPLES)
+ @find examples -type f -name '*.c' -printf '@example %p\n' | LC_ALL=C sort >> $(API_EXAMPLES)
@printf '*/\n' >> $(API_EXAMPLES)
guides-pdf-clean: guides-pdf-img-clean
--
2.11.0
^ permalink raw reply [flat|nested] 65+ messages in thread
* [dpdk-dev] [PATCH v4 3/6] mk: sort headers before wildcard inclusion
2017-06-28 13:56 ` [dpdk-dev] [PATCH v4 0/6] " lboccass
2017-06-28 13:56 ` [dpdk-dev] [PATCH v4 1/6] mk: sort list of shared objects in linker script lboccass
2017-06-28 13:56 ` [dpdk-dev] [PATCH v4 2/6] mk: sort list of files in examples.dox lboccass
@ 2017-06-28 13:56 ` lboccass
2017-06-28 13:57 ` [dpdk-dev] [PATCH v4 4/6] mk: sort source files before passing them to the compiler lboccass
` (4 subsequent siblings)
7 siblings, 0 replies; 65+ messages in thread
From: lboccass @ 2017-06-28 13:56 UTC (permalink / raw)
To: dev; +Cc: Luca Boccassi
From: Luca Boccassi <luca.boccassi@gmail.com>
In order to achieve fully reproducible builds, always use the same
inclusion order for headers in the Makefiles.
Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
---
examples/ip_pipeline/Makefile | 2 +-
examples/multi_process/client_server_mp/mp_server/Makefile | 2 +-
examples/server_node_efd/server/Makefile | 2 +-
lib/librte_eal/common/Makefile | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile
index dc7e0ddd7..12ce0a1d5 100644
--- a/examples/ip_pipeline/Makefile
+++ b/examples/ip_pipeline/Makefile
@@ -43,7 +43,7 @@ APP = ip_pipeline
VPATH += $(SRCDIR)/pipeline
-INC += $(wildcard *.h) $(wildcard pipeline/*.h)
+INC += $(sort $(wildcard *.h)) $(sort $(wildcard pipeline/*.h))
# all source are stored in SRCS-y
SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) := main.c
diff --git a/examples/multi_process/client_server_mp/mp_server/Makefile b/examples/multi_process/client_server_mp/mp_server/Makefile
index 5552999b5..160c17b68 100644
--- a/examples/multi_process/client_server_mp/mp_server/Makefile
+++ b/examples/multi_process/client_server_mp/mp_server/Makefile
@@ -49,7 +49,7 @@ APP = mp_server
# all source are stored in SRCS-y
SRCS-y := main.c init.c args.c
-INC := $(wildcard *.h)
+INC := $(sort $(wildcard *.h))
CFLAGS += $(WERROR_FLAGS) -O3
CFLAGS += -I$(SRCDIR)/../shared
diff --git a/examples/server_node_efd/server/Makefile b/examples/server_node_efd/server/Makefile
index a2f2f361b..9f1fe2894 100644
--- a/examples/server_node_efd/server/Makefile
+++ b/examples/server_node_efd/server/Makefile
@@ -49,7 +49,7 @@ APP = server
# all source are stored in SRCS-y
SRCS-y := main.c init.c args.c
-INC := $(wildcard *.h)
+INC := $(sort $(wildcard *.h))
CFLAGS += $(WERROR_FLAGS) -O3
CFLAGS += -I$(SRCDIR)/../shared
diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile
index a5bd1089a..4b712600a 100644
--- a/lib/librte_eal/common/Makefile
+++ b/lib/librte_eal/common/Makefile
@@ -48,7 +48,7 @@ GENERIC_INC += rte_vect.h rte_io.h
# defined in mk/arch/$(RTE_ARCH)/rte.vars.mk
ARCH_DIR ?= $(RTE_ARCH)
-ARCH_INC := $(notdir $(wildcard $(RTE_SDK)/lib/librte_eal/common/include/arch/$(ARCH_DIR)/*.h))
+ARCH_INC := $(sort $(notdir $(wildcard $(RTE_SDK)/lib/librte_eal/common/include/arch/$(ARCH_DIR)/*.h)))
SYMLINK-$(CONFIG_RTE_LIBRTE_EAL)-include := $(addprefix include/,$(INC))
SYMLINK-$(CONFIG_RTE_LIBRTE_EAL)-include += \
--
2.11.0
^ permalink raw reply [flat|nested] 65+ messages in thread
* [dpdk-dev] [PATCH v4 4/6] mk: sort source files before passing them to the compiler
2017-06-28 13:56 ` [dpdk-dev] [PATCH v4 0/6] " lboccass
` (2 preceding siblings ...)
2017-06-28 13:56 ` [dpdk-dev] [PATCH v4 3/6] mk: sort headers before wildcard inclusion lboccass
@ 2017-06-28 13:57 ` lboccass
2017-06-28 13:57 ` [dpdk-dev] [PATCH v4 5/6] mk: sort object files when building deps lists lboccass
` (3 subsequent siblings)
7 siblings, 0 replies; 65+ messages in thread
From: lboccass @ 2017-06-28 13:57 UTC (permalink / raw)
To: dev; +Cc: Luca Boccassi
From: Luca Boccassi <luca.boccassi@gmail.com>
In order to achieve reproducible builds, always use the same
order when listing files for compilation.
Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
---
drivers/net/cxgbe/Makefile | 2 +-
drivers/net/e1000/Makefile | 2 +-
drivers/net/fm10k/Makefile | 2 +-
drivers/net/i40e/Makefile | 2 +-
drivers/net/ixgbe/Makefile | 2 +-
drivers/net/qede/Makefile | 2 +-
drivers/net/sfc/Makefile | 2 +-
drivers/net/thunderx/Makefile | 2 +-
8 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/net/cxgbe/Makefile b/drivers/net/cxgbe/Makefile
index 7cef6279c..b4666b5af 100644
--- a/drivers/net/cxgbe/Makefile
+++ b/drivers/net/cxgbe/Makefile
@@ -67,7 +67,7 @@ endif
# Add extra flags for base driver files (also known as shared code)
# to disable warnings in them
#
-BASE_DRIVER_OBJS=$(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c)))
+BASE_DRIVER_OBJS=$(sort $(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c))))
$(foreach obj, $(BASE_DRIVER_OBJS), $(eval CFLAGS_$(obj)+=$(CFLAGS_BASE_DRIVER)))
VPATH += $(SRCDIR)/base
diff --git a/drivers/net/e1000/Makefile b/drivers/net/e1000/Makefile
index ffdf36d37..59d96bca1 100644
--- a/drivers/net/e1000/Makefile
+++ b/drivers/net/e1000/Makefile
@@ -68,7 +68,7 @@ endif
# Add extra flags for base driver files (also known as shared code)
# to disable warnings in them
#
-BASE_DRIVER_OBJS=$(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c)))
+BASE_DRIVER_OBJS=$(sort $(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c))))
$(foreach obj, $(BASE_DRIVER_OBJS), $(eval CFLAGS_$(obj)+=$(CFLAGS_BASE_DRIVER)))
VPATH += $(SRCDIR)/base
diff --git a/drivers/net/fm10k/Makefile b/drivers/net/fm10k/Makefile
index e0024f052..0bc124eb1 100644
--- a/drivers/net/fm10k/Makefile
+++ b/drivers/net/fm10k/Makefile
@@ -80,7 +80,7 @@ endif
#
# Add extra flags for base driver source files to disable warnings in them
#
-BASE_DRIVER_OBJS=$(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c)))
+BASE_DRIVER_OBJS=$(sort $(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c))))
$(foreach obj, $(BASE_DRIVER_OBJS), $(eval CFLAGS_$(obj)+=$(CFLAGS_BASE_DRIVER)))
VPATH += $(SRCDIR)/base
diff --git a/drivers/net/i40e/Makefile b/drivers/net/i40e/Makefile
index 56f210d6d..06eedc592 100644
--- a/drivers/net/i40e/Makefile
+++ b/drivers/net/i40e/Makefile
@@ -78,7 +78,7 @@ endif
CFLAGS_i40e_lan_hmc.o += -Wno-error
endif
-OBJS_BASE_DRIVER=$(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c)))
+OBJS_BASE_DRIVER=$(sort $(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c))))
$(foreach obj, $(OBJS_BASE_DRIVER), $(eval CFLAGS_$(obj)+=$(CFLAGS_BASE_DRIVER)))
VPATH += $(SRCDIR)/base
diff --git a/drivers/net/ixgbe/Makefile b/drivers/net/ixgbe/Makefile
index 6a651b923..f5c370ce5 100644
--- a/drivers/net/ixgbe/Makefile
+++ b/drivers/net/ixgbe/Makefile
@@ -87,7 +87,7 @@ endif
# Add extra flags for base driver files (also known as shared code)
# to disable warnings in them
#
-BASE_DRIVER_OBJS=$(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c)))
+BASE_DRIVER_OBJS=$(sort $(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c))))
$(foreach obj, $(BASE_DRIVER_OBJS), $(eval CFLAGS_$(obj)+=$(CFLAGS_BASE_DRIVER)))
VPATH += $(SRCDIR)/base
diff --git a/drivers/net/qede/Makefile b/drivers/net/qede/Makefile
index f03441d9a..83ff95474 100644
--- a/drivers/net/qede/Makefile
+++ b/drivers/net/qede/Makefile
@@ -78,7 +78,7 @@ endif
# to disable warnings in them
#
#
-BASE_DRIVER_OBJS=$(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c)))
+BASE_DRIVER_OBJS=$(sort $(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c))))
$(foreach obj, $(BASE_DRIVER_OBJS), $(eval CFLAGS_$(obj)+=$(CFLAGS_BASE_DRIVER)))
VPATH += $(SRCDIR)/base
diff --git a/drivers/net/sfc/Makefile b/drivers/net/sfc/Makefile
index 57aa963ba..8cfd14d45 100644
--- a/drivers/net/sfc/Makefile
+++ b/drivers/net/sfc/Makefile
@@ -71,7 +71,7 @@ endif
# List of base driver object files for which
# special CFLAGS above should be applied
#
-BASE_DRIVER_OBJS=$(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c)))
+BASE_DRIVER_OBJS=$(sort $(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c))))
$(foreach obj, $(BASE_DRIVER_OBJS), \
$(eval CFLAGS_$(obj)+=$(CFLAGS_BASE_DRIVER)))
diff --git a/drivers/net/thunderx/Makefile b/drivers/net/thunderx/Makefile
index 706250b8b..ac384a624 100644
--- a/drivers/net/thunderx/Makefile
+++ b/drivers/net/thunderx/Makefile
@@ -45,7 +45,7 @@ EXPORT_MAP := rte_pmd_thunderx_nicvf_version.map
LIBABIVER := 1
-OBJS_BASE_DRIVER=$(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c)))
+OBJS_BASE_DRIVER=$(sort $(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c))))
$(foreach obj, $(OBJS_BASE_DRIVER), $(eval CFLAGS_$(obj)+=$(CFLAGS_BASE_DRIVER)))
VPATH += $(SRCDIR)/base
--
2.11.0
^ permalink raw reply [flat|nested] 65+ messages in thread
* [dpdk-dev] [PATCH v4 5/6] mk: sort object files when building deps lists
2017-06-28 13:56 ` [dpdk-dev] [PATCH v4 0/6] " lboccass
` (3 preceding siblings ...)
2017-06-28 13:57 ` [dpdk-dev] [PATCH v4 4/6] mk: sort source files before passing them to the compiler lboccass
@ 2017-06-28 13:57 ` lboccass
2017-06-28 13:57 ` [dpdk-dev] [PATCH v4 6/6] mk: set -ISCDIR before -IRTE_OUT/include in CFLAGS lboccass
` (2 subsequent siblings)
7 siblings, 0 replies; 65+ messages in thread
From: lboccass @ 2017-06-28 13:57 UTC (permalink / raw)
To: dev; +Cc: Luca Boccassi
From: Luca Boccassi <luca.boccassi@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@gmail.com>
---
mk/rte.app.mk | 4 ++--
mk/rte.hostapp.mk | 4 ++--
mk/rte.shared.mk | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index bcaf1b382..54134dea4 100644
--- 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)))))
#
# Compile executable file if needed
diff --git a/mk/rte.hostapp.mk b/mk/rte.hostapp.mk
index 5cb4909cb..f58173c31 100644
--- a/mk/rte.hostapp.mk
+++ b/mk/rte.hostapp.mk
@@ -69,9 +69,9 @@ O_TO_EXE_DO = @set -e; \
-include .$(HOSTAPP).cmd
# list of .a files that are linked to this application
-LDLIBS_FILES := $(wildcard \
+LDLIBS_FILES := $(sort $(wildcard \
$(addprefix $(RTE_OUTPUT)/lib/, \
- $(patsubst -l%,lib%.a,$(filter -l%,$(LDLIBS)))))
+ $(patsubst -l%,lib%.a,$(filter -l%,$(LDLIBS))))))
#
# Compile executable file if needed
diff --git a/mk/rte.shared.mk b/mk/rte.shared.mk
index 87ccf0ba4..4e680bc03 100644
--- a/mk/rte.shared.mk
+++ b/mk/rte.shared.mk
@@ -85,8 +85,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)))))
#
# Archive objects in .so file if needed
--
2.11.0
^ permalink raw reply [flat|nested] 65+ messages in thread
* [dpdk-dev] [PATCH v4 6/6] mk: set -ISCDIR before -IRTE_OUT/include in CFLAGS
2017-06-28 13:56 ` [dpdk-dev] [PATCH v4 0/6] " lboccass
` (4 preceding siblings ...)
2017-06-28 13:57 ` [dpdk-dev] [PATCH v4 5/6] mk: sort object files when building deps lists lboccass
@ 2017-06-28 13:57 ` lboccass
2017-06-28 15:57 ` [dpdk-dev] [PATCH v4 0/6] Reproducible build Stephen Hemminger
2017-08-10 18:23 ` [dpdk-dev] [PATCH v5 " luca.boccassi
7 siblings, 0 replies; 65+ messages in thread
From: lboccass @ 2017-06-28 13:57 UTC (permalink / raw)
To: dev; +Cc: Luca Boccassi
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.
Always pass -ISRCDIR first to CFLAGS so that it's deterministic.
Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
---
lib/librte_acl/Makefile | 10 ++++++++--
lib/librte_bitratestats/Makefile | 9 ++++++++-
lib/librte_cmdline/Makefile | 9 ++++++++-
lib/librte_distributor/Makefile | 10 ++++++++--
lib/librte_efd/Makefile | 10 ++++++++--
lib/librte_hash/Makefile | 10 ++++++++--
lib/librte_ip_frag/Makefile | 10 ++++++++--
lib/librte_jobstats/Makefile | 10 ++++++++--
lib/librte_kni/Makefile | 9 ++++++++-
lib/librte_kvargs/Makefile | 9 ++++++++-
lib/librte_latencystats/Makefile | 9 ++++++++-
lib/librte_lpm/Makefile | 10 ++++++++--
lib/librte_mbuf/Makefile | 9 ++++++++-
lib/librte_mempool/Makefile | 9 ++++++++-
lib/librte_metrics/Makefile | 9 ++++++++-
lib/librte_net/Makefile | 9 ++++++++-
lib/librte_pdump/Makefile | 10 ++++++++--
lib/librte_power/Makefile | 9 ++++++++-
lib/librte_reorder/Makefile | 10 ++++++++--
lib/librte_ring/Makefile | 9 ++++++++-
lib/librte_timer/Makefile | 9 ++++++++-
lib/librte_vhost/Makefile | 9 ++++++++-
22 files changed, 176 insertions(+), 31 deletions(-)
diff --git a/lib/librte_acl/Makefile b/lib/librte_acl/Makefile
index e2dacd606..470ef6d21 100644
--- a/lib/librte_acl/Makefile
+++ b/lib/librte_acl/Makefile
@@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_acl.a
-CFLAGS += -O3
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_acl_version.map
diff --git a/lib/librte_bitratestats/Makefile b/lib/librte_bitratestats/Makefile
index 58a20ea09..26a3f4908 100644
--- a/lib/librte_bitratestats/Makefile
+++ b/lib/librte_bitratestats/Makefile
@@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_bitratestats.a
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_bitratestats_version.map
diff --git a/lib/librte_cmdline/Makefile b/lib/librte_cmdline/Makefile
index 644f68e47..9dd75f2d2 100644
--- a/lib/librte_cmdline/Makefile
+++ b/lib/librte_cmdline/Makefile
@@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_cmdline.a
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_cmdline_version.map
diff --git a/lib/librte_distributor/Makefile b/lib/librte_distributor/Makefile
index 3ffb911ce..87418f254 100644
--- a/lib/librte_distributor/Makefile
+++ b/lib/librte_distributor/Makefile
@@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_distributor.a
-CFLAGS += -O3
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_distributor_version.map
diff --git a/lib/librte_efd/Makefile b/lib/librte_efd/Makefile
index b9277bc5d..b169e3240 100644
--- a/lib/librte_efd/Makefile
+++ b/lib/librte_efd/Makefile
@@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_efd.a
-CFLAGS += -O3
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_efd_version.map
diff --git a/lib/librte_hash/Makefile b/lib/librte_hash/Makefile
index d856aa26d..e408dcc46 100644
--- a/lib/librte_hash/Makefile
+++ b/lib/librte_hash/Makefile
@@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_hash.a
-CFLAGS += -O3
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_hash_version.map
diff --git a/lib/librte_ip_frag/Makefile b/lib/librte_ip_frag/Makefile
index 4e693bf8f..de45ec2d3 100644
--- a/lib/librte_ip_frag/Makefile
+++ b/lib/librte_ip_frag/Makefile
@@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_ip_frag.a
-CFLAGS += -O3
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_ipfrag_version.map
diff --git a/lib/librte_jobstats/Makefile b/lib/librte_jobstats/Makefile
index 561a0678c..57329b18e 100644
--- a/lib/librte_jobstats/Makefile
+++ b/lib/librte_jobstats/Makefile
@@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_jobstats.a
-CFLAGS += -O3
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_jobstats_version.map
diff --git a/lib/librte_kni/Makefile b/lib/librte_kni/Makefile
index 70f1ca8f6..130d6fd74 100644
--- a/lib/librte_kni/Makefile
+++ b/lib/librte_kni/Makefile
@@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_kni.a
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3 -fno-strict-aliasing
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3 -fno-strict-aliasing
EXPORT_MAP := rte_kni_version.map
diff --git a/lib/librte_kvargs/Makefile b/lib/librte_kvargs/Makefile
index 564dd3102..7c332c110 100644
--- a/lib/librte_kvargs/Makefile
+++ b/lib/librte_kvargs/Makefile
@@ -36,7 +36,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_kvargs.a
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_kvargs_version.map
diff --git a/lib/librte_latencystats/Makefile b/lib/librte_latencystats/Makefile
index eaacbb731..46a8ecd34 100644
--- a/lib/librte_latencystats/Makefile
+++ b/lib/librte_latencystats/Makefile
@@ -33,7 +33,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_latencystats.a
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
LDLIBS += -lm
LDLIBS += -lpthread
diff --git a/lib/librte_lpm/Makefile b/lib/librte_lpm/Makefile
index 32be46b3b..6a97fdc97 100644
--- a/lib/librte_lpm/Makefile
+++ b/lib/librte_lpm/Makefile
@@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_lpm.a
-CFLAGS += -O3
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_lpm_version.map
diff --git a/lib/librte_mbuf/Makefile b/lib/librte_mbuf/Makefile
index 548273054..4d51191ee 100644
--- a/lib/librte_mbuf/Makefile
+++ b/lib/librte_mbuf/Makefile
@@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_mbuf.a
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_mbuf_version.map
diff --git a/lib/librte_mempool/Makefile b/lib/librte_mempool/Makefile
index 7b5bdfee7..33678192f 100644
--- a/lib/librte_mempool/Makefile
+++ b/lib/librte_mempool/Makefile
@@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_mempool.a
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_mempool_version.map
diff --git a/lib/librte_metrics/Makefile b/lib/librte_metrics/Makefile
index d4990e839..195bd4d56 100644
--- a/lib/librte_metrics/Makefile
+++ b/lib/librte_metrics/Makefile
@@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_metrics.a
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_metrics_version.map
diff --git a/lib/librte_net/Makefile b/lib/librte_net/Makefile
index 56727c4df..a08a7dd8b 100644
--- a/lib/librte_net/Makefile
+++ b/lib/librte_net/Makefile
@@ -33,7 +33,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
LIB = librte_net.a
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_net_version.map
LIBABIVER := 1
diff --git a/lib/librte_pdump/Makefile b/lib/librte_pdump/Makefile
index 1c03bcbb7..8923d7499 100644
--- a/lib/librte_pdump/Makefile
+++ b/lib/librte_pdump/Makefile
@@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_pdump.a
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
-CFLAGS += -D_GNU_SOURCE
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3 -D_GNU_SOURCE
LDLIBS += -lpthread
EXPORT_MAP := rte_pdump_version.map
diff --git a/lib/librte_power/Makefile b/lib/librte_power/Makefile
index 06cd10e86..b76ad689e 100644
--- a/lib/librte_power/Makefile
+++ b/lib/librte_power/Makefile
@@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_power.a
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3 -fno-strict-aliasing
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3 -fno-strict-aliasing
EXPORT_MAP := rte_power_version.map
diff --git a/lib/librte_reorder/Makefile b/lib/librte_reorder/Makefile
index 4e44e72f0..51b5d490d 100644
--- a/lib/librte_reorder/Makefile
+++ b/lib/librte_reorder/Makefile
@@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_reorder.a
-CFLAGS += -O3
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_reorder_version.map
diff --git a/lib/librte_ring/Makefile b/lib/librte_ring/Makefile
index 3e2f4b873..e5248a2c1 100644
--- a/lib/librte_ring/Makefile
+++ b/lib/librte_ring/Makefile
@@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_ring.a
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_ring_version.map
diff --git a/lib/librte_timer/Makefile b/lib/librte_timer/Makefile
index 03a15390e..0c57cc6d3 100644
--- a/lib/librte_timer/Makefile
+++ b/lib/librte_timer/Makefile
@@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_timer.a
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during parallel
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_timer_version.map
diff --git a/lib/librte_vhost/Makefile b/lib/librte_vhost/Makefile
index 4a116fe31..ef0d86990 100644
--- a/lib/librte_vhost/Makefile
+++ b/lib/librte_vhost/Makefile
@@ -38,7 +38,14 @@ EXPORT_MAP := rte_vhost_version.map
LIBABIVER := 4
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3 -D_FILE_OFFSET_BITS=64
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during parallel
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3 -D_FILE_OFFSET_BITS=64
CFLAGS += -I vhost_user
LDLIBS += -lpthread
--
2.11.0
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [dpdk-dev] [PATCH v4 0/6] Reproducible build
2017-06-28 13:56 ` [dpdk-dev] [PATCH v4 0/6] " lboccass
` (5 preceding siblings ...)
2017-06-28 13:57 ` [dpdk-dev] [PATCH v4 6/6] mk: set -ISCDIR before -IRTE_OUT/include in CFLAGS lboccass
@ 2017-06-28 15:57 ` Stephen Hemminger
2017-06-28 16:04 ` Bruce Richardson
2017-08-10 18:23 ` [dpdk-dev] [PATCH v5 " luca.boccassi
7 siblings, 1 reply; 65+ messages in thread
From: Stephen Hemminger @ 2017-06-28 15:57 UTC (permalink / raw)
To: lboccass; +Cc: dev, Luca Boccassi
On Wed, 28 Jun 2017 14:56:56 +0100
<lboccass@brocade.com> wrote:
> From: Luca Boccassi <luca.boccassi@gmail.com>
>
> In the past couple of years a concerted effort among almost all Linux
> distros has been striving toward achieving reproducible builds. [1]
> This involves changes to the toolchain, new tools and CI systems. [2]
>
> v1 fixed the documentation, examples and linker script generation.
> v2 fixes all problems, which were caused by unstable order of headers
> inclusion, source files listing and object file listing when passing
> them to the compiler.
> DPDK's build, at least with the default configuration, is fully
> reproducible with this patch series as tested by the Reproducible
> Builds developers experimental toolchain. [3]
>
> v3 restores the first patch, which was eaten by git send-email.
>
> v4 drops the patch that reorders rebuilds, and adds a patch to make
> the inclusion of headers deterministic with regards to GCC embedding
> the full file path when expading __FILE__ and when writing the
> directory listing in the DWARF objects.
> It also drops the first 2 patches which have already been merged.
>
> [1] https://reproducible-builds.org/
> [2] https://reproducible-builds.org/tools/
> [3] https://wiki.debian.org/ReproducibleBuilds/ExperimentalToolchain#Us
Looks good.
Looking ahead, how does this work with the proposed new build system?
Is there an automated way to check new submissions so that new features
don't undo this.
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [dpdk-dev] [PATCH v4 0/6] Reproducible build
2017-06-28 15:57 ` [dpdk-dev] [PATCH v4 0/6] Reproducible build Stephen Hemminger
@ 2017-06-28 16:04 ` Bruce Richardson
2017-06-28 17:52 ` Luca Boccassi
2017-08-11 12:43 ` Luca Boccassi
0 siblings, 2 replies; 65+ messages in thread
From: Bruce Richardson @ 2017-06-28 16:04 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: lboccass, dev, Luca Boccassi
On Wed, Jun 28, 2017 at 08:57:33AM -0700, Stephen Hemminger wrote:
> On Wed, 28 Jun 2017 14:56:56 +0100
> <lboccass@brocade.com> wrote:
>
> > From: Luca Boccassi <luca.boccassi@gmail.com>
> >
> > In the past couple of years a concerted effort among almost all Linux
> > distros has been striving toward achieving reproducible builds. [1]
> > This involves changes to the toolchain, new tools and CI systems. [2]
> >
> > v1 fixed the documentation, examples and linker script generation.
> > v2 fixes all problems, which were caused by unstable order of headers
> > inclusion, source files listing and object file listing when passing
> > them to the compiler.
> > DPDK's build, at least with the default configuration, is fully
> > reproducible with this patch series as tested by the Reproducible
> > Builds developers experimental toolchain. [3]
> >
> > v3 restores the first patch, which was eaten by git send-email.
> >
> > v4 drops the patch that reorders rebuilds, and adds a patch to make
> > the inclusion of headers deterministic with regards to GCC embedding
> > the full file path when expading __FILE__ and when writing the
> > directory listing in the DWARF objects.
> > It also drops the first 2 patches which have already been merged.
> >
> > [1] https://reproducible-builds.org/
> > [2] https://reproducible-builds.org/tools/
> > [3] https://wiki.debian.org/ReproducibleBuilds/ExperimentalToolchain#Us
>
> Looks good.
>
> Looking ahead, how does this work with the proposed new build system?
> Is there an automated way to check new submissions so that new features
> don't undo this.
>
>
> Acked-by: Stephen Hemminger <stephen@networkplumber.org>
http://mesonbuild.com/Reproducible-builds.html
I'd hope if we switch build system, this shouldn't be a problem. It's
definitely something to watch out for.
/Bruce
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [dpdk-dev] [PATCH v4 0/6] Reproducible build
2017-06-28 16:04 ` Bruce Richardson
@ 2017-06-28 17:52 ` Luca Boccassi
2017-08-11 12:43 ` Luca Boccassi
1 sibling, 0 replies; 65+ messages in thread
From: Luca Boccassi @ 2017-06-28 17:52 UTC (permalink / raw)
To: stephen, bruce.richardson; +Cc: dev
On Wed, 2017-06-28 at 17:04 +0100, Bruce Richardson wrote:
> On Wed, Jun 28, 2017 at 08:57:33AM -0700, Stephen Hemminger wrote:
> > On Wed, 28 Jun 2017 14:56:56 +0100
> > <lboccass@brocade.com> wrote:
> >
> > > From: Luca Boccassi <luca.boccassi@gmail.com>
> > >
> > > In the past couple of years a concerted effort among almost all
> > > Linux
> > > distros has been striving toward achieving reproducible builds.
> > > [1]
> > > This involves changes to the toolchain, new tools and CI systems.
> > > [2]
> > >
> > > v1 fixed the documentation, examples and linker script
> > > generation.
> > > v2 fixes all problems, which were caused by unstable order of
> > > headers
> > > inclusion, source files listing and object file listing when
> > > passing
> > > them to the compiler.
> > > DPDK's build, at least with the default configuration, is fully
> > > reproducible with this patch series as tested by the Reproducible
> > > Builds developers experimental toolchain. [3]
> > >
> > > v3 restores the first patch, which was eaten by git send-email.
> > >
> > > v4 drops the patch that reorders rebuilds, and adds a patch to
> > > make
> > > the inclusion of headers deterministic with regards to GCC
> > > embedding
> > > the full file path when expading __FILE__ and when writing the
> > > directory listing in the DWARF objects.
> > > It also drops the first 2 patches which have already been merged.
> > >
> > > [1] https://urldefense.proofpoint.com/v2/url?u=https-3A__reproduc
> > > ible-
> > > 2Dbuilds.org_&d=DwIBAg&c=IL_XqQWOjubgfqINi2jTzg&r=QTEM8ICX7t_SLgW
> > > P3qPWtKiwKMps487LPWQx-
> > > B9AqIc&m=HlHnLJOJRokDA9x9IHxyhvyPOnXIakHUFgofHP7STEQ&s=ibn1k95lSK
> > > CcbF9_9Gy4SpcLwLHaTD0aBr-Gm5uuCFQ&e=
> > > [2] https://urldefense.proofpoint.com/v2/url?u=https-3A__reproduc
> > > ible-
> > > 2Dbuilds.org_tools_&d=DwIBAg&c=IL_XqQWOjubgfqINi2jTzg&r=QTEM8ICX7
> > > t_SLgWP3qPWtKiwKMps487LPWQx-
> > > B9AqIc&m=HlHnLJOJRokDA9x9IHxyhvyPOnXIakHUFgofHP7STEQ&s=u4leWgQouu
> > > DTOMv9EReHQMsopArSu9Xqc1uKe0cCqS0&e=
> > > [3] https://urldefense.proofpoint.com/v2/url?u=https-3A__wiki.deb
> > > ian.org_ReproducibleBuilds_ExperimentalToolchain-
> > > 23Us&d=DwIBAg&c=IL_XqQWOjubgfqINi2jTzg&r=QTEM8ICX7t_SLgWP3qPWtKiw
> > > KMps487LPWQx-
> > > B9AqIc&m=HlHnLJOJRokDA9x9IHxyhvyPOnXIakHUFgofHP7STEQ&s=I1iNIvHcZX
> > > YecfQKFo5HtwyhF7jogVTb-lGzBf0wHFg&e=
> >
> > Looks good.
> >
> > Looking ahead, how does this work with the proposed new build
> > system?
> > Is there an automated way to check new submissions so that new
> > features
> > don't undo this.
> >
> >
> > Acked-by: Stephen Hemminger <stephen@networkplumber.org>
>
> https://urldefense.proofpoint.com/v2/url?u=http-3A__mesonbuild.com_Re
> producible-
> 2Dbuilds.html&d=DwIBAg&c=IL_XqQWOjubgfqINi2jTzg&r=QTEM8ICX7t_SLgWP3qP
> WtKiwKMps487LPWQx-
> B9AqIc&m=HlHnLJOJRokDA9x9IHxyhvyPOnXIakHUFgofHP7STEQ&s=0jXWXi5GtPcmXP
> RIXTNEoD1RhY54ig_799tJp4azboE&e=
>
> I'd hope if we switch build system, this shouldn't be a problem. It's
> definitely something to watch out for.
>
> /Bruce
Meson claims support for reproducible builds by default:
http://mesonbuild.com/Reproducible-builds.html
I am not very familiar with it, but I assume it means stable
input/output to makefiles (list of sources/headers/objects etc).
The most common cause for unreproducibility is usually embedding build
timestamps - it was not the case for DPDK, but it might happen in the
future, and it's worth keeping in mind.
In general anything that uses find or wildcard to build lists (as
opposed as a boolean - if <wildcard> exists; then) might cause
problems.
In terms of testing, Debian has setup a pretty good automated CI
system:
https://tests.reproducible-builds.org/debian/reproducible.html
DPDK's page:
https://tests.reproducible-builds.org/debian/rb-pkg/unstable/amd64/dpdk
.html
Every time we do an upload it will be tested there.
--
Kind regards,
Luca Boccassi
^ permalink raw reply [flat|nested] 65+ messages in thread
* Re: [dpdk-dev] [PATCH v4 0/6] Reproducible build
2017-06-28 16:04 ` Bruce Richardson
2017-06-28 17:52 ` Luca Boccassi
@ 2017-08-11 12:43 ` Luca Boccassi
1 sibling, 0 replies; 65+ messages in thread
From: Luca Boccassi @ 2017-08-11 12:43 UTC (permalink / raw)
To: Bruce Richardson, Stephen Hemminger; +Cc: dev
On Wed, 2017-06-28 at 17:04 +0100, Bruce Richardson wrote:
> On Wed, Jun 28, 2017 at 08:57:33AM -0700, Stephen Hemminger wrote:
> > On Wed, 28 Jun 2017 14:56:56 +0100
> > <lboccass@brocade.com> wrote:
> >
> > > From: Luca Boccassi <luca.boccassi@gmail.com>
> > >
> > > In the past couple of years a concerted effort among almost all
> > > Linux
> > > distros has been striving toward achieving reproducible builds.
> > > [1]
> > > This involves changes to the toolchain, new tools and CI systems.
> > > [2]
> > >
> > > v1 fixed the documentation, examples and linker script
> > > generation.
> > > v2 fixes all problems, which were caused by unstable order of
> > > headers
> > > inclusion, source files listing and object file listing when
> > > passing
> > > them to the compiler.
> > > DPDK's build, at least with the default configuration, is fully
> > > reproducible with this patch series as tested by the Reproducible
> > > Builds developers experimental toolchain. [3]
> > >
> > > v3 restores the first patch, which was eaten by git send-email.
> > >
> > > v4 drops the patch that reorders rebuilds, and adds a patch to
> > > make
> > > the inclusion of headers deterministic with regards to GCC
> > > embedding
> > > the full file path when expading __FILE__ and when writing the
> > > directory listing in the DWARF objects.
> > > It also drops the first 2 patches which have already been merged.
> > >
> > > [1] https://reproducible-builds.org/
> > > [2] https://reproducible-builds.org/tools/
> > > [3] https://wiki.debian.org/ReproducibleBuilds/ExperimentalToolch
> > > ain#Us
> >
> > Looks good.
> >
> > Looking ahead, how does this work with the proposed new build
> > system?
> > Is there an automated way to check new submissions so that new
> > features
> > don't undo this.
> >
> >
> > Acked-by: Stephen Hemminger <stephen@networkplumber.org>
>
> http://mesonbuild.com/Reproducible-builds.html
>
> I'd hope if we switch build system, this shouldn't be a problem. It's
> definitely something to watch out for.
>
> /Bruce
The one issue to look for, with the current build system, is the CFLAGS
include path order (the last patch) in the makefiles under lib/
The pattern seems to be always the same, would it be possible &
acceptable to add a check in checkpatch?
bad:
CFLAGS += -I$(SRCDIR)
good:
CFLAGS := -I$(SRCDIR) $(CFLAGS)
--
Kind regards,
Luca Boccassi
^ permalink raw reply [flat|nested] 65+ messages in thread
* [dpdk-dev] [PATCH v5 0/6] Reproducible build
2017-06-28 13:56 ` [dpdk-dev] [PATCH v4 0/6] " lboccass
` (6 preceding siblings ...)
2017-06-28 15:57 ` [dpdk-dev] [PATCH v4 0/6] Reproducible build Stephen Hemminger
@ 2017-08-10 18:23 ` luca.boccassi
2017-08-10 18:23 ` [dpdk-dev] [PATCH v5 1/6] mk: sort list of shared objects in linker script luca.boccassi
` (6 more replies)
7 siblings, 7 replies; 65+ messages in thread
From: luca.boccassi @ 2017-08-10 18:23 UTC (permalink / raw)
To: dev; +Cc: Luca Boccassi
From: Luca Boccassi <luca.boccassi@gmail.com>
In the past couple of years a concerted effort among almost all Linux
distros has been striving toward achieving reproducible builds. [1]
This involves changes to the toolchain, new tools and CI systems. [2]
v1 fixed the documentation, examples and linker script generation.
v2 fixes all problems, which were caused by unstable order of headers
inclusion, source files listing and object file listing when passing
them to the compiler.
DPDK's build, at least with the default configuration, is fully
reproducible with this patch series as tested by the Reproducible
Builds developers experimental toolchain. [3]
v3 restores the first patch, which was eaten by git send-email.
v4 drops the patch that reorders rebuilds, and adds a patch to make
the inclusion of headers deterministic with regards to GCC embedding
the full file path when expading __FILE__ and when writing the
directory listing in the DWARF objects.
It also drops the first 2 patches which have already been merged.
v5 adds the -I$(SRCDIR) workaround to librte_eal linuxapp's and
librte_gro's Makefiles.
[1] https://reproducible-builds.org/
[2] https://reproducible-builds.org/tools/
[3] https://wiki.debian.org/ReproducibleBuilds/ExperimentalToolchain#Us
Luca Boccassi (6):
mk: sort list of shared objects in linker script
mk: sort list of files in examples.dox
mk: sort headers before wildcard inclusion
mk: sort source files before passing them to the compiler
mk: sort object files when building deps lists
mk: set -ISCDIR before -IRTE_OUT/include in CFLAGS
drivers/net/cxgbe/Makefile | 2 +-
drivers/net/e1000/Makefile | 2 +-
drivers/net/fm10k/Makefile | 2 +-
drivers/net/i40e/Makefile | 2 +-
drivers/net/ixgbe/Makefile | 2 +-
drivers/net/qede/Makefile | 2 +-
drivers/net/sfc/Makefile | 2 +-
drivers/net/thunderx/Makefile | 2 +-
examples/ip_pipeline/Makefile | 2 +-
examples/multi_process/client_server_mp/mp_server/Makefile | 2 +-
examples/server_node_efd/server/Makefile | 2 +-
lib/librte_acl/Makefile | 10 ++++++++--
lib/librte_bitratestats/Makefile | 9 ++++++++-
lib/librte_cmdline/Makefile | 9 ++++++++-
lib/librte_distributor/Makefile | 10 ++++++++--
lib/librte_eal/common/Makefile | 2 +-
lib/librte_eal/linuxapp/eal/Makefile | 8 +++++++-
lib/librte_efd/Makefile | 10 ++++++++--
lib/librte_gro/Makefile | 9 ++++++++-
lib/librte_hash/Makefile | 10 ++++++++--
lib/librte_ip_frag/Makefile | 10 ++++++++--
lib/librte_jobstats/Makefile | 10 ++++++++--
lib/librte_kni/Makefile | 9 ++++++++-
lib/librte_kvargs/Makefile | 9 ++++++++-
lib/librte_latencystats/Makefile | 9 ++++++++-
lib/librte_lpm/Makefile | 10 ++++++++--
lib/librte_mbuf/Makefile | 9 ++++++++-
lib/librte_mempool/Makefile | 9 ++++++++-
lib/librte_metrics/Makefile | 9 ++++++++-
lib/librte_net/Makefile | 9 ++++++++-
lib/librte_pdump/Makefile | 10 ++++++++--
lib/librte_power/Makefile | 9 ++++++++-
lib/librte_reorder/Makefile | 10 ++++++++--
lib/librte_ring/Makefile | 9 ++++++++-
lib/librte_timer/Makefile | 9 ++++++++-
lib/librte_vhost/Makefile | 9 ++++++++-
mk/rte.app.mk | 4 ++--
mk/rte.combinedlib.mk | 2 +-
mk/rte.hostapp.mk | 4 ++--
mk/rte.sdkdoc.mk | 2 +-
mk/rte.shared.mk | 4 ++--
41 files changed, 211 insertions(+), 53 deletions(-)
--
2.11.0
^ permalink raw reply [flat|nested] 65+ messages in thread
* [dpdk-dev] [PATCH v5 1/6] mk: sort list of shared objects in linker script
2017-08-10 18:23 ` [dpdk-dev] [PATCH v5 " luca.boccassi
@ 2017-08-10 18:23 ` luca.boccassi
2017-08-10 18:23 ` [dpdk-dev] [PATCH v5 2/6] mk: sort list of files in examples.dox luca.boccassi
` (5 subsequent siblings)
6 siblings, 0 replies; 65+ messages in thread
From: luca.boccassi @ 2017-08-10 18:23 UTC (permalink / raw)
To: dev; +Cc: Luca Boccassi
From: Luca Boccassi <luca.boccassi@gmail.com>
The output of wildcard might not be stable and depend on the
filesystem and other factors.
This means the content libdpdk.so linker script might change between
builds from the same sources.
Run the list through sort to ensure reproducibility.
Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
---
mk/rte.combinedlib.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mk/rte.combinedlib.mk b/mk/rte.combinedlib.mk
index 449358b33..2ab7ee8a1 100644
--- a/mk/rte.combinedlib.mk
+++ b/mk/rte.combinedlib.mk
@@ -42,7 +42,7 @@ endif
RTE_LIBNAME := dpdk
COMBINEDLIB := lib$(RTE_LIBNAME)$(EXT)
-LIBS := $(filter-out $(COMBINEDLIB), $(notdir $(wildcard $(RTE_OUTPUT)/lib/*$(EXT))))
+LIBS := $(filter-out $(COMBINEDLIB), $(sort $(notdir $(wildcard $(RTE_OUTPUT)/lib/*$(EXT)))))
all: FORCE
$(Q)echo "GROUP ( $(LIBS) )" > $(RTE_OUTPUT)/lib/$(COMBINEDLIB)
--
2.11.0
^ permalink raw reply [flat|nested] 65+ messages in thread
* [dpdk-dev] [PATCH v5 2/6] mk: sort list of files in examples.dox
2017-08-10 18:23 ` [dpdk-dev] [PATCH v5 " luca.boccassi
2017-08-10 18:23 ` [dpdk-dev] [PATCH v5 1/6] mk: sort list of shared objects in linker script luca.boccassi
@ 2017-08-10 18:23 ` luca.boccassi
2017-08-10 18:23 ` [dpdk-dev] [PATCH v5 3/6] mk: sort headers before wildcard inclusion luca.boccassi
` (4 subsequent siblings)
6 siblings, 0 replies; 65+ messages in thread
From: luca.boccassi @ 2017-08-10 18:23 UTC (permalink / raw)
To: dev; +Cc: Luca Boccassi
From: Luca Boccassi <luca.boccassi@gmail.com>
The result of find might not be stable depending on external
conditions.
Pipe it through LC_ALL=C sort to ensure reproducible results when
generating examples.dox.
Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
---
mk/rte.sdkdoc.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mk/rte.sdkdoc.mk b/mk/rte.sdkdoc.mk
index c0eaa3502..de31b78cf 100644
--- a/mk/rte.sdkdoc.mk
+++ b/mk/rte.sdkdoc.mk
@@ -93,7 +93,7 @@ $(API_EXAMPLES): api-html-clean
$(Q)mkdir -p $(@D)
@printf '/**\n' > $(API_EXAMPLES)
@printf '@page examples DPDK Example Programs\n\n' >> $(API_EXAMPLES)
- @find examples -type f -name '*.c' -printf '@example %p\n' >> $(API_EXAMPLES)
+ @find examples -type f -name '*.c' -printf '@example %p\n' | LC_ALL=C sort >> $(API_EXAMPLES)
@printf '*/\n' >> $(API_EXAMPLES)
guides-pdf-clean: guides-pdf-img-clean
--
2.11.0
^ permalink raw reply [flat|nested] 65+ messages in thread
* [dpdk-dev] [PATCH v5 3/6] mk: sort headers before wildcard inclusion
2017-08-10 18:23 ` [dpdk-dev] [PATCH v5 " luca.boccassi
2017-08-10 18:23 ` [dpdk-dev] [PATCH v5 1/6] mk: sort list of shared objects in linker script luca.boccassi
2017-08-10 18:23 ` [dpdk-dev] [PATCH v5 2/6] mk: sort list of files in examples.dox luca.boccassi
@ 2017-08-10 18:23 ` luca.boccassi
2017-08-10 18:23 ` [dpdk-dev] [PATCH v5 4/6] mk: sort source files before passing them to the compiler luca.boccassi
` (3 subsequent siblings)
6 siblings, 0 replies; 65+ messages in thread
From: luca.boccassi @ 2017-08-10 18:23 UTC (permalink / raw)
To: dev; +Cc: Luca Boccassi
From: Luca Boccassi <luca.boccassi@gmail.com>
In order to achieve fully reproducible builds, always use the same
inclusion order for headers in the Makefiles.
Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
---
examples/ip_pipeline/Makefile | 2 +-
examples/multi_process/client_server_mp/mp_server/Makefile | 2 +-
examples/server_node_efd/server/Makefile | 2 +-
lib/librte_eal/common/Makefile | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile
index dc7e0ddd7..12ce0a1d5 100644
--- a/examples/ip_pipeline/Makefile
+++ b/examples/ip_pipeline/Makefile
@@ -43,7 +43,7 @@ APP = ip_pipeline
VPATH += $(SRCDIR)/pipeline
-INC += $(wildcard *.h) $(wildcard pipeline/*.h)
+INC += $(sort $(wildcard *.h)) $(sort $(wildcard pipeline/*.h))
# all source are stored in SRCS-y
SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) := main.c
diff --git a/examples/multi_process/client_server_mp/mp_server/Makefile b/examples/multi_process/client_server_mp/mp_server/Makefile
index 5552999b5..160c17b68 100644
--- a/examples/multi_process/client_server_mp/mp_server/Makefile
+++ b/examples/multi_process/client_server_mp/mp_server/Makefile
@@ -49,7 +49,7 @@ APP = mp_server
# all source are stored in SRCS-y
SRCS-y := main.c init.c args.c
-INC := $(wildcard *.h)
+INC := $(sort $(wildcard *.h))
CFLAGS += $(WERROR_FLAGS) -O3
CFLAGS += -I$(SRCDIR)/../shared
diff --git a/examples/server_node_efd/server/Makefile b/examples/server_node_efd/server/Makefile
index a2f2f361b..9f1fe2894 100644
--- a/examples/server_node_efd/server/Makefile
+++ b/examples/server_node_efd/server/Makefile
@@ -49,7 +49,7 @@ APP = server
# all source are stored in SRCS-y
SRCS-y := main.c init.c args.c
-INC := $(wildcard *.h)
+INC := $(sort $(wildcard *.h))
CFLAGS += $(WERROR_FLAGS) -O3
CFLAGS += -I$(SRCDIR)/../shared
diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile
index e8fd67a27..4e6baaa72 100644
--- a/lib/librte_eal/common/Makefile
+++ b/lib/librte_eal/common/Makefile
@@ -49,7 +49,7 @@ GENERIC_INC += rte_vect.h rte_pause.h rte_io.h
# defined in mk/arch/$(RTE_ARCH)/rte.vars.mk
ARCH_DIR ?= $(RTE_ARCH)
-ARCH_INC := $(notdir $(wildcard $(RTE_SDK)/lib/librte_eal/common/include/arch/$(ARCH_DIR)/*.h))
+ARCH_INC := $(sort $(notdir $(wildcard $(RTE_SDK)/lib/librte_eal/common/include/arch/$(ARCH_DIR)/*.h)))
SYMLINK-$(CONFIG_RTE_LIBRTE_EAL)-include := $(addprefix include/,$(INC))
SYMLINK-$(CONFIG_RTE_LIBRTE_EAL)-include += \
--
2.11.0
^ permalink raw reply [flat|nested] 65+ messages in thread
* [dpdk-dev] [PATCH v5 4/6] mk: sort source files before passing them to the compiler
2017-08-10 18:23 ` [dpdk-dev] [PATCH v5 " luca.boccassi
` (2 preceding siblings ...)
2017-08-10 18:23 ` [dpdk-dev] [PATCH v5 3/6] mk: sort headers before wildcard inclusion luca.boccassi
@ 2017-08-10 18:23 ` luca.boccassi
2017-08-10 18:23 ` [dpdk-dev] [PATCH v5 5/6] mk: sort object files when building deps lists luca.boccassi
` (2 subsequent siblings)
6 siblings, 0 replies; 65+ messages in thread
From: luca.boccassi @ 2017-08-10 18:23 UTC (permalink / raw)
To: dev; +Cc: Luca Boccassi
From: Luca Boccassi <luca.boccassi@gmail.com>
In order to achieve reproducible builds, always use the same
order when listing files for compilation.
Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
---
drivers/net/cxgbe/Makefile | 2 +-
drivers/net/e1000/Makefile | 2 +-
drivers/net/fm10k/Makefile | 2 +-
drivers/net/i40e/Makefile | 2 +-
drivers/net/ixgbe/Makefile | 2 +-
drivers/net/qede/Makefile | 2 +-
drivers/net/sfc/Makefile | 2 +-
drivers/net/thunderx/Makefile | 2 +-
8 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/net/cxgbe/Makefile b/drivers/net/cxgbe/Makefile
index 7cef6279c..b4666b5af 100644
--- a/drivers/net/cxgbe/Makefile
+++ b/drivers/net/cxgbe/Makefile
@@ -67,7 +67,7 @@ endif
# Add extra flags for base driver files (also known as shared code)
# to disable warnings in them
#
-BASE_DRIVER_OBJS=$(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c)))
+BASE_DRIVER_OBJS=$(sort $(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c))))
$(foreach obj, $(BASE_DRIVER_OBJS), $(eval CFLAGS_$(obj)+=$(CFLAGS_BASE_DRIVER)))
VPATH += $(SRCDIR)/base
diff --git a/drivers/net/e1000/Makefile b/drivers/net/e1000/Makefile
index ffdf36d37..59d96bca1 100644
--- a/drivers/net/e1000/Makefile
+++ b/drivers/net/e1000/Makefile
@@ -68,7 +68,7 @@ endif
# Add extra flags for base driver files (also known as shared code)
# to disable warnings in them
#
-BASE_DRIVER_OBJS=$(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c)))
+BASE_DRIVER_OBJS=$(sort $(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c))))
$(foreach obj, $(BASE_DRIVER_OBJS), $(eval CFLAGS_$(obj)+=$(CFLAGS_BASE_DRIVER)))
VPATH += $(SRCDIR)/base
diff --git a/drivers/net/fm10k/Makefile b/drivers/net/fm10k/Makefile
index e0024f052..0bc124eb1 100644
--- a/drivers/net/fm10k/Makefile
+++ b/drivers/net/fm10k/Makefile
@@ -80,7 +80,7 @@ endif
#
# Add extra flags for base driver source files to disable warnings in them
#
-BASE_DRIVER_OBJS=$(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c)))
+BASE_DRIVER_OBJS=$(sort $(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c))))
$(foreach obj, $(BASE_DRIVER_OBJS), $(eval CFLAGS_$(obj)+=$(CFLAGS_BASE_DRIVER)))
VPATH += $(SRCDIR)/base
diff --git a/drivers/net/i40e/Makefile b/drivers/net/i40e/Makefile
index 55c79a60a..8040a890e 100644
--- a/drivers/net/i40e/Makefile
+++ b/drivers/net/i40e/Makefile
@@ -78,7 +78,7 @@ endif
CFLAGS_i40e_lan_hmc.o += -Wno-error
endif
-OBJS_BASE_DRIVER=$(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c)))
+OBJS_BASE_DRIVER=$(sort $(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c))))
$(foreach obj, $(OBJS_BASE_DRIVER), $(eval CFLAGS_$(obj)+=$(CFLAGS_BASE_DRIVER)))
VPATH += $(SRCDIR)/base
diff --git a/drivers/net/ixgbe/Makefile b/drivers/net/ixgbe/Makefile
index 5e57cb353..d47ce24aa 100644
--- a/drivers/net/ixgbe/Makefile
+++ b/drivers/net/ixgbe/Makefile
@@ -87,7 +87,7 @@ endif
# Add extra flags for base driver files (also known as shared code)
# to disable warnings in them
#
-BASE_DRIVER_OBJS=$(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c)))
+BASE_DRIVER_OBJS=$(sort $(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c))))
$(foreach obj, $(BASE_DRIVER_OBJS), $(eval CFLAGS_$(obj)+=$(CFLAGS_BASE_DRIVER)))
VPATH += $(SRCDIR)/base
diff --git a/drivers/net/qede/Makefile b/drivers/net/qede/Makefile
index f03441d9a..83ff95474 100644
--- a/drivers/net/qede/Makefile
+++ b/drivers/net/qede/Makefile
@@ -78,7 +78,7 @@ endif
# to disable warnings in them
#
#
-BASE_DRIVER_OBJS=$(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c)))
+BASE_DRIVER_OBJS=$(sort $(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c))))
$(foreach obj, $(BASE_DRIVER_OBJS), $(eval CFLAGS_$(obj)+=$(CFLAGS_BASE_DRIVER)))
VPATH += $(SRCDIR)/base
diff --git a/drivers/net/sfc/Makefile b/drivers/net/sfc/Makefile
index 57aa963ba..8cfd14d45 100644
--- a/drivers/net/sfc/Makefile
+++ b/drivers/net/sfc/Makefile
@@ -71,7 +71,7 @@ endif
# List of base driver object files for which
# special CFLAGS above should be applied
#
-BASE_DRIVER_OBJS=$(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c)))
+BASE_DRIVER_OBJS=$(sort $(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c))))
$(foreach obj, $(BASE_DRIVER_OBJS), \
$(eval CFLAGS_$(obj)+=$(CFLAGS_BASE_DRIVER)))
diff --git a/drivers/net/thunderx/Makefile b/drivers/net/thunderx/Makefile
index 915ae945a..a2b6caae2 100644
--- a/drivers/net/thunderx/Makefile
+++ b/drivers/net/thunderx/Makefile
@@ -45,7 +45,7 @@ EXPORT_MAP := rte_pmd_thunderx_nicvf_version.map
LIBABIVER := 1
-OBJS_BASE_DRIVER=$(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c)))
+OBJS_BASE_DRIVER=$(sort $(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c))))
$(foreach obj, $(OBJS_BASE_DRIVER), $(eval CFLAGS_$(obj)+=$(CFLAGS_BASE_DRIVER)))
VPATH += $(SRCDIR)/base
--
2.11.0
^ permalink raw reply [flat|nested] 65+ messages in thread
* [dpdk-dev] [PATCH v5 5/6] mk: sort object files when building deps lists
2017-08-10 18:23 ` [dpdk-dev] [PATCH v5 " luca.boccassi
` (3 preceding siblings ...)
2017-08-10 18:23 ` [dpdk-dev] [PATCH v5 4/6] mk: sort source files before passing them to the compiler luca.boccassi
@ 2017-08-10 18:23 ` luca.boccassi
2017-08-10 18:23 ` [dpdk-dev] [PATCH v5 6/6] mk: set -ISCDIR before -IRTE_OUT/include in CFLAGS luca.boccassi
2017-08-18 11:03 ` [dpdk-dev] [PATCH v6 0/6] Reproducible build luca.boccassi
6 siblings, 0 replies; 65+ messages in thread
From: luca.boccassi @ 2017-08-10 18:23 UTC (permalink / raw)
To: dev; +Cc: Luca Boccassi
From: Luca Boccassi <luca.boccassi@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@gmail.com>
---
mk/rte.app.mk | 4 ++--
mk/rte.hostapp.mk | 4 ++--
mk/rte.shared.mk | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index c25fdd9f5..c5b8c1ead 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -270,8 +270,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)))))
#
# Compile executable file if needed
diff --git a/mk/rte.hostapp.mk b/mk/rte.hostapp.mk
index 5cb4909cb..f58173c31 100644
--- a/mk/rte.hostapp.mk
+++ b/mk/rte.hostapp.mk
@@ -69,9 +69,9 @@ O_TO_EXE_DO = @set -e; \
-include .$(HOSTAPP).cmd
# list of .a files that are linked to this application
-LDLIBS_FILES := $(wildcard \
+LDLIBS_FILES := $(sort $(wildcard \
$(addprefix $(RTE_OUTPUT)/lib/, \
- $(patsubst -l%,lib%.a,$(filter -l%,$(LDLIBS)))))
+ $(patsubst -l%,lib%.a,$(filter -l%,$(LDLIBS))))))
#
# Compile executable file if needed
diff --git a/mk/rte.shared.mk b/mk/rte.shared.mk
index 87ccf0ba4..4e680bc03 100644
--- a/mk/rte.shared.mk
+++ b/mk/rte.shared.mk
@@ -85,8 +85,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)))))
#
# Archive objects in .so file if needed
--
2.11.0
^ permalink raw reply [flat|nested] 65+ messages in thread
* [dpdk-dev] [PATCH v5 6/6] mk: set -ISCDIR before -IRTE_OUT/include in CFLAGS
2017-08-10 18:23 ` [dpdk-dev] [PATCH v5 " luca.boccassi
` (4 preceding siblings ...)
2017-08-10 18:23 ` [dpdk-dev] [PATCH v5 5/6] mk: sort object files when building deps lists luca.boccassi
@ 2017-08-10 18:23 ` luca.boccassi
2017-08-18 11:03 ` [dpdk-dev] [PATCH v6 0/6] Reproducible build luca.boccassi
6 siblings, 0 replies; 65+ messages in thread
From: luca.boccassi @ 2017-08-10 18:23 UTC (permalink / raw)
To: dev; +Cc: Luca Boccassi
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.
Always pass -ISRCDIR first to CFLAGS so that it's deterministic.
Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
---
lib/librte_acl/Makefile | 10 ++++++++--
lib/librte_bitratestats/Makefile | 9 ++++++++-
lib/librte_cmdline/Makefile | 9 ++++++++-
lib/librte_distributor/Makefile | 10 ++++++++--
lib/librte_eal/linuxapp/eal/Makefile | 8 +++++++-
lib/librte_efd/Makefile | 10 ++++++++--
lib/librte_gro/Makefile | 9 ++++++++-
lib/librte_hash/Makefile | 10 ++++++++--
lib/librte_ip_frag/Makefile | 10 ++++++++--
lib/librte_jobstats/Makefile | 10 ++++++++--
lib/librte_kni/Makefile | 9 ++++++++-
lib/librte_kvargs/Makefile | 9 ++++++++-
lib/librte_latencystats/Makefile | 9 ++++++++-
lib/librte_lpm/Makefile | 10 ++++++++--
lib/librte_mbuf/Makefile | 9 ++++++++-
lib/librte_mempool/Makefile | 9 ++++++++-
lib/librte_metrics/Makefile | 9 ++++++++-
lib/librte_net/Makefile | 9 ++++++++-
lib/librte_pdump/Makefile | 10 ++++++++--
lib/librte_power/Makefile | 9 ++++++++-
lib/librte_reorder/Makefile | 10 ++++++++--
lib/librte_ring/Makefile | 9 ++++++++-
lib/librte_timer/Makefile | 9 ++++++++-
lib/librte_vhost/Makefile | 9 ++++++++-
24 files changed, 191 insertions(+), 33 deletions(-)
diff --git a/lib/librte_acl/Makefile b/lib/librte_acl/Makefile
index 59767920a..bce78813b 100644
--- a/lib/librte_acl/Makefile
+++ b/lib/librte_acl/Makefile
@@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_acl.a
-CFLAGS += -O3
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_acl_version.map
diff --git a/lib/librte_bitratestats/Makefile b/lib/librte_bitratestats/Makefile
index 58a20ea09..26a3f4908 100644
--- a/lib/librte_bitratestats/Makefile
+++ b/lib/librte_bitratestats/Makefile
@@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_bitratestats.a
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_bitratestats_version.map
diff --git a/lib/librte_cmdline/Makefile b/lib/librte_cmdline/Makefile
index 644f68e47..9dd75f2d2 100644
--- a/lib/librte_cmdline/Makefile
+++ b/lib/librte_cmdline/Makefile
@@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_cmdline.a
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_cmdline_version.map
diff --git a/lib/librte_distributor/Makefile b/lib/librte_distributor/Makefile
index b417ee7be..a51d7c8b2 100644
--- a/lib/librte_distributor/Makefile
+++ b/lib/librte_distributor/Makefile
@@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_distributor.a
-CFLAGS += -O3
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_distributor_version.map
diff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile
index 90bca4d68..f5eee1c6a 100644
--- a/lib/librte_eal/linuxapp/eal/Makefile
+++ b/lib/librte_eal/linuxapp/eal/Makefile
@@ -41,7 +41,13 @@ LIBABIVER := 5
VPATH += $(RTE_SDK)/lib/librte_eal/common
-CFLAGS += -I$(SRCDIR)/include
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR)/include $(CFLAGS)
CFLAGS += -I$(RTE_SDK)/lib/librte_eal/common
CFLAGS += -I$(RTE_SDK)/lib/librte_eal/common/include
CFLAGS += $(WERROR_FLAGS) -O3
diff --git a/lib/librte_efd/Makefile b/lib/librte_efd/Makefile
index b9277bc5d..b169e3240 100644
--- a/lib/librte_efd/Makefile
+++ b/lib/librte_efd/Makefile
@@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_efd.a
-CFLAGS += -O3
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_efd_version.map
diff --git a/lib/librte_gro/Makefile b/lib/librte_gro/Makefile
index 747eeec9e..367f78299 100644
--- a/lib/librte_gro/Makefile
+++ b/lib/librte_gro/Makefile
@@ -34,8 +34,15 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_gro.a
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR)/include $(CFLAGS)
CFLAGS += -O3
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
+CFLAGS += $(WERROR_FLAGS)
EXPORT_MAP := rte_gro_version.map
diff --git a/lib/librte_hash/Makefile b/lib/librte_hash/Makefile
index 9cf13a045..677d494e7 100644
--- a/lib/librte_hash/Makefile
+++ b/lib/librte_hash/Makefile
@@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_hash.a
-CFLAGS += -O3
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_hash_version.map
diff --git a/lib/librte_ip_frag/Makefile b/lib/librte_ip_frag/Makefile
index 4e693bf8f..de45ec2d3 100644
--- a/lib/librte_ip_frag/Makefile
+++ b/lib/librte_ip_frag/Makefile
@@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_ip_frag.a
-CFLAGS += -O3
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_ipfrag_version.map
diff --git a/lib/librte_jobstats/Makefile b/lib/librte_jobstats/Makefile
index 561a0678c..57329b18e 100644
--- a/lib/librte_jobstats/Makefile
+++ b/lib/librte_jobstats/Makefile
@@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_jobstats.a
-CFLAGS += -O3
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_jobstats_version.map
diff --git a/lib/librte_kni/Makefile b/lib/librte_kni/Makefile
index 70f1ca8f6..130d6fd74 100644
--- a/lib/librte_kni/Makefile
+++ b/lib/librte_kni/Makefile
@@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_kni.a
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3 -fno-strict-aliasing
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3 -fno-strict-aliasing
EXPORT_MAP := rte_kni_version.map
diff --git a/lib/librte_kvargs/Makefile b/lib/librte_kvargs/Makefile
index 564dd3102..7c332c110 100644
--- a/lib/librte_kvargs/Makefile
+++ b/lib/librte_kvargs/Makefile
@@ -36,7 +36,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_kvargs.a
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_kvargs_version.map
diff --git a/lib/librte_latencystats/Makefile b/lib/librte_latencystats/Makefile
index eaacbb731..46a8ecd34 100644
--- a/lib/librte_latencystats/Makefile
+++ b/lib/librte_latencystats/Makefile
@@ -33,7 +33,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_latencystats.a
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
LDLIBS += -lm
LDLIBS += -lpthread
diff --git a/lib/librte_lpm/Makefile b/lib/librte_lpm/Makefile
index 32be46b3b..6a97fdc97 100644
--- a/lib/librte_lpm/Makefile
+++ b/lib/librte_lpm/Makefile
@@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_lpm.a
-CFLAGS += -O3
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_lpm_version.map
diff --git a/lib/librte_mbuf/Makefile b/lib/librte_mbuf/Makefile
index 548273054..4d51191ee 100644
--- a/lib/librte_mbuf/Makefile
+++ b/lib/librte_mbuf/Makefile
@@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_mbuf.a
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_mbuf_version.map
diff --git a/lib/librte_mempool/Makefile b/lib/librte_mempool/Makefile
index 7b5bdfee7..33678192f 100644
--- a/lib/librte_mempool/Makefile
+++ b/lib/librte_mempool/Makefile
@@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_mempool.a
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_mempool_version.map
diff --git a/lib/librte_metrics/Makefile b/lib/librte_metrics/Makefile
index d4990e839..195bd4d56 100644
--- a/lib/librte_metrics/Makefile
+++ b/lib/librte_metrics/Makefile
@@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_metrics.a
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_metrics_version.map
diff --git a/lib/librte_net/Makefile b/lib/librte_net/Makefile
index 56727c4df..a08a7dd8b 100644
--- a/lib/librte_net/Makefile
+++ b/lib/librte_net/Makefile
@@ -33,7 +33,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
LIB = librte_net.a
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_net_version.map
LIBABIVER := 1
diff --git a/lib/librte_pdump/Makefile b/lib/librte_pdump/Makefile
index 1c03bcbb7..8923d7499 100644
--- a/lib/librte_pdump/Makefile
+++ b/lib/librte_pdump/Makefile
@@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_pdump.a
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
-CFLAGS += -D_GNU_SOURCE
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3 -D_GNU_SOURCE
LDLIBS += -lpthread
EXPORT_MAP := rte_pdump_version.map
diff --git a/lib/librte_power/Makefile b/lib/librte_power/Makefile
index 06cd10e86..b76ad689e 100644
--- a/lib/librte_power/Makefile
+++ b/lib/librte_power/Makefile
@@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_power.a
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3 -fno-strict-aliasing
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3 -fno-strict-aliasing
EXPORT_MAP := rte_power_version.map
diff --git a/lib/librte_reorder/Makefile b/lib/librte_reorder/Makefile
index 4e44e72f0..51b5d490d 100644
--- a/lib/librte_reorder/Makefile
+++ b/lib/librte_reorder/Makefile
@@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_reorder.a
-CFLAGS += -O3
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_reorder_version.map
diff --git a/lib/librte_ring/Makefile b/lib/librte_ring/Makefile
index 3e2f4b873..e5248a2c1 100644
--- a/lib/librte_ring/Makefile
+++ b/lib/librte_ring/Makefile
@@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_ring.a
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_ring_version.map
diff --git a/lib/librte_timer/Makefile b/lib/librte_timer/Makefile
index 03a15390e..0c57cc6d3 100644
--- a/lib/librte_timer/Makefile
+++ b/lib/librte_timer/Makefile
@@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_timer.a
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during parallel
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_timer_version.map
diff --git a/lib/librte_vhost/Makefile b/lib/librte_vhost/Makefile
index 4a116fe31..ef0d86990 100644
--- a/lib/librte_vhost/Makefile
+++ b/lib/librte_vhost/Makefile
@@ -38,7 +38,14 @@ EXPORT_MAP := rte_vhost_version.map
LIBABIVER := 4
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3 -D_FILE_OFFSET_BITS=64
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during parallel
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3 -D_FILE_OFFSET_BITS=64
CFLAGS += -I vhost_user
LDLIBS += -lpthread
--
2.11.0
^ permalink raw reply [flat|nested] 65+ messages in thread
* [dpdk-dev] [PATCH v6 0/6] Reproducible build
2017-08-10 18:23 ` [dpdk-dev] [PATCH v5 " luca.boccassi
` (5 preceding siblings ...)
2017-08-10 18:23 ` [dpdk-dev] [PATCH v5 6/6] mk: set -ISCDIR before -IRTE_OUT/include in CFLAGS luca.boccassi
@ 2017-08-18 11:03 ` luca.boccassi
2017-08-18 11:03 ` [dpdk-dev] [PATCH v6 1/6] mk: sort list of shared objects in linker script luca.boccassi
` (5 more replies)
6 siblings, 6 replies; 65+ messages in thread
From: luca.boccassi @ 2017-08-18 11:03 UTC (permalink / raw)
To: dev; +Cc: Luca Boccassi
From: Luca Boccassi <luca.boccassi@gmail.com>
In the past couple of years a concerted effort among almost all Linux
distros has been striving toward achieving reproducible builds. [1]
This involves changes to the toolchain, new tools and CI systems. [2]
v1 fixed the documentation, examples and linker script generation.
v2 fixes all problems, which were caused by unstable order of headers
inclusion, source files listing and object file listing when passing
them to the compiler.
DPDK's build, at least with the default configuration, is fully
reproducible with this patch series as tested by the Reproducible
Builds developers experimental toolchain. [3]
v3 restores the first patch, which was eaten by git send-email.
v4 drops the patch that reorders rebuilds, and adds a patch to make
the inclusion of headers deterministic with regards to GCC embedding
the full file path when expading __FILE__ and when writing the
directory listing in the DWARF objects.
It also drops the first 2 patches which have already been merged.
v5 adds the -I$(SRCDIR) workaround to librte_eal linuxapp's and
librte_gro's Makefiles.
v6 fixes copypasta added in v5 - librte-gro's Makefile should have used
$(SRCDIR) rather than $(SRCDIR)/include.
[1] https://reproducible-builds.org/
[2] https://reproducible-builds.org/tools/
[3] https://wiki.debian.org/ReproducibleBuilds/ExperimentalToolchain#Us
Luca Boccassi (6):
mk: sort list of shared objects in linker script
mk: sort list of files in examples.dox
mk: sort headers before wildcard inclusion
mk: sort source files before passing them to the compiler
mk: sort object files when building deps lists
mk: set -ISCDIR before -IRTE_OUT/include in CFLAGS
drivers/net/cxgbe/Makefile | 2 +-
drivers/net/e1000/Makefile | 2 +-
drivers/net/fm10k/Makefile | 2 +-
drivers/net/i40e/Makefile | 2 +-
drivers/net/ixgbe/Makefile | 2 +-
drivers/net/qede/Makefile | 2 +-
drivers/net/sfc/Makefile | 2 +-
drivers/net/thunderx/Makefile | 2 +-
examples/ip_pipeline/Makefile | 2 +-
examples/multi_process/client_server_mp/mp_server/Makefile | 2 +-
examples/server_node_efd/server/Makefile | 2 +-
lib/librte_acl/Makefile | 10 ++++++++--
lib/librte_bitratestats/Makefile | 9 ++++++++-
lib/librte_cmdline/Makefile | 9 ++++++++-
lib/librte_distributor/Makefile | 10 ++++++++--
lib/librte_eal/common/Makefile | 2 +-
lib/librte_eal/linuxapp/eal/Makefile | 8 +++++++-
lib/librte_efd/Makefile | 10 ++++++++--
lib/librte_gro/Makefile | 9 ++++++++-
lib/librte_hash/Makefile | 10 ++++++++--
lib/librte_ip_frag/Makefile | 10 ++++++++--
lib/librte_jobstats/Makefile | 10 ++++++++--
lib/librte_kni/Makefile | 9 ++++++++-
lib/librte_kvargs/Makefile | 9 ++++++++-
lib/librte_latencystats/Makefile | 9 ++++++++-
lib/librte_lpm/Makefile | 10 ++++++++--
lib/librte_mbuf/Makefile | 9 ++++++++-
lib/librte_mempool/Makefile | 9 ++++++++-
lib/librte_metrics/Makefile | 9 ++++++++-
lib/librte_net/Makefile | 9 ++++++++-
lib/librte_pdump/Makefile | 10 ++++++++--
lib/librte_power/Makefile | 9 ++++++++-
lib/librte_reorder/Makefile | 10 ++++++++--
lib/librte_ring/Makefile | 9 ++++++++-
lib/librte_timer/Makefile | 9 ++++++++-
lib/librte_vhost/Makefile | 9 ++++++++-
mk/rte.app.mk | 4 ++--
mk/rte.combinedlib.mk | 2 +-
mk/rte.hostapp.mk | 4 ++--
mk/rte.sdkdoc.mk | 2 +-
mk/rte.shared.mk | 4 ++--
41 files changed, 211 insertions(+), 53 deletions(-)
--
2.11.0
^ permalink raw reply [flat|nested] 65+ messages in thread
* [dpdk-dev] [PATCH v6 1/6] mk: sort list of shared objects in linker script
2017-08-18 11:03 ` [dpdk-dev] [PATCH v6 0/6] Reproducible build luca.boccassi
@ 2017-08-18 11:03 ` luca.boccassi
2017-08-18 11:03 ` [dpdk-dev] [PATCH v6 2/6] mk: sort list of files in examples.dox luca.boccassi
` (4 subsequent siblings)
5 siblings, 0 replies; 65+ messages in thread
From: luca.boccassi @ 2017-08-18 11:03 UTC (permalink / raw)
To: dev; +Cc: Luca Boccassi
From: Luca Boccassi <luca.boccassi@gmail.com>
The output of wildcard might not be stable and depend on the
filesystem and other factors.
This means the content libdpdk.so linker script might change between
builds from the same sources.
Run the list through sort to ensure reproducibility.
Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
---
mk/rte.combinedlib.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mk/rte.combinedlib.mk b/mk/rte.combinedlib.mk
index 449358b33..2ab7ee8a1 100644
--- a/mk/rte.combinedlib.mk
+++ b/mk/rte.combinedlib.mk
@@ -42,7 +42,7 @@ endif
RTE_LIBNAME := dpdk
COMBINEDLIB := lib$(RTE_LIBNAME)$(EXT)
-LIBS := $(filter-out $(COMBINEDLIB), $(notdir $(wildcard $(RTE_OUTPUT)/lib/*$(EXT))))
+LIBS := $(filter-out $(COMBINEDLIB), $(sort $(notdir $(wildcard $(RTE_OUTPUT)/lib/*$(EXT)))))
all: FORCE
$(Q)echo "GROUP ( $(LIBS) )" > $(RTE_OUTPUT)/lib/$(COMBINEDLIB)
--
2.11.0
^ permalink raw reply [flat|nested] 65+ messages in thread
* [dpdk-dev] [PATCH v6 2/6] mk: sort list of files in examples.dox
2017-08-18 11:03 ` [dpdk-dev] [PATCH v6 0/6] Reproducible build luca.boccassi
2017-08-18 11:03 ` [dpdk-dev] [PATCH v6 1/6] mk: sort list of shared objects in linker script luca.boccassi
@ 2017-08-18 11:03 ` luca.boccassi
2017-08-18 11:03 ` [dpdk-dev] [PATCH v6 3/6] mk: sort headers before wildcard inclusion luca.boccassi
` (3 subsequent siblings)
5 siblings, 0 replies; 65+ messages in thread
From: luca.boccassi @ 2017-08-18 11:03 UTC (permalink / raw)
To: dev; +Cc: Luca Boccassi
From: Luca Boccassi <luca.boccassi@gmail.com>
The result of find might not be stable depending on external
conditions.
Pipe it through LC_ALL=C sort to ensure reproducible results when
generating examples.dox.
Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
---
mk/rte.sdkdoc.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mk/rte.sdkdoc.mk b/mk/rte.sdkdoc.mk
index c0eaa3502..de31b78cf 100644
--- a/mk/rte.sdkdoc.mk
+++ b/mk/rte.sdkdoc.mk
@@ -93,7 +93,7 @@ $(API_EXAMPLES): api-html-clean
$(Q)mkdir -p $(@D)
@printf '/**\n' > $(API_EXAMPLES)
@printf '@page examples DPDK Example Programs\n\n' >> $(API_EXAMPLES)
- @find examples -type f -name '*.c' -printf '@example %p\n' >> $(API_EXAMPLES)
+ @find examples -type f -name '*.c' -printf '@example %p\n' | LC_ALL=C sort >> $(API_EXAMPLES)
@printf '*/\n' >> $(API_EXAMPLES)
guides-pdf-clean: guides-pdf-img-clean
--
2.11.0
^ permalink raw reply [flat|nested] 65+ messages in thread
* [dpdk-dev] [PATCH v6 3/6] mk: sort headers before wildcard inclusion
2017-08-18 11:03 ` [dpdk-dev] [PATCH v6 0/6] Reproducible build luca.boccassi
2017-08-18 11:03 ` [dpdk-dev] [PATCH v6 1/6] mk: sort list of shared objects in linker script luca.boccassi
2017-08-18 11:03 ` [dpdk-dev] [PATCH v6 2/6] mk: sort list of files in examples.dox luca.boccassi
@ 2017-08-18 11:03 ` luca.boccassi
2017-08-18 11:03 ` [dpdk-dev] [PATCH v6 4/6] mk: sort source files before passing them to the compiler luca.boccassi
` (2 subsequent siblings)
5 siblings, 0 replies; 65+ messages in thread
From: luca.boccassi @ 2017-08-18 11:03 UTC (permalink / raw)
To: dev; +Cc: Luca Boccassi
From: Luca Boccassi <luca.boccassi@gmail.com>
In order to achieve fully reproducible builds, always use the same
inclusion order for headers in the Makefiles.
Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
---
examples/ip_pipeline/Makefile | 2 +-
examples/multi_process/client_server_mp/mp_server/Makefile | 2 +-
examples/server_node_efd/server/Makefile | 2 +-
lib/librte_eal/common/Makefile | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/examples/ip_pipeline/Makefile b/examples/ip_pipeline/Makefile
index dc7e0ddd7..12ce0a1d5 100644
--- a/examples/ip_pipeline/Makefile
+++ b/examples/ip_pipeline/Makefile
@@ -43,7 +43,7 @@ APP = ip_pipeline
VPATH += $(SRCDIR)/pipeline
-INC += $(wildcard *.h) $(wildcard pipeline/*.h)
+INC += $(sort $(wildcard *.h)) $(sort $(wildcard pipeline/*.h))
# all source are stored in SRCS-y
SRCS-$(CONFIG_RTE_LIBRTE_PIPELINE) := main.c
diff --git a/examples/multi_process/client_server_mp/mp_server/Makefile b/examples/multi_process/client_server_mp/mp_server/Makefile
index 5552999b5..160c17b68 100644
--- a/examples/multi_process/client_server_mp/mp_server/Makefile
+++ b/examples/multi_process/client_server_mp/mp_server/Makefile
@@ -49,7 +49,7 @@ APP = mp_server
# all source are stored in SRCS-y
SRCS-y := main.c init.c args.c
-INC := $(wildcard *.h)
+INC := $(sort $(wildcard *.h))
CFLAGS += $(WERROR_FLAGS) -O3
CFLAGS += -I$(SRCDIR)/../shared
diff --git a/examples/server_node_efd/server/Makefile b/examples/server_node_efd/server/Makefile
index a2f2f361b..9f1fe2894 100644
--- a/examples/server_node_efd/server/Makefile
+++ b/examples/server_node_efd/server/Makefile
@@ -49,7 +49,7 @@ APP = server
# all source are stored in SRCS-y
SRCS-y := main.c init.c args.c
-INC := $(wildcard *.h)
+INC := $(sort $(wildcard *.h))
CFLAGS += $(WERROR_FLAGS) -O3
CFLAGS += -I$(SRCDIR)/../shared
diff --git a/lib/librte_eal/common/Makefile b/lib/librte_eal/common/Makefile
index e8fd67a27..4e6baaa72 100644
--- a/lib/librte_eal/common/Makefile
+++ b/lib/librte_eal/common/Makefile
@@ -49,7 +49,7 @@ GENERIC_INC += rte_vect.h rte_pause.h rte_io.h
# defined in mk/arch/$(RTE_ARCH)/rte.vars.mk
ARCH_DIR ?= $(RTE_ARCH)
-ARCH_INC := $(notdir $(wildcard $(RTE_SDK)/lib/librte_eal/common/include/arch/$(ARCH_DIR)/*.h))
+ARCH_INC := $(sort $(notdir $(wildcard $(RTE_SDK)/lib/librte_eal/common/include/arch/$(ARCH_DIR)/*.h)))
SYMLINK-$(CONFIG_RTE_LIBRTE_EAL)-include := $(addprefix include/,$(INC))
SYMLINK-$(CONFIG_RTE_LIBRTE_EAL)-include += \
--
2.11.0
^ permalink raw reply [flat|nested] 65+ messages in thread
* [dpdk-dev] [PATCH v6 4/6] mk: sort source files before passing them to the compiler
2017-08-18 11:03 ` [dpdk-dev] [PATCH v6 0/6] Reproducible build luca.boccassi
` (2 preceding siblings ...)
2017-08-18 11:03 ` [dpdk-dev] [PATCH v6 3/6] mk: sort headers before wildcard inclusion luca.boccassi
@ 2017-08-18 11:03 ` luca.boccassi
2017-08-18 11:03 ` [dpdk-dev] [PATCH v6 5/6] mk: sort object files when building deps lists luca.boccassi
2017-08-18 11:03 ` [dpdk-dev] [PATCH v6 6/6] mk: set -ISCDIR before -IRTE_OUT/include in CFLAGS luca.boccassi
5 siblings, 0 replies; 65+ messages in thread
From: luca.boccassi @ 2017-08-18 11:03 UTC (permalink / raw)
To: dev; +Cc: Luca Boccassi
From: Luca Boccassi <luca.boccassi@gmail.com>
In order to achieve reproducible builds, always use the same
order when listing files for compilation.
Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
---
drivers/net/cxgbe/Makefile | 2 +-
drivers/net/e1000/Makefile | 2 +-
drivers/net/fm10k/Makefile | 2 +-
drivers/net/i40e/Makefile | 2 +-
drivers/net/ixgbe/Makefile | 2 +-
drivers/net/qede/Makefile | 2 +-
drivers/net/sfc/Makefile | 2 +-
drivers/net/thunderx/Makefile | 2 +-
8 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/net/cxgbe/Makefile b/drivers/net/cxgbe/Makefile
index 7cef6279c..b4666b5af 100644
--- a/drivers/net/cxgbe/Makefile
+++ b/drivers/net/cxgbe/Makefile
@@ -67,7 +67,7 @@ endif
# Add extra flags for base driver files (also known as shared code)
# to disable warnings in them
#
-BASE_DRIVER_OBJS=$(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c)))
+BASE_DRIVER_OBJS=$(sort $(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c))))
$(foreach obj, $(BASE_DRIVER_OBJS), $(eval CFLAGS_$(obj)+=$(CFLAGS_BASE_DRIVER)))
VPATH += $(SRCDIR)/base
diff --git a/drivers/net/e1000/Makefile b/drivers/net/e1000/Makefile
index ffdf36d37..59d96bca1 100644
--- a/drivers/net/e1000/Makefile
+++ b/drivers/net/e1000/Makefile
@@ -68,7 +68,7 @@ endif
# Add extra flags for base driver files (also known as shared code)
# to disable warnings in them
#
-BASE_DRIVER_OBJS=$(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c)))
+BASE_DRIVER_OBJS=$(sort $(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c))))
$(foreach obj, $(BASE_DRIVER_OBJS), $(eval CFLAGS_$(obj)+=$(CFLAGS_BASE_DRIVER)))
VPATH += $(SRCDIR)/base
diff --git a/drivers/net/fm10k/Makefile b/drivers/net/fm10k/Makefile
index e0024f052..0bc124eb1 100644
--- a/drivers/net/fm10k/Makefile
+++ b/drivers/net/fm10k/Makefile
@@ -80,7 +80,7 @@ endif
#
# Add extra flags for base driver source files to disable warnings in them
#
-BASE_DRIVER_OBJS=$(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c)))
+BASE_DRIVER_OBJS=$(sort $(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c))))
$(foreach obj, $(BASE_DRIVER_OBJS), $(eval CFLAGS_$(obj)+=$(CFLAGS_BASE_DRIVER)))
VPATH += $(SRCDIR)/base
diff --git a/drivers/net/i40e/Makefile b/drivers/net/i40e/Makefile
index 55c79a60a..8040a890e 100644
--- a/drivers/net/i40e/Makefile
+++ b/drivers/net/i40e/Makefile
@@ -78,7 +78,7 @@ endif
CFLAGS_i40e_lan_hmc.o += -Wno-error
endif
-OBJS_BASE_DRIVER=$(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c)))
+OBJS_BASE_DRIVER=$(sort $(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c))))
$(foreach obj, $(OBJS_BASE_DRIVER), $(eval CFLAGS_$(obj)+=$(CFLAGS_BASE_DRIVER)))
VPATH += $(SRCDIR)/base
diff --git a/drivers/net/ixgbe/Makefile b/drivers/net/ixgbe/Makefile
index 5e57cb353..d47ce24aa 100644
--- a/drivers/net/ixgbe/Makefile
+++ b/drivers/net/ixgbe/Makefile
@@ -87,7 +87,7 @@ endif
# Add extra flags for base driver files (also known as shared code)
# to disable warnings in them
#
-BASE_DRIVER_OBJS=$(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c)))
+BASE_DRIVER_OBJS=$(sort $(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c))))
$(foreach obj, $(BASE_DRIVER_OBJS), $(eval CFLAGS_$(obj)+=$(CFLAGS_BASE_DRIVER)))
VPATH += $(SRCDIR)/base
diff --git a/drivers/net/qede/Makefile b/drivers/net/qede/Makefile
index f03441d9a..83ff95474 100644
--- a/drivers/net/qede/Makefile
+++ b/drivers/net/qede/Makefile
@@ -78,7 +78,7 @@ endif
# to disable warnings in them
#
#
-BASE_DRIVER_OBJS=$(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c)))
+BASE_DRIVER_OBJS=$(sort $(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c))))
$(foreach obj, $(BASE_DRIVER_OBJS), $(eval CFLAGS_$(obj)+=$(CFLAGS_BASE_DRIVER)))
VPATH += $(SRCDIR)/base
diff --git a/drivers/net/sfc/Makefile b/drivers/net/sfc/Makefile
index 57aa963ba..8cfd14d45 100644
--- a/drivers/net/sfc/Makefile
+++ b/drivers/net/sfc/Makefile
@@ -71,7 +71,7 @@ endif
# List of base driver object files for which
# special CFLAGS above should be applied
#
-BASE_DRIVER_OBJS=$(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c)))
+BASE_DRIVER_OBJS=$(sort $(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c))))
$(foreach obj, $(BASE_DRIVER_OBJS), \
$(eval CFLAGS_$(obj)+=$(CFLAGS_BASE_DRIVER)))
diff --git a/drivers/net/thunderx/Makefile b/drivers/net/thunderx/Makefile
index 915ae945a..a2b6caae2 100644
--- a/drivers/net/thunderx/Makefile
+++ b/drivers/net/thunderx/Makefile
@@ -45,7 +45,7 @@ EXPORT_MAP := rte_pmd_thunderx_nicvf_version.map
LIBABIVER := 1
-OBJS_BASE_DRIVER=$(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c)))
+OBJS_BASE_DRIVER=$(sort $(patsubst %.c,%.o,$(notdir $(wildcard $(SRCDIR)/base/*.c))))
$(foreach obj, $(OBJS_BASE_DRIVER), $(eval CFLAGS_$(obj)+=$(CFLAGS_BASE_DRIVER)))
VPATH += $(SRCDIR)/base
--
2.11.0
^ permalink raw reply [flat|nested] 65+ messages in thread
* [dpdk-dev] [PATCH v6 5/6] mk: sort object files when building deps lists
2017-08-18 11:03 ` [dpdk-dev] [PATCH v6 0/6] Reproducible build luca.boccassi
` (3 preceding siblings ...)
2017-08-18 11:03 ` [dpdk-dev] [PATCH v6 4/6] mk: sort source files before passing them to the compiler luca.boccassi
@ 2017-08-18 11:03 ` luca.boccassi
2017-08-18 11:03 ` [dpdk-dev] [PATCH v6 6/6] mk: set -ISCDIR before -IRTE_OUT/include in CFLAGS luca.boccassi
5 siblings, 0 replies; 65+ messages in thread
From: luca.boccassi @ 2017-08-18 11:03 UTC (permalink / raw)
To: dev; +Cc: Luca Boccassi
From: Luca Boccassi <luca.boccassi@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@gmail.com>
---
mk/rte.app.mk | 4 ++--
mk/rte.hostapp.mk | 4 ++--
mk/rte.shared.mk | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index c25fdd9f5..c5b8c1ead 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -270,8 +270,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)))))
#
# Compile executable file if needed
diff --git a/mk/rte.hostapp.mk b/mk/rte.hostapp.mk
index 5cb4909cb..f58173c31 100644
--- a/mk/rte.hostapp.mk
+++ b/mk/rte.hostapp.mk
@@ -69,9 +69,9 @@ O_TO_EXE_DO = @set -e; \
-include .$(HOSTAPP).cmd
# list of .a files that are linked to this application
-LDLIBS_FILES := $(wildcard \
+LDLIBS_FILES := $(sort $(wildcard \
$(addprefix $(RTE_OUTPUT)/lib/, \
- $(patsubst -l%,lib%.a,$(filter -l%,$(LDLIBS)))))
+ $(patsubst -l%,lib%.a,$(filter -l%,$(LDLIBS))))))
#
# Compile executable file if needed
diff --git a/mk/rte.shared.mk b/mk/rte.shared.mk
index 87ccf0ba4..4e680bc03 100644
--- a/mk/rte.shared.mk
+++ b/mk/rte.shared.mk
@@ -85,8 +85,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)))))
#
# Archive objects in .so file if needed
--
2.11.0
^ permalink raw reply [flat|nested] 65+ messages in thread
* [dpdk-dev] [PATCH v6 6/6] mk: set -ISCDIR before -IRTE_OUT/include in CFLAGS
2017-08-18 11:03 ` [dpdk-dev] [PATCH v6 0/6] Reproducible build luca.boccassi
` (4 preceding siblings ...)
2017-08-18 11:03 ` [dpdk-dev] [PATCH v6 5/6] mk: sort object files when building deps lists luca.boccassi
@ 2017-08-18 11:03 ` luca.boccassi
5 siblings, 0 replies; 65+ messages in thread
From: luca.boccassi @ 2017-08-18 11:03 UTC (permalink / raw)
To: dev; +Cc: Luca Boccassi
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.
Always pass -ISRCDIR first to CFLAGS so that it's deterministic.
Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
---
lib/librte_acl/Makefile | 10 ++++++++--
lib/librte_bitratestats/Makefile | 9 ++++++++-
lib/librte_cmdline/Makefile | 9 ++++++++-
lib/librte_distributor/Makefile | 10 ++++++++--
lib/librte_eal/linuxapp/eal/Makefile | 8 +++++++-
lib/librte_efd/Makefile | 10 ++++++++--
lib/librte_gro/Makefile | 9 ++++++++-
lib/librte_hash/Makefile | 10 ++++++++--
lib/librte_ip_frag/Makefile | 10 ++++++++--
lib/librte_jobstats/Makefile | 10 ++++++++--
lib/librte_kni/Makefile | 9 ++++++++-
lib/librte_kvargs/Makefile | 9 ++++++++-
lib/librte_latencystats/Makefile | 9 ++++++++-
lib/librte_lpm/Makefile | 10 ++++++++--
lib/librte_mbuf/Makefile | 9 ++++++++-
lib/librte_mempool/Makefile | 9 ++++++++-
lib/librte_metrics/Makefile | 9 ++++++++-
lib/librte_net/Makefile | 9 ++++++++-
lib/librte_pdump/Makefile | 10 ++++++++--
lib/librte_power/Makefile | 9 ++++++++-
lib/librte_reorder/Makefile | 10 ++++++++--
lib/librte_ring/Makefile | 9 ++++++++-
lib/librte_timer/Makefile | 9 ++++++++-
lib/librte_vhost/Makefile | 9 ++++++++-
24 files changed, 191 insertions(+), 33 deletions(-)
diff --git a/lib/librte_acl/Makefile b/lib/librte_acl/Makefile
index 59767920a..bce78813b 100644
--- a/lib/librte_acl/Makefile
+++ b/lib/librte_acl/Makefile
@@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_acl.a
-CFLAGS += -O3
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_acl_version.map
diff --git a/lib/librte_bitratestats/Makefile b/lib/librte_bitratestats/Makefile
index 58a20ea09..26a3f4908 100644
--- a/lib/librte_bitratestats/Makefile
+++ b/lib/librte_bitratestats/Makefile
@@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_bitratestats.a
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_bitratestats_version.map
diff --git a/lib/librte_cmdline/Makefile b/lib/librte_cmdline/Makefile
index 644f68e47..9dd75f2d2 100644
--- a/lib/librte_cmdline/Makefile
+++ b/lib/librte_cmdline/Makefile
@@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_cmdline.a
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_cmdline_version.map
diff --git a/lib/librte_distributor/Makefile b/lib/librte_distributor/Makefile
index b417ee7be..a51d7c8b2 100644
--- a/lib/librte_distributor/Makefile
+++ b/lib/librte_distributor/Makefile
@@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_distributor.a
-CFLAGS += -O3
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_distributor_version.map
diff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile
index 90bca4d68..f5eee1c6a 100644
--- a/lib/librte_eal/linuxapp/eal/Makefile
+++ b/lib/librte_eal/linuxapp/eal/Makefile
@@ -41,7 +41,13 @@ LIBABIVER := 5
VPATH += $(RTE_SDK)/lib/librte_eal/common
-CFLAGS += -I$(SRCDIR)/include
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR)/include $(CFLAGS)
CFLAGS += -I$(RTE_SDK)/lib/librte_eal/common
CFLAGS += -I$(RTE_SDK)/lib/librte_eal/common/include
CFLAGS += $(WERROR_FLAGS) -O3
diff --git a/lib/librte_efd/Makefile b/lib/librte_efd/Makefile
index b9277bc5d..b169e3240 100644
--- a/lib/librte_efd/Makefile
+++ b/lib/librte_efd/Makefile
@@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_efd.a
-CFLAGS += -O3
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_efd_version.map
diff --git a/lib/librte_gro/Makefile b/lib/librte_gro/Makefile
index 747eeec9e..4a9f12d85 100644
--- a/lib/librte_gro/Makefile
+++ b/lib/librte_gro/Makefile
@@ -34,8 +34,15 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_gro.a
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
CFLAGS += -O3
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
+CFLAGS += $(WERROR_FLAGS)
EXPORT_MAP := rte_gro_version.map
diff --git a/lib/librte_hash/Makefile b/lib/librte_hash/Makefile
index 9cf13a045..677d494e7 100644
--- a/lib/librte_hash/Makefile
+++ b/lib/librte_hash/Makefile
@@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_hash.a
-CFLAGS += -O3
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_hash_version.map
diff --git a/lib/librte_ip_frag/Makefile b/lib/librte_ip_frag/Makefile
index 4e693bf8f..de45ec2d3 100644
--- a/lib/librte_ip_frag/Makefile
+++ b/lib/librte_ip_frag/Makefile
@@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_ip_frag.a
-CFLAGS += -O3
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_ipfrag_version.map
diff --git a/lib/librte_jobstats/Makefile b/lib/librte_jobstats/Makefile
index 561a0678c..57329b18e 100644
--- a/lib/librte_jobstats/Makefile
+++ b/lib/librte_jobstats/Makefile
@@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_jobstats.a
-CFLAGS += -O3
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_jobstats_version.map
diff --git a/lib/librte_kni/Makefile b/lib/librte_kni/Makefile
index 70f1ca8f6..130d6fd74 100644
--- a/lib/librte_kni/Makefile
+++ b/lib/librte_kni/Makefile
@@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_kni.a
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3 -fno-strict-aliasing
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3 -fno-strict-aliasing
EXPORT_MAP := rte_kni_version.map
diff --git a/lib/librte_kvargs/Makefile b/lib/librte_kvargs/Makefile
index 564dd3102..7c332c110 100644
--- a/lib/librte_kvargs/Makefile
+++ b/lib/librte_kvargs/Makefile
@@ -36,7 +36,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_kvargs.a
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_kvargs_version.map
diff --git a/lib/librte_latencystats/Makefile b/lib/librte_latencystats/Makefile
index eaacbb731..46a8ecd34 100644
--- a/lib/librte_latencystats/Makefile
+++ b/lib/librte_latencystats/Makefile
@@ -33,7 +33,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_latencystats.a
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
LDLIBS += -lm
LDLIBS += -lpthread
diff --git a/lib/librte_lpm/Makefile b/lib/librte_lpm/Makefile
index 32be46b3b..6a97fdc97 100644
--- a/lib/librte_lpm/Makefile
+++ b/lib/librte_lpm/Makefile
@@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_lpm.a
-CFLAGS += -O3
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_lpm_version.map
diff --git a/lib/librte_mbuf/Makefile b/lib/librte_mbuf/Makefile
index 548273054..4d51191ee 100644
--- a/lib/librte_mbuf/Makefile
+++ b/lib/librte_mbuf/Makefile
@@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_mbuf.a
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_mbuf_version.map
diff --git a/lib/librte_mempool/Makefile b/lib/librte_mempool/Makefile
index 7b5bdfee7..33678192f 100644
--- a/lib/librte_mempool/Makefile
+++ b/lib/librte_mempool/Makefile
@@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_mempool.a
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_mempool_version.map
diff --git a/lib/librte_metrics/Makefile b/lib/librte_metrics/Makefile
index d4990e839..195bd4d56 100644
--- a/lib/librte_metrics/Makefile
+++ b/lib/librte_metrics/Makefile
@@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_metrics.a
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_metrics_version.map
diff --git a/lib/librte_net/Makefile b/lib/librte_net/Makefile
index 56727c4df..a08a7dd8b 100644
--- a/lib/librte_net/Makefile
+++ b/lib/librte_net/Makefile
@@ -33,7 +33,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
LIB = librte_net.a
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_net_version.map
LIBABIVER := 1
diff --git a/lib/librte_pdump/Makefile b/lib/librte_pdump/Makefile
index 1c03bcbb7..8923d7499 100644
--- a/lib/librte_pdump/Makefile
+++ b/lib/librte_pdump/Makefile
@@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_pdump.a
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
-CFLAGS += -D_GNU_SOURCE
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3 -D_GNU_SOURCE
LDLIBS += -lpthread
EXPORT_MAP := rte_pdump_version.map
diff --git a/lib/librte_power/Makefile b/lib/librte_power/Makefile
index 06cd10e86..b76ad689e 100644
--- a/lib/librte_power/Makefile
+++ b/lib/librte_power/Makefile
@@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_power.a
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3 -fno-strict-aliasing
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3 -fno-strict-aliasing
EXPORT_MAP := rte_power_version.map
diff --git a/lib/librte_reorder/Makefile b/lib/librte_reorder/Makefile
index 4e44e72f0..51b5d490d 100644
--- a/lib/librte_reorder/Makefile
+++ b/lib/librte_reorder/Makefile
@@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_reorder.a
-CFLAGS += -O3
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_reorder_version.map
diff --git a/lib/librte_ring/Makefile b/lib/librte_ring/Makefile
index 3e2f4b873..e5248a2c1 100644
--- a/lib/librte_ring/Makefile
+++ b/lib/librte_ring/Makefile
@@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_ring.a
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during paralle
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_ring_version.map
diff --git a/lib/librte_timer/Makefile b/lib/librte_timer/Makefile
index 03a15390e..0c57cc6d3 100644
--- a/lib/librte_timer/Makefile
+++ b/lib/librte_timer/Makefile
@@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
# library name
LIB = librte_timer.a
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during parallel
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3
EXPORT_MAP := rte_timer_version.map
diff --git a/lib/librte_vhost/Makefile b/lib/librte_vhost/Makefile
index 4a116fe31..ef0d86990 100644
--- a/lib/librte_vhost/Makefile
+++ b/lib/librte_vhost/Makefile
@@ -38,7 +38,14 @@ EXPORT_MAP := rte_vhost_version.map
LIBABIVER := 4
-CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3 -D_FILE_OFFSET_BITS=64
+# Include the source dir first, so that headers paths are always picked
+# from there. By including it last race conditions might happen during parallel
+# builds, and headers might be already installed in RTE_OUT/include when the
+# variable is recursively expanded, thus causing GCC to sometimes use the
+# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
+# reproducible.
+CFLAGS := -I$(SRCDIR) $(CFLAGS)
+CFLAGS += $(WERROR_FLAGS) -O3 -D_FILE_OFFSET_BITS=64
CFLAGS += -I vhost_user
LDLIBS += -lpthread
--
2.11.0
^ permalink raw reply [flat|nested] 65+ messages in thread