From 16cc5ddacbde23a71d05535f6b51298d295535df Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Wed, 29 May 2019 09:39:49 +0200 Subject: [PATCH] tweak logic for determining rustc default target --- miri | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/miri b/miri index d683a0853008..2181403b7bde 100755 --- a/miri +++ b/miri @@ -33,13 +33,19 @@ EOF ) ## Preparation -# I'd love to use `jq` for parsing the JSON properly, but macOS is totally underequipped for this kind of work. -TARGET=$(rustc --print target-spec-json -Z unstable-options | grep llvm-target | cut -d '"' -f 4) +TARGET=$(rustc --version --verbose | grep "^host:" | cut -d ' ' -f 2) SYSROOT=$(rustc --print sysroot) +LIBDIR=$SYSROOT/lib/rustlib/$TARGET/lib +if ! test -d "$LIBDIR"; then + echo "Something went wrong determining the library dir." + echo "I got $LIBDIR but that does not exist." + echo "Please report a bug at https://github.com/rust-lang/miri/issues." + exit 2 +fi # We set the rpath so that Miri finds the private rustc libraries it needs. # We enable debug-assertions to get tracing. # We enable line-only debuginfo for backtraces. -export RUSTFLAGS="-C link-args=-Wl,-rpath,$SYSROOT/lib/rustlib/$TARGET/lib -C debug-assertions -C debuginfo=1" +export RUSTFLAGS="-C link-args=-Wl,-rpath,$LIBDIR -C debug-assertions -C debuginfo=1" ## Helper functions