<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/64226>64226</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
llvm-17.0.0-rc1: libcxxabi does not build on macOS 10.12.6
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
debohman
</td>
</tr>
</table>
<pre>
```
FAILED: libcxxabi/src/CMakeFiles/cxxabi_shared_objects.dir/cxa_handlers.cpp.o
/tera/tera/debo/Projects/llvm/llvmorg-17.0.0-rc1-build/./bin/clang++ --target=x86_64-apple-darwin16.7.0 -DLIBCXX_BUILDING_LIBCXXABI -D_LIBCPP_BUILDING_LIBRARY -D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -D_LIBCXXABI_BUILDING_LIBRARY -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/tera/tera/debo/Projects/llvm/llvmorg-17.0.0-rc1/libcxxabi/../libcxx/src -I/tera/tera/debo/Projects/llvm/llvmorg-17.0.0-rc1-build/include/c++/v1 -I/tera/tera/debo/Projects/llvm/llvmorg-17.0.0-rc1/libcxxabi/include -I/usr/local/include -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -O3 -DNDEBUG -std=c++20 -fPIC -nostdinc++ -fstrict-aliasing -funwind-tables -D_DEBUG -UNDEBUG -Wall -Wextra -Wnewline-eof -Wshadow -Wwrite-strings -Wno-unused-parameter -Wno-long-long -Werror=return-type -Wextra-semi -Wundef -Wunused-template -Wformat-nonliteral -Wno-user-defined-literals -Wno-covered-switch-default -Wno-suggest-override -Wno-error -MD -MT libcxxabi/src/CMakeFiles/cxxabi_shared_objects.dir/cxa_handlers.cpp.o -MF libcxxabi/src/CMakeFiles/cxxabi_shared_objects.dir/cxa_handlers.cpp.o.d -o libcxxabi/src/CMakeFiles/cxxabi_shared_objects.dir/cxa_handlers.cpp.o -c /tera/tera/debo/Projects/llvm/llvmorg-17.0.0-rc1/libcxxabi/src/cxa_handlers.cpp
In file included from /tera/tera/debo/Projects/llvm/llvmorg-17.0.0-rc1/libcxxabi/src/cxa_handlers.cpp:12:
In file included from /tera/tera/debo/Projects/llvm/llvmorg-17.0.0-rc1-build/include/c++/v1/stdexcept:48:
In file included from /tera/tera/debo/Projects/llvm/llvmorg-17.0.0-rc1-build/include/c++/v1/iosfwd:106:
In file included from /tera/tera/debo/Projects/llvm/llvmorg-17.0.0-rc1-build/include/c++/v1/__std_mbstate_t.h:14:
In file included from /tera/tera/debo/Projects/llvm/llvmorg-17.0.0-rc1-build/include/c++/v1/__mbstate_t.h:48:
/usr/include/sys/_types/_mbstate_t.h:31:9: error: unknown type name '__darwin_mbstate_t'
31 | typedef __darwin_mbstate_t mbstate_t;
| ^
1 error generated.
```
The following change allows it to build:
```
diff --git a/libcxx/include/__mbstate_t.h b/libcxx/include/__mbstate_t.h
index 2b9e719b1f2e..c6e50a144dc7 100644
--- a/libcxx/include/__mbstate_t.h
+++ b/libcxx/include/__mbstate_t.h
@@ -42,6 +42,7 @@
#elif __has_include(<bits/types/mbstate_t.h>)
# include <bits/types/mbstate_t.h> // works on most Unixes
#elif __has_include(<sys/_types/_mbstate_t.h>)
+# include <machine/_types.h>
# include <sys/_types/_mbstate_t.h> // works on Darwin
#elif !defined(_LIBCPP_HAS_NO_WIDE_CHARACTERS) && __has_include_next(<wchar.h>)
# include_next <wchar.h> // fall back to the C standard provider of mbstate_t
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzEV91u2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