Skip to content

Commit e26ba36

Browse files
committed
mk: Get "make check" passing with --disable-rpath
This involves passing through LD_LIBRARY_PATH through more places, specifically in the compiletest, run-make, and doctest runners.
1 parent 78d4bf8 commit e26ba36

File tree

8 files changed

+35
-14
lines changed

8 files changed

+35
-14
lines changed

Diff for: mk/main.mk

+2-2
Original file line numberDiff line numberDiff line change
@@ -341,10 +341,10 @@ endif
341341
ifdef CFG_DISABLE_RPATH
342342
ifeq ($$(OSTYPE_$(3)),apple-darwin)
343343
RPATH_VAR$(1)_T_$(2)_H_$(3) := \
344-
DYLD_LIBRARY_PATH="$$$$DYLD_LIBRARY_PATH:$$(HLIB$(1)_H_$(3))"
344+
DYLD_LIBRARY_PATH="$$$$DYLD_LIBRARY_PATH:$$(CURDIR)/$$(HLIB$(1)_H_$(3))"
345345
else
346346
RPATH_VAR$(1)_T_$(2)_H_$(3) := \
347-
LD_LIBRARY_PATH="$$$$LD_LIBRARY_PATH:$$(HLIB$(1)_H_$(3))"
347+
LD_LIBRARY_PATH="$$$$LD_LIBRARY_PATH:$$(CURDIR)/$$(HLIB$(1)_H_$(3))"
348348
endif
349349
else
350350
RPATH_VAR$(1)_T_$(2)_H_$(3) :=

Diff for: mk/tests.mk

+5-3
Original file line numberDiff line numberDiff line change
@@ -706,8 +706,9 @@ check-stage$(1)-T-$(2)-H-$(3)-doc-$(4)-exec: $$(call TEST_OK_FILE,$(1),$(2),$(3)
706706
ifeq ($(2),$$(CFG_BUILD))
707707
$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4)): $$(DOCTESTDEP_$(1)_$(2)_$(3)_$(4))
708708
@$$(call E, run doc-$(4) [$(2)])
709-
$$(Q)$$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) --test \
710-
$$(CRATEFILE_$(4)) --test-args "$$(TESTARGS)" && touch $$@
709+
$$(Q)$$(RPATH_VAR$(1)_T_$(2)_H_$(3)) \
710+
$$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) --test \
711+
$$(CRATEFILE_$(4)) --test-args "$$(TESTARGS)" && touch $$@
711712
else
712713
$$(call TEST_OK_FILE,$(1),$(2),$(3),doc-$(4)):
713714
touch $$@
@@ -934,7 +935,8 @@ $(3)/test/run-make/%-$(1)-T-$(2)-H-$(3).ok: \
934935
$(3)/test/run-make/$$* \
935936
"$$(CC_$(3)) $$(CFG_GCCISH_CFLAGS_$(3))" \
936937
$$(HBIN$(1)_H_$(3))/rustdoc$$(X_$(3)) \
937-
"$$(TESTNAME)"
938+
"$$(TESTNAME)" \
939+
"$$(RPATH_VAR$(1)_T_$(2)_H_$(3))"
938940
@touch $$@
939941
else
940942
# FIXME #11094 - The above rule doesn't work right for multiple targets

Diff for: src/compiletest/procsrv.rs

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

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

Diff for: 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)

Diff for: 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)

Diff for: 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)

Diff for: 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:

Diff for: 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)