lift artificial restriction on minimum glibc version

Fixes a regression introduced in
c22d1c00a8.

See #17769
This commit is contained in:
Andrew Kelley
2024-01-08 13:43:10 -07:00
parent 8fd15c6ca8
commit ed410b9c1e
2 changed files with 5 additions and 14 deletions

View File

@@ -79,12 +79,9 @@ pub fn cmdTargets(
try jws.objectField("glibc");
try jws.beginArray();
for (glibc_abi.all_versions) |ver| {
// Actual glibc minimum is architecture specific. This just covers the broadest minimum.
if (ver.order(target.glibc_min_version) != .lt) {
const tmp = try std.fmt.allocPrint(allocator, "{}", .{ver});
defer allocator.free(tmp);
try jws.write(tmp);
}
const tmp = try std.fmt.allocPrint(allocator, "{}", .{ver});
defer allocator.free(tmp);
try jws.write(tmp);
}
try jws.endArray();

View File

@@ -12,10 +12,7 @@ pub const ArchOsAbi = struct {
abi: std.Target.Abi,
os_ver: ?std.SemanticVersion = null,
// Minimum glibc version that provides support for the arch/os (for
// .abi = .gnu). For most entries, the .glibc_min is null,
// meaning the Zig minimum required by the standard library (see
// glibc_min_version) is sufficient.
// Minimum glibc version that provides support for the arch/os when ABI is GNU.
glibc_min: ?std.SemanticVersion = null,
};
@@ -82,9 +79,6 @@ pub const available_libcs = [_]ArchOsAbi{
.{ .arch = .x86_64, .os = .macos, .abi = .none, .os_ver = .{ .major = 10, .minor = 7, .patch = 0 } },
};
/// Minimum glibc version, due to dependencies from the Zig standard library on glibc symbols
pub const glibc_min_version: std.SemanticVersion = .{ .major = 2, .minor = 17, .patch = 0 };
pub fn libCGenericName(target: std.Target) [:0]const u8 {
switch (target.os.tag) {
.windows => return "mingw",
@@ -165,7 +159,7 @@ pub fn canBuildLibC(target: std.Target) bool {
}
// Ensure glibc (aka *-linux-gnu) version is supported
if (target.isGnuLibC()) {
const min_glibc_ver = libc.glibc_min orelse glibc_min_version;
const min_glibc_ver = libc.glibc_min orelse return true;
const target_glibc_ver = target.os.version_range.linux.glibc;
return target_glibc_ver.order(min_glibc_ver) != .lt;
}