Skip to content

Commit 16cc5dd

Browse files
committed
tweak logic for determining rustc default target
1 parent 35b4d9f commit 16cc5dd

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

miri

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,19 @@ EOF
3333
)
3434

3535
## Preparation
36-
# I'd love to use `jq` for parsing the JSON properly, but macOS is totally underequipped for this kind of work.
37-
TARGET=$(rustc --print target-spec-json -Z unstable-options | grep llvm-target | cut -d '"' -f 4)
36+
TARGET=$(rustc --version --verbose | grep "^host:" | cut -d ' ' -f 2)
3837
SYSROOT=$(rustc --print sysroot)
38+
LIBDIR=$SYSROOT/lib/rustlib/$TARGET/lib
39+
if ! test -d "$LIBDIR"; then
40+
echo "Something went wrong determining the library dir."
41+
echo "I got $LIBDIR but that does not exist."
42+
echo "Please report a bug at https://github.com/rust-lang/miri/issues."
43+
exit 2
44+
fi
3945
# We set the rpath so that Miri finds the private rustc libraries it needs.
4046
# We enable debug-assertions to get tracing.
4147
# We enable line-only debuginfo for backtraces.
42-
export RUSTFLAGS="-C link-args=-Wl,-rpath,$SYSROOT/lib/rustlib/$TARGET/lib -C debug-assertions -C debuginfo=1"
48+
export RUSTFLAGS="-C link-args=-Wl,-rpath,$LIBDIR -C debug-assertions -C debuginfo=1"
4349

4450
## Helper functions
4551

0 commit comments

Comments
 (0)