#9135 Fix lzfse build on FreeBSD by setting _XOPEN_SOURCE=600 in gradle

On FreeBSD 15 with clang 19 and -std=c99, <sys/time.h> 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.
This commit is contained in:
cl45h
2026-04-21 20:16:24 -03:00
parent b211a07b51
commit 250862123d

View File

@@ -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"
}
}
}
}