Skip to content

Commit b678600

Browse files
committed
Auto merge of #32576 - alexcrichton:metadata-for-our-crates, r=brson
mk: Fix cross-host builds The change in b20e748 had the unintended consequence of breaking cross-host builds as we apparently relied on the incorrect definition of this variable in the makefiles. That change, however, was required to get tests passing so we couldn't just revert it. This commit fixes the underlying bug by leaving the "more correct" definition of `LD_LIBRARY_PATH_ENV_TARGETDIR` (also fixing it with a hardcoded reference to `CFG_BUILD`) and updating the `RPATH_VAR` definition below. Turned out we already had special-casing logic for passing `--cfg stage1` during the well-we-print-this-as-stage0 build of a cross-host. That logic was just updated to pull from a different variable as opposed to relying on the definition of that variable to accommodate this. Closes #32568
2 parents ec666a5 + 694d883 commit b678600

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

mk/main.mk

+5-9
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ endif
493493
LD_LIBRARY_PATH_ENV_HOSTDIR$(1)_T_$(2)_H_$(3) := \
494494
$$(CURDIR)/$$(HLIB$(1)_H_$(3)):$$(CFG_LLVM_INST_DIR_$(3))/lib
495495
LD_LIBRARY_PATH_ENV_TARGETDIR$(1)_T_$(2)_H_$(3) := \
496-
$$(CURDIR)/$$(TLIB$(1)_T_$(2)_H_$(CFG_BUILD))
496+
$$(CURDIR)/$$(TLIB$(1)_T_$(2)_H_$(3))
497497

498498
HOST_RPATH_VAR$(1)_T_$(2)_H_$(3) := \
499499
$$(LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3))=$$(LD_LIBRARY_PATH_ENV_HOSTDIR$(1)_T_$(2)_H_$(3)):$$$$$$(LD_LIBRARY_PATH_ENV_NAME$(1)_T_$(2)_H_$(3))
@@ -506,18 +506,14 @@ RPATH_VAR$(1)_T_$(2)_H_$(3) := $$(HOST_RPATH_VAR$(1)_T_$(2)_H_$(3))
506506
# if you're building a cross config, the host->* parts are
507507
# effectively stage1, since it uses the just-built stage0.
508508
#
509-
# This logic is similar to how the LD_LIBRARY_PATH variable must
510-
# change be slightly different when doing cross compilations.
511-
# The build doesn't copy over all target libraries into
512-
# a new directory, so we need to point the library path at
513-
# the build directory where all the target libraries came
514-
# from (the stage0 build host). Otherwise the relative rpaths
515-
# inside of the rustc binary won't get resolved correctly.
509+
# Also be sure to use the right rpath because we're loading libraries from the
510+
# CFG_BUILD's stage1 directory for our target, so switch this one instance of
511+
# `RPATH_VAR` to get the bootstrap working.
516512
ifeq ($(1),0)
517513
ifneq ($(strip $(CFG_BUILD)),$(strip $(3)))
518514
CFGFLAG$(1)_T_$(2)_H_$(3) = stage1
519515

520-
RPATH_VAR$(1)_T_$(2)_H_$(3) := $$(TARGET_RPATH_VAR$(1)_T_$(2)_H_$(3))
516+
RPATH_VAR$(1)_T_$(2)_H_$(3) := $$(TARGET_RPATH_VAR1_T_$(2)_H_$$(CFG_BUILD))
521517
endif
522518
endif
523519

0 commit comments

Comments
 (0)