From 045d8bfd1e01cac8d964b6aad5166f451ec23f4e Mon Sep 17 00:00:00 2001 From: lethosor Date: Tue, 14 Jan 2020 23:54:51 -0500 Subject: [PATCH] Linux launcher: attempt to fall back to a working architecture for setarch Also include directions if this fails Closes #1466 --- package/linux/dfhack | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/package/linux/dfhack b/package/linux/dfhack index d0c70765b..1bd3e8d92 100755 --- a/package/linux/dfhack +++ b/package/linux/dfhack @@ -69,6 +69,16 @@ fi PRELOAD_LIB="${PRELOAD_LIB:+$PRELOAD_LIB:}${LIBSAN}${LIB}" setarch_arch=$(cat hack/dfhack_setarch.txt || printf i386) +if ! setarch "$setarch_arch" -R true 2>/dev/null; then + echo "warn: architecture '$setarch_arch' not supported by setarch" >&2 + if [ "$setarch_arch" = "i386" ]; then + setarch_arch=linux32 + else + setarch_arch=linux64 + fi + echo "using '$setarch_arch' instead. To silence this warning, edit" >&2 + echo "hack/dfhack_setarch.txt to contain an architecture that works on your system." >&2 +fi case "$1" in -g | --gdb)