Skip to content

Commit 4270f23

Browse files
committed
Skip detecting native libc dirs on darwin
This is handled before by detecting and adding SDK path which is a centralised point for the native libc installation on darwin.
1 parent 1954cdc commit 4270f23

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/Compilation.zig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3792,6 +3792,13 @@ fn detectLibCIncludeDirs(
37923792
// If linking system libraries and targeting the native abi, default to
37933793
// using the system libc installation.
37943794
if (link_system_libs and is_native_abi and !target.isMinGW()) {
3795+
if (target.isDarwin()) {
3796+
// For Darwin/macOS, we are all set with getSDKPath found earlier.
3797+
return LibCDirs{
3798+
.libc_include_dir_list = &[0][]u8{},
3799+
.libc_installation = null,
3800+
};
3801+
}
37953802
const libc = try arena.create(LibCInstallation);
37963803
libc.* = try LibCInstallation.findNative(.{ .allocator = arena, .verbose = true });
37973804
return detectLibCFromLibCInstallation(arena, target, libc);

src/libc_installation.zig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,9 @@ pub const LibCInstallation = struct {
185185
pub fn findNative(args: FindNativeOptions) FindError!LibCInstallation {
186186
var self: LibCInstallation = .{};
187187

188-
if (is_windows) {
188+
if (is_darwin) {
189+
@panic("Darwin is handled separately via std.zig.system.darwin module");
190+
} else if (is_windows) {
189191
if (!build_options.have_llvm)
190192
return error.WindowsSdkNotFound;
191193
var sdk: *ZigWindowsSDK = undefined;

0 commit comments

Comments
 (0)