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 --- 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_hash/Makefile
97 +++ b/lib/librte_hash/Makefile
98 @@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
103 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
104 +# Include the source dir first, so that headers paths are always picked
105 +# from there. By including it last race conditions might happen during paralle
106 +# builds, and headers might be already installed in RTE_OUT/include when the
107 +# variable is recursively expanded, thus causing GCC to sometimes use the
108 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
110 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
111 +CFLAGS += $(WERROR_FLAGS) -O3
113 EXPORT_MAP := rte_hash_version.map
115 --- a/lib/librte_ip_frag/Makefile
116 +++ b/lib/librte_ip_frag/Makefile
117 @@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
119 LIB = librte_ip_frag.a
122 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
123 +# Include the source dir first, so that headers paths are always picked
124 +# from there. By including it last race conditions might happen during paralle
125 +# builds, and headers might be already installed in RTE_OUT/include when the
126 +# variable is recursively expanded, thus causing GCC to sometimes use the
127 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
129 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
130 +CFLAGS += $(WERROR_FLAGS) -O3
132 EXPORT_MAP := rte_ipfrag_version.map
134 --- a/lib/librte_jobstats/Makefile
135 +++ b/lib/librte_jobstats/Makefile
136 @@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
138 LIB = librte_jobstats.a
141 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
142 +# Include the source dir first, so that headers paths are always picked
143 +# from there. By including it last race conditions might happen during paralle
144 +# builds, and headers might be already installed in RTE_OUT/include when the
145 +# variable is recursively expanded, thus causing GCC to sometimes use the
146 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
148 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
149 +CFLAGS += $(WERROR_FLAGS) -O3
151 EXPORT_MAP := rte_jobstats_version.map
153 --- a/lib/librte_kni/Makefile
154 +++ b/lib/librte_kni/Makefile
155 @@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
159 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3 -fno-strict-aliasing
160 +# Include the source dir first, so that headers paths are always picked
161 +# from there. By including it last race conditions might happen during paralle
162 +# builds, and headers might be already installed in RTE_OUT/include when the
163 +# variable is recursively expanded, thus causing GCC to sometimes use the
164 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
166 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
167 +CFLAGS += $(WERROR_FLAGS) -O3 -fno-strict-aliasing
169 EXPORT_MAP := rte_kni_version.map
171 --- a/lib/librte_kvargs/Makefile
172 +++ b/lib/librte_kvargs/Makefile
173 @@ -36,7 +36,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
175 LIB = librte_kvargs.a
177 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
178 +# Include the source dir first, so that headers paths are always picked
179 +# from there. By including it last race conditions might happen during paralle
180 +# builds, and headers might be already installed in RTE_OUT/include when the
181 +# variable is recursively expanded, thus causing GCC to sometimes use the
182 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
184 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
185 +CFLAGS += $(WERROR_FLAGS) -O3
187 EXPORT_MAP := rte_kvargs_version.map
189 --- a/lib/librte_lpm/Makefile
190 +++ b/lib/librte_lpm/Makefile
191 @@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
196 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
197 +# Include the source dir first, so that headers paths are always picked
198 +# from there. By including it last race conditions might happen during paralle
199 +# builds, and headers might be already installed in RTE_OUT/include when the
200 +# variable is recursively expanded, thus causing GCC to sometimes use the
201 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
203 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
204 +CFLAGS += $(WERROR_FLAGS) -O3
206 EXPORT_MAP := rte_lpm_version.map
208 --- a/lib/librte_mbuf/Makefile
209 +++ b/lib/librte_mbuf/Makefile
210 @@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
214 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
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
224 EXPORT_MAP := rte_mbuf_version.map
226 --- a/lib/librte_mempool/Makefile
227 +++ b/lib/librte_mempool/Makefile
228 @@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
230 LIB = librte_mempool.a
232 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
233 +# Include the source dir first, so that headers paths are always picked
234 +# from there. By including it last race conditions might happen during paralle
235 +# builds, and headers might be already installed in RTE_OUT/include when the
236 +# variable is recursively expanded, thus causing GCC to sometimes use the
237 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
239 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
240 +CFLAGS += $(WERROR_FLAGS) -O3
242 EXPORT_MAP := rte_mempool_version.map
244 --- a/lib/librte_net/Makefile
245 +++ b/lib/librte_net/Makefile
246 @@ -33,7 +33,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
250 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
251 +# Include the source dir first, so that headers paths are always picked
252 +# from there. By including it last race conditions might happen during paralle
253 +# builds, and headers might be already installed in RTE_OUT/include when the
254 +# variable is recursively expanded, thus causing GCC to sometimes use the
255 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
257 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
258 +CFLAGS += $(WERROR_FLAGS) -O3
260 EXPORT_MAP := rte_net_version.map
262 --- a/lib/librte_pdump/Makefile
263 +++ b/lib/librte_pdump/Makefile
264 @@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
268 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
269 -CFLAGS += -D_GNU_SOURCE
270 +# Include the source dir first, so that headers paths are always picked
271 +# from there. By including it last race conditions might happen during paralle
272 +# builds, and headers might be already installed in RTE_OUT/include when the
273 +# variable is recursively expanded, thus causing GCC to sometimes use the
274 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
276 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
277 +CFLAGS += $(WERROR_FLAGS) -O3 -D_GNU_SOURCE
280 EXPORT_MAP := rte_pdump_version.map
281 --- a/lib/librte_power/Makefile
282 +++ b/lib/librte_power/Makefile
283 @@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
287 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3 -fno-strict-aliasing
288 +# Include the source dir first, so that headers paths are always picked
289 +# from there. By including it last race conditions might happen during paralle
290 +# builds, and headers might be already installed in RTE_OUT/include when the
291 +# variable is recursively expanded, thus causing GCC to sometimes use the
292 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
294 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
295 +CFLAGS += $(WERROR_FLAGS) -O3 -fno-strict-aliasing
297 EXPORT_MAP := rte_power_version.map
299 --- a/lib/librte_reorder/Makefile
300 +++ b/lib/librte_reorder/Makefile
301 @@ -34,8 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
303 LIB = librte_reorder.a
306 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR)
307 +# Include the source dir first, so that headers paths are always picked
308 +# from there. By including it last race conditions might happen during paralle
309 +# builds, and headers might be already installed in RTE_OUT/include when the
310 +# variable is recursively expanded, thus causing GCC to sometimes use the
311 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
313 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
314 +CFLAGS += $(WERROR_FLAGS) -O3
316 EXPORT_MAP := rte_reorder_version.map
318 --- a/lib/librte_ring/Makefile
319 +++ b/lib/librte_ring/Makefile
320 @@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
324 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
325 +# Include the source dir first, so that headers paths are always picked
326 +# from there. By including it last race conditions might happen during paralle
327 +# builds, and headers might be already installed in RTE_OUT/include when the
328 +# variable is recursively expanded, thus causing GCC to sometimes use the
329 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
331 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
332 +CFLAGS += $(WERROR_FLAGS) -O3
334 EXPORT_MAP := rte_ring_version.map
336 --- a/lib/librte_timer/Makefile
337 +++ b/lib/librte_timer/Makefile
338 @@ -34,7 +34,14 @@ include $(RTE_SDK)/mk/rte.vars.mk
342 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3
343 +# Include the source dir first, so that headers paths are always picked
344 +# from there. By including it last race conditions might happen during parallel
345 +# builds, and headers might be already installed in RTE_OUT/include when the
346 +# variable is recursively expanded, thus causing GCC to sometimes use the
347 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
349 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
350 +CFLAGS += $(WERROR_FLAGS) -O3
352 EXPORT_MAP := rte_timer_version.map
354 --- a/lib/librte_vhost/Makefile
355 +++ b/lib/librte_vhost/Makefile
356 @@ -38,7 +38,14 @@ EXPORT_MAP := rte_vhost_version.map
360 -CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -O3 -D_FILE_OFFSET_BITS=64
361 +# Include the source dir first, so that headers paths are always picked
362 +# from there. By including it last race conditions might happen during parallel
363 +# builds, and headers might be already installed in RTE_OUT/include when the
364 +# variable is recursively expanded, thus causing GCC to sometimes use the
365 +# SRCDIR path and sometimes the RTE_OUT/include, making the builds not
367 +CFLAGS := -I$(SRCDIR) $(CFLAGS)
368 +CFLAGS += $(WERROR_FLAGS) -O3 -D_FILE_OFFSET_BITS=64
369 CFLAGS += -I vhost_user