Skip to content

Commit 44808fc

Browse files
committed
auto merge of #7820 : pnkfelix/rust/fill-in-some-missing-rustc-lib-dependences, r=graydon
r? anyone Fix #8057 This commit fixes some oversights in the Makefile where rustc could be invoked without some of its dependencies yet in place. (I encountered the problem in practice; its not just theoretical.) As written in Makefile.in, $(STAGE$(1)_T_$(2)_H_$(3)) is the way one writes an invocation of rustc where $(1) is the stage number $(2) is the target triple $(3) is the host triple. (Other uses of the macro may plug in actual values or different parameters in for those three formal parameters.) When you have invocations of $(STAGE...), you need to make sure that its dependences are satisfied; otherwise, if someone is using `make -jN` for certain (large-ish) `N`, one can encounter situations where GNU make attempts to invoke `rustc` before it has actually copied some of its libraries into place, such as libmorestack.a, which causes a link failure when the rustc invocation attempts to link in those libraries. In this case, the main prerequisite to add is TSREQ$(1)_T_$(2)_H_$(3), which is described in Makefile.in as "Prerequisites for using the stageN compiler to build target artifacts" ---- In addition to adding the extra dependences on TSREQ..., I also replaced occurrences of the pattern: TSREQ$(1)_T_$(2)_H_$(3) $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_STDLIB_$(2)) $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_EXTRALIB_$(2)) with: SREQ$(1)_T_$(2)_H_$(3) which is equivalent to the above, as defined in Makefile.in ---- Finally, for the cases where TSREQ was missing in tests.mk, I went ahead and put in a dependence on SREQ rather than just TSREQ, since it was not clear to me how one could expect to compile those cases without stdlib and extralib. (It could well be that I should have gone ahead and done the same in other cases where I saw TSREQ was missing, and put SREQ in those cases as well. But this seemed like a good measure for now, without needing to tax my understanding of the overall makefile infrastructure much further.)
2 parents 544ef6c + 534dd62 commit 44808fc

File tree

3 files changed

+20
-16
lines changed

3 files changed

+20
-16
lines changed

mk/target.mk

+2
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUSTLLVM_$(3)): \
8484
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTC_$(3)): CFG_COMPILER_TRIPLE = $(2)
8585
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTC_$(3)): \
8686
$$(COMPILER_CRATE) $$(COMPILER_INPUTS) \
87+
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
8788
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBSYNTAX_$(3)) \
8889
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_RUSTLLVM_$(3)) \
8990
| $$(TLIB$(1)_T_$(2)_H_$(3))/
@@ -94,6 +95,7 @@ $$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTC_$(3)): \
9495

9596
$$(TBIN$(1)_T_$(2)_H_$(3))/rustc$$(X_$(3)): \
9697
$$(DRIVER_CRATE) \
98+
$$(TSREQ$(1)_T_$(2)_H_$(3)) \
9799
$$(TLIB$(1)_T_$(2)_H_$(3))/$(CFG_LIBRUSTC_$(3)) \
98100
| $$(TBIN$(1)_T_$(2)_H_$(3))/
99101
@$$(call E, compile_and_link: $$@)

mk/tests.mk

+8
Original file line numberDiff line numberDiff line change
@@ -319,50 +319,58 @@ endif
319319

320320
$(3)/stage$(1)/test/stdtest-$(2)$$(X_$(2)): \
321321
$$(STDLIB_CRATE) $$(STDLIB_INPUTS) \
322+
$$(SREQ$(1)_T_$(2)_H_$(3)) \
322323
$$(STDTESTDEP_$(1)_$(2)_$(3))
323324
@$$(call E, compile_and_link: $$@)
324325
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
325326

326327
$(3)/stage$(1)/test/extratest-$(2)$$(X_$(2)): \
327328
$$(EXTRALIB_CRATE) $$(EXTRALIB_INPUTS) \
329+
$$(SREQ$(1)_T_$(2)_H_$(3)) \
328330
$$(STDTESTDEP_$(1)_$(2)_$(3))
329331
@$$(call E, compile_and_link: $$@)
330332
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
331333

