From ef808e9172f2e4fc90cf741c1d872e77fbb7125e Mon Sep 17 00:00:00 2001 From: Vincent Rischmann Date: Sat, 13 Mar 2021 21:33:39 +0100 Subject: build: fix building with glibc sqlite3 requires at least glibc 2.28 from my testing; prevent building the tests using anything below that. --- build.zig | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/build.zig b/build.zig index 2c958b9..a1af313 100644 --- a/build.zig +++ b/build.zig @@ -13,7 +13,27 @@ fn linkSqlite(b: *std.build.LibExeObjStep) void { } pub fn build(b: *std.build.Builder) void { - const target = b.standardTargetOptions(.{}); + const target = blk: { + var tmp = b.standardTargetOptions(.{}); + + if (tmp.isGnuLibC()) { + const min_glibc_version = std.builtin.Version{ + .major = 2, + .minor = 28, + .patch = 0, + }; + if (tmp.glibc_version) |ver| { + if (ver.order(min_glibc_version) == .lt) { + std.debug.panic("sqlite requires glibc version >= 2.28", .{}); + } + } else { + tmp.setGnuLibCVersion(2, 28, 0); + } + } + + break :blk tmp; + }; + const mode = b.standardReleaseOptions(); const in_memory = b.option(bool, "in_memory", "Should the tests run with sqlite in memory (default true)") orelse true; -- cgit v1.2.3