Index: src/algorithm.cpp =================================================================== --- src/algorithm.cpp +++ src/algorithm.cpp @@ -8,7 +8,12 @@ #include "algorithm" #include "random" +#ifndef _LIBCPP_HAS_NO_THREADS #include "mutex" +#if defined(__unix__) && defined(__ELF__) && defined(__clang__) +#pragma comment(lib, "pthread") +#endif +#endif _LIBCPP_BEGIN_NAMESPACE_STD Index: src/chrono.cpp =================================================================== --- src/chrono.cpp +++ src/chrono.cpp @@ -37,6 +37,10 @@ #endif #endif +#if defined(__unix__) && defined(__ELF__) && defined(__clang__) +#pragma comment(lib, "rt") +#endif + _LIBCPP_BEGIN_NAMESPACE_STD namespace chrono Index: src/condition_variable.cpp =================================================================== --- src/condition_variable.cpp +++ src/condition_variable.cpp @@ -15,6 +15,10 @@ #include "system_error" #include "__undef_macros" +#if defined(__unix__) && defined(__ELF__) && defined(__clang__) +#pragma comment(lib, "pthread") +#endif + _LIBCPP_BEGIN_NAMESPACE_STD condition_variable::~condition_variable() Index: src/debug.cpp =================================================================== --- src/debug.cpp +++ src/debug.cpp @@ -13,7 +13,12 @@ #include "string" #include "cstdio" #include "__hash_table" +#ifndef _LIBCPP_HAS_NO_THREADS #include "mutex" +#if defined(__unix__) && defined(__ELF__) && defined(__clang__) +#pragma comment(lib, "pthread") +#endif +#endif _LIBCPP_BEGIN_NAMESPACE_STD Index: src/experimental/memory_resource.cpp =================================================================== --- src/experimental/memory_resource.cpp +++ src/experimental/memory_resource.cpp @@ -12,6 +12,9 @@ #include "atomic" #elif !defined(_LIBCPP_HAS_NO_THREADS) #include "mutex" +#if defined(__unix__) && defined(__ELF__) && defined(__clang__) +#pragma comment(lib, "pthread") +#endif #endif _LIBCPP_BEGIN_NAMESPACE_LFTS_PMR Index: src/filesystem/operations.cpp =================================================================== --- src/filesystem/operations.cpp +++ src/filesystem/operations.cpp @@ -44,6 +44,10 @@ #include // for gettimeofday and timeval #endif // !defined(CLOCK_REALTIME) +#if defined(__unix__) && defined(__ELF__) && defined(__clang__) +#pragma comment(lib, "rt") +#endif + #if defined(_LIBCPP_COMPILER_GCC) #if _GNUC_VER < 500 #pragma GCC diagnostic ignored "-Wmissing-field-initializers" Index: src/memory.cpp =================================================================== --- src/memory.cpp +++ src/memory.cpp @@ -10,6 +10,9 @@ #ifndef _LIBCPP_HAS_NO_THREADS #include "mutex" #include "thread" +#if defined(__unix__) && defined(__ELF__) && defined(__clang__) +#pragma comment(lib, "pthread") +#endif #endif #include "include/atomic_support.h" Index: src/mutex.cpp =================================================================== --- src/mutex.cpp +++ src/mutex.cpp @@ -12,6 +12,12 @@ #include "include/atomic_support.h" #include "__undef_macros" +#ifndef _LIBCPP_HAS_NO_THREADS +#if defined(__unix__) && defined(__ELF__) && defined(__clang__) +#pragma comment(lib, "pthread") +#endif +#endif + _LIBCPP_BEGIN_NAMESPACE_STD #ifndef _LIBCPP_HAS_NO_THREADS Index: src/shared_mutex.cpp =================================================================== --- src/shared_mutex.cpp +++ src/shared_mutex.cpp @@ -10,6 +10,9 @@ #ifndef _LIBCPP_HAS_NO_THREADS #include "shared_mutex" +#if defined(__unix__) && defined(__ELF__) && defined(__clang__) +#pragma comment(lib, "pthread") +#endif _LIBCPP_BEGIN_NAMESPACE_STD Index: src/thread.cpp =================================================================== --- src/thread.cpp +++ src/thread.cpp @@ -35,6 +35,10 @@ #include #endif +#if defined(__unix__) && defined(__ELF__) && defined(__clang__) +#pragma comment(lib, "pthread") +#endif + _LIBCPP_BEGIN_NAMESPACE_STD thread::~thread()