332334
$(3)/stage$(1)/test/syntaxtest-$(2)$$(X_$(2)): \
333335
$$(LIBSYNTAX_CRATE) $$(LIBSYNTAX_INPUTS) \
336+
$$(SREQ$(1)_T_$(2)_H_$(3)) \
334337
$$(STDTESTDEP_$(1)_$(2)_$(3))
335338
@$$(call E, compile_and_link: $$@)
336339
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
337340

338341
$(3)/stage$(1)/test/rustctest-$(2)$$(X_$(2)): CFG_COMPILER_TRIPLE = $(2)
339342
$(3)/stage$(1)/test/rustctest-$(2)$$(X_$(2)): \
340343
$$(COMPILER_CRATE) $$(COMPILER_INPUTS) \
344+
$$(SREQ$(1)_T_$(2)_H_$(3)) \
341345
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_RUSTLLVM_$(2)) \
342346
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBSYNTAX_$(2))
343347
@$$(call E, compile_and_link: $$@)
344348
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
345349

346350
$(3)/stage$(1)/test/rustpkgtest-$(2)$$(X_$(2)): \
347351
$$(RUSTPKG_LIB) $$(RUSTPKG_INPUTS) \
352+
$$(SREQ$(1)_T_$(2)_H_$(3)) \
348353
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC_$(2))
349354
@$$(call E, compile_and_link: $$@)
350355
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
351356

352357
$(3)/stage$(1)/test/rustitest-$(2)$$(X_$(2)): \
353358
$$(RUSTI_LIB) $$(RUSTI_INPUTS) \
359+
$$(SREQ$(1)_T_$(2)_H_$(3)) \
354360
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC_$(2))
355361
@$$(call E, compile_and_link: $$@)
356362
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
357363

358364
$(3)/stage$(1)/test/rusttest-$(2)$$(X_$(2)): \
359365
$$(RUST_LIB) $$(RUST_INPUTS) \
366+
$$(SREQ$(1)_T_$(2)_H_$(3)) \
360367
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC_$(2))
361368
@$$(call E, compile_and_link: $$@)
362369
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
363370

364371
$(3)/stage$(1)/test/rustdoctest-$(2)$$(X_$(2)): \
365372
$$(RUSTDOC_LIB) $$(RUSTDOC_INPUTS) \
373+
$$(SREQ$(1)_T_$(2)_H_$(3)) \
366374
$$(TLIB$(1)_T_$(2)_H_$(3))/$$(CFG_LIBRUSTC_$(2))
367375
@$$(call E, compile_and_link: $$@)
368376
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test

mk/tools.mk

+10-16
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,14 @@ define TOOLS_STAGE_N_TARGET
3737

3838
$$(TBIN$(1)_T_$(4)_H_$(3))/compiletest$$(X_$(4)): \
3939
$$(COMPILETEST_CRATE) $$(COMPILETEST_INPUTS) \
40-
$$(TSREQ$(1)_T_$(4)_H_$(3)) \
41-
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_STDLIB_$(4)) \
42-
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_EXTRALIB_$(4)) \
40+
$$(SREQ$(1)_T_$(4)_H_$(3)) \
4341
| $$(TBIN$(1)_T_$(4)_H_$(3))/
4442
@$$(call E, compile_and_link: $$@)
4543
$$(STAGE$(1)_T_$(4)_H_$(3)) -o $$@ $$<
4644

4745
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTPKG_$(4)): \
4846
$$(RUSTPKG_LIB) $$(RUSTPKG_INPUTS) \
49-
$$(TSREQ$(1)_T_$(4)_H_$(3)) \
50-
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_STDLIB_$(4)) \
51-
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_EXTRALIB_$(4)) \
47+
$$(SREQ$(1)_T_$(4)_H_$(3)) \
5248
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTC_$(4)) \
5349
| $$(TLIB$(1)_T_$(4)_H_$(3))/
5450
@$$(call E, compile_and_link: $$@)
@@ -58,16 +54,15 @@ $$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTPKG_$(4)): \
5854

