<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">--- include/spdlog/details/os-inl.h	2021-03-26 03:00:48.000000000 +0800
+++ include/spdlog/details/os-inl.h	2024-04-22 00:29:01.000000000 +0800
@@ -42,6 +42,10 @@
 #include &lt;fcntl.h&gt;
 #include &lt;unistd.h&gt;
 
+#if defined __APPLE__
+#include &lt;AvailabilityMacros.h&gt;
+#endif
+
 #ifdef __linux__
 #include &lt;sys/syscall.h&gt; //Use gettid() syscall under linux to get thread id
 
@@ -336,7 +340,17 @@
     return static_cast&lt;size_t&gt;(::thr_self());
 #elif __APPLE__
     uint64_t tid;
+#if (MAC_OS_X_VERSION_MAX_ALLOWED &lt; 1060) || defined(__POWERPC__)
+        tid = pthread_mach_thread_np(pthread_self());
+#elif MAC_OS_X_VERSION_MIN_REQUIRED &lt; 1060
+    if (&amp;pthread_threadid_np) {
+        pthread_threadid_np(nullptr, &amp;tid);
+    } else {
+        tid = pthread_mach_thread_np(pthread_self());
+    }
+#else
     pthread_threadid_np(nullptr, &amp;tid);
+#endif
     return static_cast&lt;size_t&gt;(tid);
 #else // Default to standard C++11 (other Unix)
     return static_cast&lt;size_t&gt;(std::hash&lt;std::thread::id&gt;()(std::this_thread::get_id()));
</pre></body></html>