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/25866/
13 Author: Luca Boccassi <luca.boccassi@gmail.com>
14 Last-Update: 2017-06-28
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_efd/Makefile | 10 ++++++++--
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, 176 insertions(+), 31 deletions(-)
40 diff --git a/lib/librte_acl/Makefile b/lib/librte_acl/Makefile
41 index e2dacd606..470ef6d21 100644
42 --- a/lib/librte_acl/Makefile
43 +++ b/lib/librte_acl/Makefile
44 @@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
49 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
50 +# Include the source dir first, so that headers paths are always picked
51 +# from there. By including it last race conditions might happen during paralle
52 +# builds, and headers might be already installed in RTE_OUT/include when the
53 +# variable is recursively expanded, thus causing GCC to sometimes use the
54 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
56 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
57 +CFLAGS += $(WERROR_FLAGS) -O3
59 EXPORT_MAP := rte_acl_version.map
61 diff --git a/lib/librte_bitratestats/Makefile b/lib/librte_bitratestats/Makefile
62 index 58a20ea09..26a3f4908 100644
63 --- a/lib/librte_bitratestats/Makefile
64 +++ b/lib/librte_bitratestats/Makefile
65 @@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
67 LIB = librte_bitratestats.a
69 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
70 +# Include the source dir first, so that headers paths are always picked
71 +# from there. By including it last race conditions might happen during paralle
72 +# builds, and headers might be already installed in RTE_OUT/include when the
73 +# variable is recursively expanded, thus causing GCC to sometimes use the
74 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
76 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
77 +CFLAGS += $(WERROR_FLAGS) -O3
79 EXPORT_MAP := rte_bitratestats_version.map
81 diff --git a/lib/librte_cmdline/Makefile b/lib/librte_cmdline/Makefile
82 index 644f68e47..9dd75f2d2 100644
83 --- a/lib/librte_cmdline/Makefile
84 +++ b/lib/librte_cmdline/Makefile
85 @@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
87 LIB = librte_cmdline.a
89 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
90 +# Include the source dir first, so that headers paths are always picked
91 +# from there. By including it last race conditions might happen during paralle
92 +# builds, and headers might be already installed in RTE_OUT/include when the
93 +# variable is recursively expanded, thus causing GCC to sometimes use the
94 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
96 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
97 +CFLAGS += $(WERROR_FLAGS) -O3
99 EXPORT_MAP := rte_cmdline_version.map
101 diff --git a/lib/librte_distributor/Makefile b/lib/librte_distributor/Makefile
102 index 3ffb911ce..87418f254 100644
103 --- a/lib/librte_distributor/Makefile
104 +++ b/lib/librte_distributor/Makefile
105 @@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
107 LIB = librte_distributor.a
110 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
111 +# Include the source dir first, so that headers paths are always picked
112 +# from there. By including it last race conditions might happen during paralle
113 +# builds, and headers might be already installed in RTE_OUT/include when the
114 +# variable is recursively expanded, thus causing GCC to sometimes use the
115 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
117 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
118 +CFLAGS += $(WERROR_FLAGS) -O3
120 EXPORT_MAP := rte_distributor_version.map
122 diff --git a/lib/librte_efd/Makefile b/lib/librte_efd/Makefile
123 index b9277bc5d..b169e3240 100644
124 --- a/lib/librte_efd/Makefile
125 +++ b/lib/librte_efd/Makefile
126 @@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
131 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
132 +# Include the source dir first, so that headers paths are always picked
133 +# from there. By including it last race conditions might happen during paralle
134 +# builds, and headers might be already installed in RTE_OUT/include when the
135 +# variable is recursively expanded, thus causing GCC to sometimes use the
136 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
138 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
139 +CFLAGS += $(WERROR_FLAGS) -O3
141 EXPORT_MAP := rte_efd_version.map
143 diff --git a/lib/librte_hash/Makefile b/lib/librte_hash/Makefile
144 index d856aa26d..e408dcc46 100644
145 --- a/lib/librte_hash/Makefile
146 +++ b/lib/librte_hash/Makefile
147 @@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
152 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
153 +# Include the source dir first, so that headers paths are always picked
154 +# from there. By including it last race conditions might happen during paralle
155 +# builds, and headers might be already installed in RTE_OUT/include when the
156 +# variable is recursively expanded, thus causing GCC to sometimes use the
157 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
159 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
160 +CFLAGS += $(WERROR_FLAGS) -O3
162 EXPORT_MAP := rte_hash_version.map
164 diff --git a/lib/librte_ip_frag/Makefile b/lib/librte_ip_frag/Makefile
165 index 4e693bf8f..de45ec2d3 100644
166 --- a/lib/librte_ip_frag/Makefile
167 +++ b/lib/librte_ip_frag/Makefile
168 @@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
170 LIB = librte_ip_frag.a
173 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
174 +# Include the source dir first, so that headers paths are always picked
175 +# from there. By including it last race conditions might happen during paralle
176 +# builds, and headers might be already installed in RTE_OUT/include when the
177 +# variable is recursively expanded, thus causing GCC to sometimes use the
178 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
180 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
181 +CFLAGS += $(WERROR_FLAGS) -O3
183 EXPORT_MAP := rte_ipfrag_version.map
185 diff --git a/lib/librte_jobstats/Makefile b/lib/librte_jobstats/Makefile
186 index 561a0678c..57329b18e 100644
187 --- a/lib/librte_jobstats/Makefile
188 +++ b/lib/librte_jobstats/Makefile
189 @@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
191 LIB = librte_jobstats.a
194 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
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_jobstats_version.map
206 diff --git a/lib/librte_kni/Makefile b/lib/librte_kni/Makefile
207 index 70f1ca8f6..130d6fd74 100644
208 --- a/lib/librte_kni/Makefile
209 +++ b/lib/librte_kni/Makefile
210 @@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
214 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3 -fno-strict-aliasing
215 +# Include the source dir first, so that headers paths are always picked
216 +# from there. By including it last race conditions might happen during paralle
217 +# builds, and headers might be already installed in RTE_OUT/include when the
218 +# variable is recursively expanded, thus causing GCC to sometimes use the
219 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
221 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
222 +CFLAGS += $(WERROR_FLAGS) -O3 -fno-strict-aliasing
224 EXPORT_MAP := rte_kni_version.map
226 diff --git a/lib/librte_kvargs/Makefile b/lib/librte_kvargs/Makefile
227 index 564dd3102..7c332c110 100644
228 --- a/lib/librte_kvargs/Makefile
229 +++ b/lib/librte_kvargs/Makefile
230 @@ -36,7 +36,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
232 LIB = librte_kvargs.a
234 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
235 +# Include the source dir first, so that headers paths are always picked
236 +# from there. By including it last race conditions might happen during paralle
237 +# builds, and headers might be already installed in RTE_OUT/include when the
238 +# variable is recursively expanded, thus causing GCC to sometimes use the
239 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
241 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
242 +CFLAGS += $(WERROR_FLAGS) -O3
244 EXPORT_MAP := rte_kvargs_version.map
246 diff --git a/lib/librte_latencystats/Makefile b/lib/librte_latencystats/Makefile
247 index eaacbb731..46a8ecd34 100644
248 --- a/lib/librte_latencystats/Makefile
249 +++ b/lib/librte_latencystats/Makefile
250 @@ -33,7 +33,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
252 LIB = librte_latencystats.a
254 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
255 +# Include the source dir first, so that headers paths are always picked
256 +# from there. By including it last race conditions might happen during paralle
257 +# builds, and headers might be already installed in RTE_OUT/include when the
258 +# variable is recursively expanded, thus causing GCC to sometimes use the
259 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
261 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
262 +CFLAGS += $(WERROR_FLAGS) -O3
266 diff --git a/lib/librte_lpm/Makefile b/lib/librte_lpm/Makefile
267 index 32be46b3b..6a97fdc97 100644
268 --- a/lib/librte_lpm/Makefile
269 +++ b/lib/librte_lpm/Makefile
270 @@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
275 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
276 +# Include the source dir first, so that headers paths are always picked
277 +# from there. By including it last race conditions might happen during paralle
278 +# builds, and headers might be already installed in RTE_OUT/include when the
279 +# variable is recursively expanded, thus causing GCC to sometimes use the
280 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
282 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
283 +CFLAGS += $(WERROR_FLAGS) -O3
285 EXPORT_MAP := rte_lpm_version.map
287 diff --git a/lib/librte_mbuf/Makefile b/lib/librte_mbuf/Makefile
288 index 548273054..4d51191ee 100644
289 --- a/lib/librte_mbuf/Makefile
290 +++ b/lib/librte_mbuf/Makefile
291 @@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
295 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
296 +# Include the source dir first, so that headers paths are always picked
297 +# from there. By including it last race conditions might happen during paralle
298 +# builds, and headers might be already installed in RTE_OUT/include when the
299 +# variable is recursively expanded, thus causing GCC to sometimes use the
300 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
302 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
303 +CFLAGS += $(WERROR_FLAGS) -O3
305 EXPORT_MAP := rte_mbuf_version.map
307 diff --git a/lib/librte_mempool/Makefile b/lib/librte_mempool/Makefile
308 index 7b5bdfee7..33678192f 100644
309 --- a/lib/librte_mempool/Makefile
310 +++ b/lib/librte_mempool/Makefile
311 @@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
313 LIB = librte_mempool.a
315 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
316 +# Include the source dir first, so that headers paths are always picked
317 +# from there. By including it last race conditions might happen during paralle
318 +# builds, and headers might be already installed in RTE_OUT/include when the
319 +# variable is recursively expanded, thus causing GCC to sometimes use the
320 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
322 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
323 +CFLAGS += $(WERROR_FLAGS) -O3
325 EXPORT_MAP := rte_mempool_version.map
327 diff --git a/lib/librte_metrics/Makefile b/lib/librte_metrics/Makefile
328 index d4990e839..195bd4d56 100644
329 --- a/lib/librte_metrics/Makefile
330 +++ b/lib/librte_metrics/Makefile
331 @@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
333 LIB = librte_metrics.a
335 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
336 +# Include the source dir first, so that headers paths are always picked
337 +# from there. By including it last race conditions might happen during paralle
338 +# builds, and headers might be already installed in RTE_OUT/include when the
339 +# variable is recursively expanded, thus causing GCC to sometimes use the
340 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
342 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
343 +CFLAGS += $(WERROR_FLAGS) -O3
345 EXPORT_MAP := rte_metrics_version.map
347 diff --git a/lib/librte_net/Makefile b/lib/librte_net/Makefile
348 index 56727c4df..a08a7dd8b 100644
349 --- a/lib/librte_net/Makefile
350 +++ b/lib/librte_net/Makefile
351 @@ -33,7 +33,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
355 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
356 +# Include the source dir first, so that headers paths are always picked
357 +# from there. By including it last race conditions might happen during paralle
358 +# builds, and headers might be already installed in RTE_OUT/include when the
359 +# variable is recursively expanded, thus causing GCC to sometimes use the
360 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
362 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
363 +CFLAGS += $(WERROR_FLAGS) -O3
365 EXPORT_MAP := rte_net_version.map
367 diff --git a/lib/librte_pdump/Makefile b/lib/librte_pdump/Makefile
368 index 1c03bcbb7..8923d7499 100644
369 --- a/lib/librte_pdump/Makefile
370 +++ b/lib/librte_pdump/Makefile
371 @@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
375 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
376 -CFLAGS += -D_GNU_SOURCE
377 +# Include the source dir first, so that headers paths are always picked
378 +# from there. By including it last race conditions might happen during paralle
379 +# builds, and headers might be already installed in RTE_OUT/include when the
380 +# variable is recursively expanded, thus causing GCC to sometimes use the
381 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
383 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
384 +CFLAGS += $(WERROR_FLAGS) -O3 -D_GNU_SOURCE
387 EXPORT_MAP := rte_pdump_version.map
388 diff --git a/lib/librte_power/Makefile b/lib/librte_power/Makefile
389 index 06cd10e86..b76ad689e 100644
390 --- a/lib/librte_power/Makefile
391 +++ b/lib/librte_power/Makefile
392 @@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
396 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3 -fno-strict-aliasing
397 +# Include the source dir first, so that headers paths are always picked
398 +# from there. By including it last race conditions might happen during paralle
399 +# builds, and headers might be already installed in RTE_OUT/include when the
400 +# variable is recursively expanded, thus causing GCC to sometimes use the
401 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
403 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
404 +CFLAGS += $(WERROR_FLAGS) -O3 -fno-strict-aliasing
406 EXPORT_MAP := rte_power_version.map
408 diff --git a/lib/librte_reorder/Makefile b/lib/librte_reorder/Makefile
409 index 4e44e72f0..51b5d490d 100644
410 --- a/lib/librte_reorder/Makefile
411 +++ b/lib/librte_reorder/Makefile
412 @@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
414 LIB = librte_reorder.a
417 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
418 +# Include the source dir first, so that headers paths are always picked
419 +# from there. By including it last race conditions might happen during paralle
420 +# builds, and headers might be already installed in RTE_OUT/include when the
421 +# variable is recursively expanded, thus causing GCC to sometimes use the
422 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
424 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
425 +CFLAGS += $(WERROR_FLAGS) -O3
427 EXPORT_MAP := rte_reorder_version.map
429 diff --git a/lib/librte_ring/Makefile b/lib/librte_ring/Makefile
430 index 3e2f4b873..e5248a2c1 100644
431 --- a/lib/librte_ring/Makefile
432 +++ b/lib/librte_ring/Makefile
433 @@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
437 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
438 +# Include the source dir first, so that headers paths are always picked
439 +# from there. By including it last race conditions might happen during paralle
440 +# builds, and headers might be already installed in RTE_OUT/include when the
441 +# variable is recursively expanded, thus causing GCC to sometimes use the
442 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
444 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
445 +CFLAGS += $(WERROR_FLAGS) -O3
447 EXPORT_MAP := rte_ring_version.map
449 diff --git a/lib/librte_timer/Makefile b/lib/librte_timer/Makefile
450 index 03a15390e..0c57cc6d3 100644
451 --- a/lib/librte_timer/Makefile
452 +++ b/lib/librte_timer/Makefile
453 @@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
457 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
458 +# Include the source dir first, so that headers paths are always picked
459 +# from there. By including it last race conditions might happen during parallel
460 +# builds, and headers might be already installed in RTE_OUT/include when the
461 +# variable is recursively expanded, thus causing GCC to sometimes use the
462 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
464 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
465 +CFLAGS += $(WERROR_FLAGS) -O3
467 EXPORT_MAP := rte_timer_version.map
469 diff --git a/lib/librte_vhost/Makefile b/lib/librte_vhost/Makefile
470 index 4a116fe31..ef0d86990 100644
471 --- a/lib/librte_vhost/Makefile
472 +++ b/lib/librte_vhost/Makefile
473 @@ -38,7 +38,14 @@ EXPORT_MAP := rte_vhost_version.map
477 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3 -D_FILE_OFFSET_BITS=64
478 +# Include the source dir first, so that headers paths are always picked
479 +# from there. By including it last race conditions might happen during parallel
480 +# builds, and headers might be already installed in RTE_OUT/include when the
481 +# variable is recursively expanded, thus causing GCC to sometimes use the
482 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
484 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
485 +CFLAGS += $(WERROR_FLAGS) -O3 -D_FILE_OFFSET_BITS=64
486 CFLAGS += -I vhost_user