5955
$$(TBIN$(1)_T_$(4)_H_$(3))/rustpkg$$(X_$(4)): \
6056
$$(DRIVER_CRATE) \
61-
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTPKG_$(4)) \
57+
$$(TSREQ$(1)_T_$(4)_H_$(3)) \
58+
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTPKG_$(4)) \
6259
| $$(TBIN$(1)_T_$(4)_H_$(3))/
6360
@$$(call E, compile_and_link: $$@)
6461
$$(STAGE$(1)_T_$(4)_H_$(3)) --cfg rustpkg -o $$@ $$<
6562

6663
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTDOC_$(4)): \
6764
$$(RUSTDOC_LIB) $$(RUSTDOC_INPUTS) \
68-
$$(TSREQ$(1)_T_$(4)_H_$(3)) \
69-
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_STDLIB_$(4)) \
70-
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_EXTRALIB_$(4)) \
65+
$$(SREQ$(1)_T_$(4)_H_$(3)) \
7166
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTC_$(4)) \
7267
| $$(TLIB$(1)_T_$(4)_H_$(3))/
7368
@$$(call E, compile_and_link: $$@)
@@ -77,16 +72,15 @@ $$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTDOC_$(4)): \
7772

7873
$$(TBIN$(1)_T_$(4)_H_$(3))/rustdoc$$(X_$(4)): \
7974
$$(DRIVER_CRATE) \
75+
$$(TSREQ$(1)_T_$(4)_H_$(3)) \
8076
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTDOC_$(4)) \
8177
| $$(TBIN$(1)_T_$(4)_H_$(3))/
8278
@$$(call E, compile_and_link: $$@)
8379
$$(STAGE$(1)_T_$(4)_H_$(3)) --cfg rustdoc -o $$@ $$<
8480

8581
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTI_$(4)): \
8682
$$(RUSTI_LIB) $$(RUSTI_INPUTS) \
87-
$$(TSREQ$(1)_T_$(4)_H_$(3)) \
88-
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_STDLIB_$(4)) \
89-
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_EXTRALIB_$(4)) \
83+
$$(SREQ$(1)_T_$(4)_H_$(3)) \
9084
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTC_$(4)) \
9185
| $$(TLIB$(1)_T_$(4)_H_$(3))/
9286
@$$(call E, compile_and_link: $$@)
@@ -96,16 +90,15 @@ $$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTI_$(4)): \
9690

9791
$$(TBIN$(1)_T_$(4)_H_$(3))/rusti$$(X_$(4)): \
9892
$$(DRIVER_CRATE) \
93+
$$(TSREQ$(1)_T_$(4)_H_$(3)) \
9994
$$(TLIB$(1)_T_$(4)_H_$(4))/$(CFG_LIBRUSTI_$(4)) \
10095
| $$(TBIN$(1)_T_$(4)_H_$(3))/
10196
@$$(call E, compile_and_link: $$@)
10297
$$(STAGE$(1)_T_$(4)_H_$(3)) --cfg rusti -o $$@ $$<
10398

10499
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUST_$(4)): \
105100
$$(RUST_LIB) $$(RUST_INPUTS) \
106-
$$(TSREQ$(1)_T_$(4)_H_$(3)) \
107-
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_STDLIB_$(4)) \
108-
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_EXTRALIB_$(4)) \
101+
$$(SREQ$(1)_T_$(4)_H_$(3)) \
109102
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTPKG_$(4)) \
110103
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTI_$(4)) \
111104
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUSTDOC_$(4)) \
@@ -118,6 +111,7 @@ $$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUST_$(4)): \
118111

119112
$$(TBIN$(1)_T_$(4)_H_$(3))/rust$$(X_$(4)): \
120113
$$(DRIVER_CRATE) \
114+
$$(TSREQ$(1)_T_$(4)_H_$(3)) \
121115
$$(TLIB$(1)_T_$(4)_H_$(3))/$(CFG_LIBRUST_$(4)) \
122116
| $$(TBIN$(1)_T_$(4)_H_$(3))/
123117
@$$(call E, compile_and_link: $$@)

0 commit comments

Comments
 (0)