Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-2928: Better error handling and documentation for unsupported versions of visual studio

Ryan Kurtz1fee5170248a
diff --git a/GPL/nativeBuildProperties.gradle b/GPL/nativeBuildProperties.gradle
index 4d887dba10..5e9c33f4eb 100644
--- a/GPL/nativeBuildProperties.gradle
+++ b/GPL/nativeBuildProperties.gradle
@@ -71,7 +71,7 @@ task CheckToolChain {
if (isCurrentWindows()) {
// ensure that required MS Visual Studio is installed
if (!VISUAL_STUDIO_INSTALL_DIR) {
- throw new GradleException("Visual Studio not found!");
+ throw new GradleException("Supported Windows native toolchain not found!");
}
}
}
diff --git a/GPL/vsconfig.gradle b/GPL/vsconfig.gradle
index 4fe1edc223..797c89e390 100644
--- a/GPL/vsconfig.gradle
+++ b/GPL/vsconfig.gradle
@@ -32,7 +32,20 @@ def configureVisualStudio() {
println " -> Visual Studio vswhere.exe not found!"
return
}
- def vswhereOutput = "${vswherePath} -products * -latest -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -format json".execute().text.trim()
+ def vswhereProcess = "${vswherePath} -products * -latest -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -format json -utf8".execute()
+ def vswhereOutput = vswhereProcess.text.trim()
+ def vswhereExit = vswhereProcess.exitValue()
+ if (vswhereExit != 0) {
+ if (vswhereExit == 87) { // ERROR_INVALID_PARAMATER
+ println " -> Visual Studio vswhere.exe was passed an unsupported argument!"
+ }
+ else {
+ println " -> Visual Studio vswhere.exe returned an error code (${vswhereExit})!"
+ }
+ println " -> Please confirm ${vswherePath} is version 2.5 or later."
+ println " -> Please check README.md or InstallationGuide.html to verify you are using a supported version of Visual Studio."
+ return
+ }
def vswhereJson = new groovy.json.JsonSlurper().parseText(vswhereOutput);
if (vswhereJson.isEmpty()) {
println " -> Visual Studio not found!"
diff --git a/README.md b/README.md
index f6ca04aa62..ae6968650b 100644
--- a/README.md
+++ b/README.md
@@ -46,8 +46,8 @@ To create the latest development build for your platform from this source reposi
* [JDK 17 64-bit][jdk17]
* [Gradle 7.3+][gradle]
* make, gcc, and g++ (Linux/macOS-only)
-* [Microsoft Visual Studio][vs] or [Microsoft C++ Build Tools][vcbuildtools] with the following
- components installed (Windows-only):
+* [Microsoft Visual Studio][vs] 2017+ or [Microsoft C++ Build Tools][vcbuildtools] with the
+ following components installed (Windows-only):
- MSVC
- Windows SDK
- C++ ATL