1 Description: mk: set -ISCDIR before -IRTE_OUT/include in CFLAGS
3 A race condition can happen during parallel builds, where a header
4 might be installed in RTE_OUT/include before CFLAGS is recursively
5 expanded. This causes GCC to sometimes pick the header path as
6 SRCDIR/... and sometimes as RTE_OUT/include/... making the build
7 unreproducible, as the full path is used for the expansion of
8 __FILE__ and in the DWARF directory listing.
9 Always pass -ISRCDIR first to CFLAGS so that it's deterministic.
11 Origin: http://dpdk.org/dev/patchwork/patch/27512/
13 Author: Luca Boccassi <luca.boccassi@gmail.com>
14 Last-Update: 2017-08-10
16 lib/librte_acl/Makefile | 10 ++++++++--
17 lib/librte_bitratestats/Makefile | 9 ++++++++-
18 lib/librte_cmdline/Makefile | 9 ++++++++-
19 lib/librte_distributor/Makefile | 10 ++++++++--
20 lib/librte_eal/linuxapp/eal/Makefile | 8 +++++++-
21 lib/librte_hash/Makefile | 10 ++++++++--
22 lib/librte_ip_frag/Makefile | 10 ++++++++--
23 lib/librte_jobstats/Makefile | 10 ++++++++--
24 lib/librte_kni/Makefile | 9 ++++++++-
25 lib/librte_kvargs/Makefile | 9 ++++++++-
26 lib/librte_latencystats/Makefile | 9 ++++++++-
27 lib/librte_lpm/Makefile | 10 ++++++++--
28 lib/librte_mbuf/Makefile | 9 ++++++++-
29 lib/librte_mempool/Makefile | 9 ++++++++-
30 lib/librte_metrics/Makefile | 9 ++++++++-
31 lib/librte_net/Makefile | 9 ++++++++-
32 lib/librte_pdump/Makefile | 10 ++++++++--
33 lib/librte_power/Makefile | 9 ++++++++-
34 lib/librte_reorder/Makefile | 10 ++++++++--
35 lib/librte_ring/Makefile | 9 ++++++++-
36 lib/librte_timer/Makefile | 9 ++++++++-
37 lib/librte_vhost/Makefile | 9 ++++++++-
38 22 files changed, 173 insertions(+), 32 deletions(-)
40 --- a/lib/librte_acl/Makefile
41 +++ b/lib/librte_acl/Makefile
42 @@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
47 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
48 +# Include the source dir first, so that headers paths are always picked
49 +# from there. By including it last race conditions might happen during paralle
50 +# builds, and headers might be already installed in RTE_OUT/include when the
51 +# variable is recursively expanded, thus causing GCC to sometimes use the
52 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
54 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
55 +CFLAGS += $(WERROR_FLAGS) -O3
57 EXPORT_MAP := rte_acl_version.map
59 --- a/lib/librte_cmdline/Makefile
60 +++ b/lib/librte_cmdline/Makefile
61 @@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
63 LIB = librte_cmdline.a
65 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
66 +# Include the source dir first, so that headers paths are always picked
67 +# from there. By including it last race conditions might happen during paralle
68 +# builds, and headers might be already installed in RTE_OUT/include when the
69 +# variable is recursively expanded, thus causing GCC to sometimes use the
70 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
72 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
73 +CFLAGS += $(WERROR_FLAGS) -O3
75 EXPORT_MAP := rte_cmdline_version.map
77 --- a/lib/librte_distributor/Makefile
78 +++ b/lib/librte_distributor/Makefile
79 @@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
81 LIB = librte_distributor.a
84 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
85 +# Include the source dir first, so that headers paths are always picked
86 +# from there. By including it last race conditions might happen during paralle
87 +# builds, and headers might be already installed in RTE_OUT/include when the
88 +# variable is recursively expanded, thus causing GCC to sometimes use the
89 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
91 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
92 +CFLAGS += $(WERROR_FLAGS) -O3
94 EXPORT_MAP := rte_distributor_version.map
96 --- a/lib/librte_eal/linuxapp/eal/Makefile
97 +++ b/lib/librte_eal/linuxapp/eal/Makefile
98 @@ -41,7 +41,13 @@ LIBABIVER := 3
100 VPATH += $(RTE_SDK)/lib/librte_eal/common
102 -CFLAGS += -I$(SRCDIR)/include
103 +# Include the source dir first, so that headers paths are always picked
104 +# from there. By including it last race conditions might happen during paralle
105 +# builds, and headers might be already installed in RTE_OUT/include when the
106 +# variable is recursively expanded, thus causing GCC to sometimes use the
107 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
109 +CFLAGS := -I$(SRCDIR)/include $(CFLAGS)
110 CFLAGS += -I$(RTE_SDK)/lib/librte_eal/common
111 CFLAGS += -I$(RTE_SDK)/lib/librte_eal/common/include
112 CFLAGS += $(WERROR_FLAGS) -O3
113 --- a/lib/librte_hash/Makefile
114 +++ b/lib/librte_hash/Makefile
115 @@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
120 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
121 +# Include the source dir first, so that headers paths are always picked
122 +# from there. By including it last race conditions might happen during paralle
123 +# builds, and headers might be already installed in RTE_OUT/include when the
124 +# variable is recursively expanded, thus causing GCC to sometimes use the
125 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
127 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
128 +CFLAGS += $(WERROR_FLAGS) -O3
130 EXPORT_MAP := rte_hash_version.map
132 --- a/lib/librte_ip_frag/Makefile
133 +++ b/lib/librte_ip_frag/Makefile
134 @@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
136 LIB = librte_ip_frag.a
139 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
140 +# Include the source dir first, so that headers paths are always picked
141 +# from there. By including it last race conditions might happen during paralle
142 +# builds, and headers might be already installed in RTE_OUT/include when the
143 +# variable is recursively expanded, thus causing GCC to sometimes use the
144 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
146 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
147 +CFLAGS += $(WERROR_FLAGS) -O3
149 EXPORT_MAP := rte_ipfrag_version.map
151 --- a/lib/librte_jobstats/Makefile
152 +++ b/lib/librte_jobstats/Makefile
153 @@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
155 LIB = librte_jobstats.a
158 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
159 +# Include the source dir first, so that headers paths are always picked
160 +# from there. By including it last race conditions might happen during paralle
161 +# builds, and headers might be already installed in RTE_OUT/include when the
162 +# variable is recursively expanded, thus causing GCC to sometimes use the
163 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
165 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
166 +CFLAGS += $(WERROR_FLAGS) -O3
168 EXPORT_MAP := rte_jobstats_version.map
170 --- a/lib/librte_kni/Makefile
171 +++ b/lib/librte_kni/Makefile
172 @@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
176 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3 -fno-strict-aliasing
177 +# Include the source dir first, so that headers paths are always picked
178 +# from there. By including it last race conditions might happen during paralle
179 +# builds, and headers might be already installed in RTE_OUT/include when the
180 +# variable is recursively expanded, thus causing GCC to sometimes use the
181 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
183 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
184 +CFLAGS += $(WERROR_FLAGS) -O3 -fno-strict-aliasing
186 EXPORT_MAP := rte_kni_version.map
188 --- a/lib/librte_kvargs/Makefile
189 +++ b/lib/librte_kvargs/Makefile
190 @@ -36,7 +36,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
192 LIB = librte_kvargs.a
194 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
195 +# Include the source dir first, so that headers paths are always picked
196 +# from there. By including it last race conditions might happen during paralle
197 +# builds, and headers might be already installed in RTE_OUT/include when the
198 +# variable is recursively expanded, thus causing GCC to sometimes use the
199 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
201 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
202 +CFLAGS += $(WERROR_FLAGS) -O3
204 EXPORT_MAP := rte_kvargs_version.map
206 --- a/lib/librte_lpm/Makefile
207 +++ b/lib/librte_lpm/Makefile
208 @@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
213 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
214 +# Include the source dir first, so that headers paths are always picked
215 +# from there. By including it last race conditions might happen during paralle
216 +# builds, and headers might be already installed in RTE_OUT/include when the
217 +# variable is recursively expanded, thus causing GCC to sometimes use the
218 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
220 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
221 +CFLAGS += $(WERROR_FLAGS) -O3
223 EXPORT_MAP := rte_lpm_version.map
225 --- a/lib/librte_mbuf/Makefile
226 +++ b/lib/librte_mbuf/Makefile
227 @@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
231 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
232 +# Include the source dir first, so that headers paths are always picked
233 +# from there. By including it last race conditions might happen during paralle
234 +# builds, and headers might be already installed in RTE_OUT/include when the
235 +# variable is recursively expanded, thus causing GCC to sometimes use the
236 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
238 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
239 +CFLAGS += $(WERROR_FLAGS) -O3
241 EXPORT_MAP := rte_mbuf_version.map
243 --- a/lib/librte_mempool/Makefile
244 +++ b/lib/librte_mempool/Makefile
245 @@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
247 LIB = librte_mempool.a
249 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
250 +# Include the source dir first, so that headers paths are always picked
251 +# from there. By including it last race conditions might happen during paralle
252 +# builds, and headers might be already installed in RTE_OUT/include when the
253 +# variable is recursively expanded, thus causing GCC to sometimes use the
254 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
256 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
257 +CFLAGS += $(WERROR_FLAGS) -O3
259 EXPORT_MAP := rte_mempool_version.map
261 --- a/lib/librte_net/Makefile
262 +++ b/lib/librte_net/Makefile
263 @@ -33,7 +33,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
267 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
268 +# Include the source dir first, so that headers paths are always picked
269 +# from there. By including it last race conditions might happen during paralle
270 +# builds, and headers might be already installed in RTE_OUT/include when the
271 +# variable is recursively expanded, thus causing GCC to sometimes use the
272 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
274 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
275 +CFLAGS += $(WERROR_FLAGS) -O3
277 EXPORT_MAP := rte_net_version.map
279 --- a/lib/librte_pdump/Makefile
280 +++ b/lib/librte_pdump/Makefile
281 @@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
285 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
286 -CFLAGS += -D_GNU_SOURCE
287 +# Include the source dir first, so that headers paths are always picked
288 +# from there. By including it last race conditions might happen during paralle
289 +# builds, and headers might be already installed in RTE_OUT/include when the
290 +# variable is recursively expanded, thus causing GCC to sometimes use the
291 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
293 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
294 +CFLAGS += $(WERROR_FLAGS) -O3 -D_GNU_SOURCE
297 EXPORT_MAP := rte_pdump_version.map
298 --- a/lib/librte_power/Makefile
299 +++ b/lib/librte_power/Makefile
300 @@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
304 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3 -fno-strict-aliasing
305 +# Include the source dir first, so that headers paths are always picked
306 +# from there. By including it last race conditions might happen during paralle
307 +# builds, and headers might be already installed in RTE_OUT/include when the
308 +# variable is recursively expanded, thus causing GCC to sometimes use the
309 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
311 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
312 +CFLAGS += $(WERROR_FLAGS) -O3 -fno-strict-aliasing
314 EXPORT_MAP := rte_power_version.map
316 --- a/lib/librte_reorder/Makefile
317 +++ b/lib/librte_reorder/Makefile
318 @@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
320 LIB = librte_reorder.a
323 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
324 +# Include the source dir first, so that headers paths are always picked
325 +# from there. By including it last race conditions might happen during paralle
326 +# builds, and headers might be already installed in RTE_OUT/include when the
327 +# variable is recursively expanded, thus causing GCC to sometimes use the
328 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
330 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
331 +CFLAGS += $(WERROR_FLAGS) -O3
333 EXPORT_MAP := rte_reorder_version.map
335 --- a/lib/librte_ring/Makefile
336 +++ b/lib/librte_ring/Makefile
337 @@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
341 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
342 +# Include the source dir first, so that headers paths are always picked
343 +# from there. By including it last race conditions might happen during paralle
344 +# builds, and headers might be already installed in RTE_OUT/include when the
345 +# variable is recursively expanded, thus causing GCC to sometimes use the
346 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
348 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
349 +CFLAGS += $(WERROR_FLAGS) -O3
351 EXPORT_MAP := rte_ring_version.map
353 --- a/lib/librte_timer/Makefile
354 +++ b/lib/librte_timer/Makefile
355 @@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
359 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
360 +# Include the source dir first, so that headers paths are always picked
361 +# from there. By including it last race conditions might happen during parallel
362 +# builds, and headers might be already installed in RTE_OUT/include when the
363 +# variable is recursively expanded, thus causing GCC to sometimes use the
364 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
366 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
367 +CFLAGS += $(WERROR_FLAGS) -O3
369 EXPORT_MAP := rte_timer_version.map
371 --- a/lib/librte_vhost/Makefile
372 +++ b/lib/librte_vhost/Makefile
373 @@ -38,7 +38,14 @@ EXPORT_MAP := rte_vhost_version.map
377 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3 -D_FILE_OFFSET_BITS=64
378 +# Include the source dir first, so that headers paths are always picked
379 +# from there. By including it last race conditions might happen during parallel
380 +# builds, and headers might be already installed in RTE_OUT/include when the
381 +# variable is recursively expanded, thus causing GCC to sometimes use the
382 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
384 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
385 +CFLAGS += $(WERROR_FLAGS) -O3 -D_FILE_OFFSET_BITS=64
386 CFLAGS += -I vhost_user