diff --git a/core/os/os_darwin.odin b/core/os/os_darwin.odin index 5169572b5..36cd13804 100644 --- a/core/os/os_darwin.odin +++ b/core/os/os_darwin.odin @@ -1,8 +1,8 @@ package os foreign import dl "system:dl" -foreign import libc "system:c" -foreign import pthread "system:pthread" +foreign import libc "System.framework" +foreign import pthread "System.framework" import "core:runtime" import "core:strings" diff --git a/core/sys/darwin/mach_darwin.odin b/core/sys/darwin/mach_darwin.odin index 52a145507..25fc63c32 100644 --- a/core/sys/darwin/mach_darwin.odin +++ b/core/sys/darwin/mach_darwin.odin @@ -1,6 +1,6 @@ package darwin; -foreign import "system:pthread" +foreign import pthread "System.framework" import "core:c" diff --git a/core/time/time_unix.odin b/core/time/time_unix.odin index 3acc636e1..2419a3f8b 100644 --- a/core/time/time_unix.odin +++ b/core/time/time_unix.odin @@ -3,7 +3,12 @@ package time IS_SUPPORTED :: true; // NOTE: Times on Darwin are UTC. -foreign import libc "system:c" +when ODIN_OS == "darwin" { + foreign import libc "System.framework" +} else { + foreign import libc "system:c" +} + @(default_calling_convention="c") foreign libc { diff --git a/src/main.cpp b/src/main.cpp index e53f1b7d9..b15518d6e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -432,7 +432,11 @@ i32 linker_stage(lbGenerator *gen) { #endif , linker, object_files, LIT(output_base), LIT(output_ext), lib_str, - "-lc -lm", + #if defined(GB_SYSTEM_OSX) + "-lSystem -lm -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk", + #else + "-lc -lm", + #endif LIT(build_context.link_flags), LIT(build_context.extra_linker_flags), link_settings); @@ -2195,7 +2199,11 @@ int main(int arg_count, char const **arg_ptr) { #endif , linker, LIT(output_base), LIT(output_base), LIT(output_ext), lib_str, - "-lc -lm", + #if defined(GB_SYSTEM_OSX) + "-lSystem -lm -syslibroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk", + #else + "-lc -lm", + #endif LIT(build_context.link_flags), LIT(build_context.extra_linker_flags), link_settings);