Skip to content

Commit 34a224f

Browse files
committed
auto merge of #12530 : alexcrichton/rust/make-check-no-rpath, r=brson
This involves passing through LD_LIBRARY_PATH through more places, specifically in the compiletest, run-make, and doctest runners.
2 parents 25d6836 + e26ba36 commit 34a224f

File tree

8 files changed

+35
-14
lines changed

8 files changed

+35
-14
lines changed

mk/main.mk

+2-2
Original file line numberDiff line numberDiff line change
@@ -345,10 +345,10 @@ endif
345345
ifdef CFG_DISABLE_RPATH
346346
ifeq ($$(OSTYPE_$(3)),apple-darwin)
347347
RPATH_VAR$(1)_T_$(2)_H_$(3) := \
348-
DYLD_LIBRARY_PATH="$$$$DYLD_LIBRARY_PATH:$$(HLIB$(1)_H_$(3))"
348+
DYLD_LIBRARY_PATH="$$$$DYLD_LIBRARY_PATH:$$(CURDIR)/$$(HLIB$(1)_H_$(3))"
349349
else
350350
RPATH_VAR$(1)_T_$(2)_H_$(3) := \
351-
LD_LIBRARY_PATH="$$$$LD_LIBRARY_PATH:$$(HLIB$(1)_H_$(3))"
351+
LD_LIBRARY_PATH="$$$$LD_LIBRARY_PATH:$$(CURDIR)/$$(HLIB$(1)_H_$(3))"
352352
endif
353353
else
354354
RPATH_VAR$(1)_T_$(2)_H_$(3) :=

mk/tests.mk

+5-3
Original file line numberDiff line numberDiff line change
@@ -708,8 +708,9 @@ check-stage$(1)-T-$(2)-H-$(3)-doc-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3)
708708
ifeq ($(2),$$(CFG_BUILD))
709709
$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4)): $$(DOCTESTDEP_$(1)_$(2)_$(3)_$(4))
710710
@$$(call E, run doc-$(4) [$(2)])
711-
$$(Q)$$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) --test \
712-
$$(CRATEFILE_$(4)) --test-args "$$(TESTARGS)" && touch $$@
711+
$$(Q)$$(RPATH_VAR$(1)_T_$(2)_H_$(3)) \
712+
$$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) --test \
713+
$$(CRATEFILE_$(4)) --test-args "$$(TESTARGS)" && touch $$@
713714
else
714715
$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4)):
715716
touch $$@
@@ -936,7 +937,8 @@ $(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \
936937
$(3)/test/run-make/$$* \
937938
"$$(CC_$(3)) $$(CFG_GCCISH_CFLAGS_$(3))" \
938939
$$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \
939-
"$$(TESTNAME)"
940+
"$$(TESTNAME)" \
941+
"$$(RPATH_VAR$(1)_T_$(2)_H_$(3))"
940942
@touch $$@
941943
else
942944
# FIXME #11094 - The above rule doesn't work right for multiple targets

src/compiletest/procsrv.rs

+20-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,26 @@ fn target_env(lib_path: &str, prog: &str) -> ~[(~str,~str)] {
3535
#[cfg(target_os = "linux")]
3636
#[cfg(target_os = "macos")]
3737
#[cfg(target_os = "freebsd")]
38-
fn target_env(_lib_path: &str, _prog: &str) -> ~[(~str,~str)] {
39-
os::env()
38+
fn target_env(lib_path: &str, prog: &str) -> ~[(~str,~str)] {
39+
// Make sure we include the aux directory in the path
40+
let aux_path = prog + ".libaux";
41+
42+
let mut env = os::env();
43+
let var = if cfg!(target_os = "macos") {
44+
"DYLD_LIBRARY_PATH"
45+
} else {
46+
"LD_LIBRARY_PATH"
47+
};
48+
let prev = match env.iter().position(|&(ref k, _)| k.as_slice() == var) {
49+
Some(i) => env.remove(i).unwrap().val1(),
50+
None => ~"",
51+
};
52+
env.push((var.to_owned(), if prev.is_empty() {
53+
lib_path + ":" + aux_path
54+
} else {
55+
lib_path + ":" + aux_path + ":" + prev
56+
}));
57+
return env;
4058
}
4159

4260
pub struct Result {status: ProcessExit, out: ~str, err: ~str}

src/etc/maketest.py

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
os.putenv('CC', sys.argv[4])
1818
os.putenv('RUSTDOC', os.path.abspath(sys.argv[5]))
1919
filt = sys.argv[6]
20+
ldpath = sys.argv[7]
21+
if ldpath != '':
22+
os.putenv(ldpath.split('=')[0], ldpath.split('=')[1])
2023

2124
if not filt in sys.argv[1]:
2225
sys.exit(0)

src/test/run-make/bootstrap-from-c-with-green/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
all:
44
$(RUSTC) lib.rs -C gen-crate-map
55
ln -nsf $(call DYLIB,boot-*) $(call DYLIB,boot)
6-
$(CC) main.c -o $(call RUN,main) -lboot -Wl,-rpath,$(TMPDIR)
6+
$(CC) main.c -o $(call RUN,main) -lboot
77
$(call RUN,main)
88
rm $(call DYLIB,boot)
99
$(call FAIL,main)

src/test/run-make/bootstrap-from-c-with-native/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
all:
44
$(RUSTC) lib.rs -C gen-crate-map
55
ln -nsf $(call DYLIB,boot-*) $(call DYLIB,boot)
6-
$(CC) main.c -o $(call RUN,main) -lboot -Wl,-rpath,$(TMPDIR)
6+
$(CC) main.c -o $(call RUN,main) -lboot
77
$(call RUN,main)
88
rm $(call DYLIB,boot)
99
$(call FAIL,main)

src/test/run-make/c-dynamic-dylib/Makefile

-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
-include ../tools.mk
22

3-
# needed so that libfoo can find libcfoo
4-
ifeq ($(shell uname),Linux)
5-
export LD_LIBRARY_PATH := $(TMPDIR)
6-
endif
7-
83
# This hits an assertion in the linker on older versions of osx apparently
94
ifeq ($(shell uname),Darwin)
105
all:

src/test/run-make/tools.mk

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
export LD_LIBRARY_PATH:=$(TMPDIR):$(LD_LIBRARY_PATH)
2+
export DYLD_LIBRARY_PATH:=$(TMPDIR):$(DYLD_LIBRARY_PATH)
3+
14
RUSTC := $(RUSTC) --out-dir $(TMPDIR) -L $(TMPDIR)
25
CC := $(CC) -L $(TMPDIR)
36

0 commit comments

Comments
 (0)