Skip to content

Commit 4d5bcbe

Browse files
authored
Rollup merge of #89033 - cuviper:sysroot-lib-path, r=Mark-Simulacrum
Set the library path in sysroot-crates-are-unstable Most of the `run-make-fulldeps` tests use a make-driven rustc command that includes `HOST_RPATH_DIR` in the library path, but this particular test runs from python instead. When the toolchain is built without `rpath` enabled, we need that library path in the environment so it can find its own libraries.
2 parents 3cff47b + 67edf94 commit 4d5bcbe

File tree

1 file changed

+13
-0
lines changed
  • src/test/run-make-fulldeps/sysroot-crates-are-unstable

1 file changed

+13
-0
lines changed

src/test/run-make-fulldeps/sysroot-crates-are-unstable/test.py

+13
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,17 @@ def convert_to_string(s):
1717
return s
1818

1919

20+
def set_ld_lib_path():
21+
var = os.environ.get("LD_LIB_PATH_ENVVAR")
22+
rpath = os.environ.get("HOST_RPATH_DIR")
23+
if var and rpath:
24+
path = os.environ.get(var)
25+
if path:
26+
os.environ[var] = rpath + os.pathsep + path
27+
else:
28+
os.environ[var] = rpath
29+
30+
2031
def exec_command(command, to_input=None):
2132
child = None
2233
if to_input is None:
@@ -50,7 +61,9 @@ def get_all_libs(dir_path):
5061
if isfile(join(dir_path, f)) and f.endswith('.rlib') and f not in STABLE_CRATES]
5162

5263

64+
set_ld_lib_path()
5365
sysroot = exec_command([os.environ['RUSTC'], '--print', 'sysroot'])[0].replace('\n', '')
66+
assert sysroot, "Could not read the rustc sysroot!"
5467
libs = get_all_libs(join(sysroot, 'lib/rustlib/{}/lib'.format(os.environ['TARGET'])))
5568

5669
ret = 0

0 commit comments

Comments
 (0)