From 250862123d7fa5be770081652f1c5bfe33ba2404 Mon Sep 17 00:00:00 2001 From: cl45h Date: Tue, 21 Apr 2026 20:16:24 -0300 Subject: [PATCH] #9135 Fix lzfse build on FreeBSD by setting _XOPEN_SOURCE=600 in gradle On FreeBSD 15 with clang 19 and -std=c99, only exposes gettimeofday() when __XSI_VISIBLE is set, which requires a feature test macro to be defined before system headers are included. Without it, clang 19 errors out on the implicit declaration. Rather than modify the third-party lzfse source, set _XOPEN_SOURCE=600 via b.cCompiler.define in buildNatives.gradle, scoped to the FreeBSD target under the Clang toolchain. Linux, macOS and Windows builds are untouched, and the lzfse source stays bit-identical to upstream. --- Ghidra/Features/FileFormats/buildNatives.gradle | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Ghidra/Features/FileFormats/buildNatives.gradle b/Ghidra/Features/FileFormats/buildNatives.gradle index d6a4cf3c9f..7501715968 100644 --- a/Ghidra/Features/FileFormats/buildNatives.gradle +++ b/Ghidra/Features/FileFormats/buildNatives.gradle @@ -83,6 +83,9 @@ model { b.cCompiler.args "-std=c99" b.cCompiler.args "-Wall" b.cCompiler.args "-O2" + if (b.targetPlatform.operatingSystem.name == "freebsd") { + b.cCompiler.define "_XOPEN_SOURCE", "600" + } } } }