Commit ed410b9c1e

Andrew Kelley <andrew@ziglang.org>
2024-01-08 21:43:10
lift artificial restriction on minimum glibc version
Fixes a regression introduced in c22d1c00a8825f60e7b01b97c6f73cbc21ca8257. See #17769
1 parent 8fd15c6
Changed files (2)
src/print_targets.zig
@@ -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();
 
src/target.zig
@@ -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;
             }