Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-5547: Improved Gradle support for building natives on AARCH64

Ryan Kurtzd6cfb2e0b902
diff --git a/GPL/nativeBuildProperties.gradle b/GPL/nativeBuildProperties.gradle
index 24464f6cd5..23eb20a824 100644
--- a/GPL/nativeBuildProperties.gradle
+++ b/GPL/nativeBuildProperties.gradle
@@ -34,37 +34,23 @@ model {
}
}
- // The toolChains block is needed because Gradle doesn't find gcc/clang on ARM-based Linux
- // and macOS platforms without explicitly declaring their targets. Might be a bug in the
- // native Gradle plugin.
+ // The toolChains block is needed because Gradle doesn't find the native toolchain in various
+ // scenarios. These checks, can be removed when Gradle fixes them, and we advertise a
+ // minimum Gradle version that includes the fix.
toolChains {
- if (isCurrentLinux()) {
- gcc(Gcc) {
- if (isCurrentArm_64()) {
- target("linux_arm_64")
- }
- }
+ def current = getCurrentPlatformName()
+ if (isLinux(current)) {
+ // https://github.com/gradle/gradle/issues/17660 (fixed in Gradle 8.11)
+ gcc(Gcc).target(current)
+ clang(Clang).target(current)
}
- if (isCurrentMac()) {
- clang(Clang) {
- if (isCurrentArm_64()) {
- target("mac_arm_64")
- }
- }
- }
- if (isCurrentFreeBSD()) {
- gcc(Gcc) {
- if (isCurrentArm_64()) {
- target("freebsd_arm_64")
- }
- else {
- target("freebsd_x86_64")
- }
- }
+ if (isFreeBSD(current)) {
+ // https://github.com/gradle/gradle/issues/32895
+ gcc(Gcc).target(current)
+ clang(Clang).target(current)
}
- if (isCurrentWindows() && VISUAL_STUDIO_INSTALL_DIR) {
- // specify installDir because Gradle doesn't find VS Build Tools.
- // See https://github.com/gradle/gradle-native/issues/617#issuecomment-575735288
+ if (isWindows(current) && VISUAL_STUDIO_INSTALL_DIR) {
+ // https://github.com/gradle/gradle-native/issues/617#issuecomment-575735288
visualCpp(VisualCpp) {
installDir = VISUAL_STUDIO_INSTALL_DIR
}
diff --git a/GhidraDocs/InstallationGuide.md b/GhidraDocs/InstallationGuide.md
index f6dbdd2f81..dd7b367f45 100644
--- a/GhidraDocs/InstallationGuide.md
+++ b/GhidraDocs/InstallationGuide.md
@@ -211,8 +211,7 @@ binaries for your platform, you will need the following installed on your system
App Store while _Command Line Tools for Xcode_ may be installed using the command:
`xcode-select --install`.
* __Linux/FreeBSD:__ the 64-bit versions of the following packages should installed:
- * gcc 8.5 or later
- * gcc-c++ / g++ 8.5 or later
+ * gcc/g++ or clang
* make
* __Windows:__
[Microsoft Visual Studio](https://visualstudio.microsoft.com/vs/community) 2017 or later, or
diff --git a/README.md b/README.md
index 433c70caa4..2ed945893c 100644
--- a/README.md
+++ b/README.md
@@ -47,7 +47,7 @@ To create the latest development build for your platform from this source reposi
* [JDK 21 64-bit][jdk]
* [Gradle 8.5+][gradle] (or provided Gradle wrapper if Internet connection is available)
* [Python3][python3] (version 3.9 to 3.13) with bundled pip
-* make, gcc, and g++ (Linux/macOS-only)
+* make, gcc/g++ or clang (Linux/macOS-only)
* [Microsoft Visual Studio][vs] 2017+ or [Microsoft C++ Build Tools][vcbuildtools] with the
following components installed (Windows-only):
- MSVC