Commit 0cb558ba3a

Andrew Kelley <andrew@ziglang.org>
2025-07-14 18:40:17
better default min versions for freebsd and netbsd
Without this change, by default you get a failure when trying to cross compile for these targets. freebsd was error: undefined symbol: __libc_start1 netbsd was warning: invalid target NetBSD libc version: 9.4.0 error: unable to build NetBSD libc shared objects: InvalidTargetLibCVersion now they work by default
1 parent 9dc4759
Changed files (2)
lib
test
lib/std/Target.zig
@@ -507,7 +507,7 @@ pub const Os = struct {
                 .freebsd => .{
                     .semver = .{
                         .min = blk: {
-                            const default_min: std.SemanticVersion = .{ .major = 13, .minor = 4, .patch = 0 };
+                            const default_min: std.SemanticVersion = .{ .major = 14, .minor = 0, .patch = 0 };
 
                             for (std.zig.target.available_libcs) |libc| {
                                 if (libc.arch != arch or libc.os != tag or libc.abi != abi) continue;
@@ -525,7 +525,7 @@ pub const Os = struct {
                 .netbsd => .{
                     .semver = .{
                         .min = blk: {
-                            const default_min: std.SemanticVersion = .{ .major = 9, .minor = 4, .patch = 0 };
+                            const default_min: std.SemanticVersion = .{ .major = 10, .minor = 1, .patch = 0 };
 
                             for (std.zig.target.available_libcs) |libc| {
                                 if (libc.arch != arch or libc.os != tag or libc.abi != abi) continue;
test/tests.zig
@@ -104,12 +104,6 @@ const test_targets = blk: {
             .target = .{
                 .cpu_arch = .aarch64,
                 .os_tag = .freebsd,
-                // Remove this when we bump our baseline to 14.0.0.
-                .os_version_min = .{ .semver = .{
-                    .major = 14,
-                    .minor = 0,
-                    .patch = 0,
-                } },
                 .abi = .none,
             },
             .link_libc = true,
@@ -119,12 +113,6 @@ const test_targets = blk: {
             .target = .{
                 .cpu_arch = .arm,
                 .os_tag = .freebsd,
-                // Remove this when we bump our baseline to 14.0.0.
-                .os_version_min = .{ .semver = .{
-                    .major = 14,
-                    .minor = 0,
-                    .patch = 0,
-                } },
                 .abi = .eabihf,
             },
             .link_libc = true,
@@ -136,12 +124,6 @@ const test_targets = blk: {
             .target = .{
                 .cpu_arch = .powerpc64,
                 .os_tag = .freebsd,
-                // Remove this when we bump our baseline to 14.0.0.
-                .os_version_min = .{ .semver = .{
-                    .major = 14,
-                    .minor = 0,
-                    .patch = 0,
-                } },
                 .abi = .none,
             },
             .link_libc = true,
@@ -151,12 +133,6 @@ const test_targets = blk: {
             .target = .{
                 .cpu_arch = .powerpc64le,
                 .os_tag = .freebsd,
-                // Remove this when we bump our baseline to 14.0.0.
-                .os_version_min = .{ .semver = .{
-                    .major = 14,
-                    .minor = 0,
-                    .patch = 0,
-                } },
                 .abi = .none,
             },
             .link_libc = true,
@@ -166,12 +142,6 @@ const test_targets = blk: {
             .target = .{
                 .cpu_arch = .riscv64,
                 .os_tag = .freebsd,
-                // Remove this when we bump our baseline to 14.0.0.
-                .os_version_min = .{ .semver = .{
-                    .major = 14,
-                    .minor = 0,
-                    .patch = 0,
-                } },
                 .abi = .none,
             },
             .link_libc = true,
@@ -181,12 +151,6 @@ const test_targets = blk: {
             .target = .{
                 .cpu_arch = .x86_64,
                 .os_tag = .freebsd,
-                // Remove this when we bump our baseline to 14.0.0.
-                .os_version_min = .{ .semver = .{
-                    .major = 14,
-                    .minor = 0,
-                    .patch = 0,
-                } },
                 .abi = .none,
             },
             .link_libc = true,
@@ -1236,12 +1200,6 @@ const test_targets = blk: {
             .target = .{
                 .cpu_arch = .aarch64,
                 .os_tag = .netbsd,
-                // Remove this when we bump our baseline to 10.1.0.
-                .os_version_min = .{ .semver = .{
-                    .major = 10,
-                    .minor = 1,
-                    .patch = 0,
-                } },
                 .abi = .none,
             },
             .link_libc = true,
@@ -1251,12 +1209,6 @@ const test_targets = blk: {
             .target = .{
                 .cpu_arch = .aarch64_be,
                 .os_tag = .netbsd,
-                // Remove this when we bump our baseline to 10.1.0.
-                .os_version_min = .{ .semver = .{
-                    .major = 10,
-                    .minor = 1,
-                    .patch = 0,
-                } },
                 .abi = .none,
             },
             .link_libc = true,
@@ -1266,12 +1218,6 @@ const test_targets = blk: {
             .target = .{
                 .cpu_arch = .arm,
                 .os_tag = .netbsd,
-                // Remove this when we bump our baseline to 10.1.0.
-                .os_version_min = .{ .semver = .{
-                    .major = 10,
-                    .minor = 1,
-                    .patch = 0,
-                } },
                 .abi = .eabi,
             },
             .link_libc = true,
@@ -1280,12 +1226,6 @@ const test_targets = blk: {
             .target = .{
                 .cpu_arch = .arm,
                 .os_tag = .netbsd,
-                // Remove this when we bump our baseline to 10.1.0.
-                .os_version_min = .{ .semver = .{
-                    .major = 10,
-                    .minor = 1,
-                    .patch = 0,
-                } },
                 .abi = .eabihf,
             },
             .link_libc = true,
@@ -1295,12 +1235,6 @@ const test_targets = blk: {
             .target = .{
                 .cpu_arch = .armeb,
                 .os_tag = .netbsd,
-                // Remove this when we bump our baseline to 10.1.0.
-                .os_version_min = .{ .semver = .{
-                    .major = 10,
-                    .minor = 1,
-                    .patch = 0,
-                } },
                 .abi = .eabi,
             },
             .link_libc = true,
@@ -1309,12 +1243,6 @@ const test_targets = blk: {
             .target = .{
                 .cpu_arch = .armeb,
                 .os_tag = .netbsd,
-                // Remove this when we bump our baseline to 10.1.0.
-                .os_version_min = .{ .semver = .{
-                    .major = 10,
-                    .minor = 1,
-                    .patch = 0,
-                } },
                 .abi = .eabihf,
             },
             .link_libc = true,
@@ -1324,12 +1252,6 @@ const test_targets = blk: {
             .target = .{
                 .cpu_arch = .mips,
                 .os_tag = .netbsd,
-                // Remove this when we bump our baseline to 10.1.0.
-                .os_version_min = .{ .semver = .{
-                    .major = 10,
-                    .minor = 1,
-                    .patch = 0,
-                } },
                 .abi = .eabi,
             },
             .link_libc = true,
@@ -1338,12 +1260,6 @@ const test_targets = blk: {
             .target = .{
                 .cpu_arch = .mips,
                 .os_tag = .netbsd,
-                // Remove this when we bump our baseline to 10.1.0.
-                .os_version_min = .{ .semver = .{
-                    .major = 10,
-                    .minor = 1,
-                    .patch = 0,
-                } },
                 .abi = .eabihf,
             },
             .link_libc = true,
@@ -1353,12 +1269,6 @@ const test_targets = blk: {
             .target = .{
                 .cpu_arch = .mipsel,
                 .os_tag = .netbsd,
-                // Remove this when we bump our baseline to 10.1.0.
-                .os_version_min = .{ .semver = .{
-                    .major = 10,
-                    .minor = 1,
-                    .patch = 0,
-                } },
                 .abi = .eabi,
             },
             .link_libc = true,
@@ -1367,12 +1277,6 @@ const test_targets = blk: {
             .target = .{
                 .cpu_arch = .mipsel,
                 .os_tag = .netbsd,
-                // Remove this when we bump our baseline to 10.1.0.
-                .os_version_min = .{ .semver = .{
-                    .major = 10,
-                    .minor = 1,
-                    .patch = 0,
-                } },
                 .abi = .eabihf,
             },
             .link_libc = true,
@@ -1382,12 +1286,6 @@ const test_targets = blk: {
             .target = .{
                 .cpu_arch = .powerpc,
                 .os_tag = .netbsd,
-                // Remove this when we bump our baseline to 10.1.0.
-                .os_version_min = .{ .semver = .{
-                    .major = 10,
-                    .minor = 1,
-                    .patch = 0,
-                } },
                 .abi = .eabi,
             },
             .link_libc = true,
@@ -1396,12 +1294,6 @@ const test_targets = blk: {
             .target = .{
                 .cpu_arch = .powerpc,
                 .os_tag = .netbsd,
-                // Remove this when we bump our baseline to 10.1.0.
-                .os_version_min = .{ .semver = .{
-                    .major = 10,
-                    .minor = 1,
-                    .patch = 0,
-                } },
                 .abi = .eabihf,
             },
             .link_libc = true,
@@ -1411,12 +1303,6 @@ const test_targets = blk: {
             .target = .{
                 .cpu_arch = .x86,
                 .os_tag = .netbsd,
-                // Remove this when we bump our baseline to 10.1.0.
-                .os_version_min = .{ .semver = .{
-                    .major = 10,
-                    .minor = 1,
-                    .patch = 0,
-                } },
                 .abi = .none,
             },
             .link_libc = true,
@@ -1426,12 +1312,6 @@ const test_targets = blk: {
             .target = .{
                 .cpu_arch = .x86_64,
                 .os_tag = .netbsd,
-                // Remove this when we bump our baseline to 10.1.0.
-                .os_version_min = .{ .semver = .{
-                    .major = 10,
-                    .minor = 1,
-                    .patch = 0,
-                } },
                 .abi = .none,
             },
             .link_libc = true,