Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add environment info to make troubleshoot. #171

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
46 changes: 46 additions & 0 deletions bin/get-troubleshoot-info
@@ -0,0 +1,46 @@
#!/bin/bash

# Create Markdown output for sharing as troubleshooting info.

# Convenience functions
heading() { printf "\n# %s\n" "$1"; }
subheading() { printf "\n## %s\n" "$1"; }
item() { printf "* **%s:** %s\n" "$1" "$2"; }
code() { printf "\`\`\`%s\n%s\n\`\`\`\n" "$1" "$2"; }

# Gather some preliminary info for the script.
has_xcode="$([[ -x /usr/bin/xcrun ]] && echo 1)"

# Print OS, tool, etc versions.
heading "Environment"
subheading "Hardware"
item 'Operating System' "$(uname -sm) $([[ -x /usr/bin/sw_vers ]] && sw_vers -productVersion)"
item 'Device' "$(uname -i)"

subheading "Toolchain"
item 'Theos' "$(cd "$THEOS"; git rev-parse master)"
item 'Make' "$("$MAKE" --version | head -1)"
item 'Perl' "$(perl -e 'print $^V')"
item 'Git' "$(git --version)"
item 'Dpkg' "$(dpkg-deb --version | head -1)"
[[ $has_xcode == 1 ]] && item 'Xcode' "$(xcrun xcodebuild -version)"
item 'Clang' "$(clang --version 2>&1)"
item 'Swift' "$(swift --version 2>&1)"

subheading "Directories"
item 'Location' "$THEOS"
item 'Toolchains' "$THEOS/toolchains/*" 2>/dev/null
item 'SDKs' "$THEOS/sdks/*" 2>/dev/null
[[ $has_xcode == 1 ]] && item 'Developer Path' "$(xcode-select -print-path)"

subheading "Current Instance"
item 'Target' "$([[ -z "$TARGET" ]] && echo "$TARGET" || echo Not set)"
item 'System Root' "$([[ -z "$SYSROOT" ]] && echo "$SYSROOT" || echo Not set)"

# Makefile
heading "Makefile"
code make "$(cat "$MAKEFILE_NAME")"

# Perform a build.
heading "Build Output"
code ansi "$("$MAKE" -f "$MAKEFILE_NAME" --no-keep-going clean all messages=yes FORCE_COLOR=yes 2>&1)"
10 changes: 6 additions & 4 deletions makefiles/master/rules.mk
Expand Up @@ -6,7 +6,8 @@ all::
endif

.PHONY: all before-all internal-all after-all \
clean before-clean internal-clean after-clean update-theos
clean before-clean internal-clean after-clean \
troubleshoot update-theos
ifeq ($(THEOS_BUILD_DIR),.)
all:: $(_THEOS_BUILD_SESSION_FILE) before-all internal-all after-all
else
Expand Down Expand Up @@ -160,12 +161,13 @@ update-theos::

troubleshoot::
@$(PRINT_FORMAT) "Be sure to check the troubleshooting page at https://github.com/theos/theos/wiki/Troubleshooting first."
@$(PRINT_FORMAT) "For support with build errors, ask on IRC: http://iphonedevwiki.net/index.php/IRC. If you think you've found a bug in Theos, check the issue tracker at https://github.com/theos/theos/issues."
@$(PRINT_FORMAT) "For support with build errors, ask on IRC: http://iphonedevwiki.net/index.php/IRC. If you think youve found a bug in Theos, check the issue tracker at https://github.com/theos/theos/issues."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change needed?

@echo

ifeq ($(call __executable,ghost),$(_THEOS_TRUE))
@$(PRINT_FORMAT) "Creating a Ghostbin containing the output of \`make clean all messages=yes\`…"
$(MAKE) -f $(_THEOS_PROJECT_MAKEFILE_NAME) --no-print-directory --no-keep-going clean all messages=yes FORCE_COLOR=yes 2>&1 | ghost -x 2w - ansi
@$(PRINT_FORMAT_STAGE) 6 "Gathering troubleshooting information and uploading to Ghostbin"
$(ECHO_NOTHING)MAKE="$(MAKE)" MAKEFILE_NAME="$(_THEOS_PROJECT_MAKEFILE_NAME)" TARGET="$(TARGET)" SYSROOT="$(SYSROOT)" \
$(THEOS_BIN_PATH)/get-troubleshoot-info | ghost -x 2w - markdown$(ECHO_END)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add -S https://ghostbin.co to ghost's arguments.

else
@$(PRINT_FORMAT_ERROR) "You don't have ghost installed. For more information, refer to https://github.com/theos/theos/wiki/Installation#prerequisites." >&2; exit 1
endif
Expand Down