Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix builds with macOS SDKs older than 10.13 #134548

Closed
wants to merge 1 commit into from

Conversation

Un1q32
Copy link
Contributor

@Un1q32 Un1q32 commented Apr 6, 2025

sys/_types/_mbstate_t.h was added in the 10.9 SDK, but it didn't include machine/types.h for you until 10.13, this results in a funny situation where partial libc++ builds are possible with the 10.8 SDK and the 10.13 SDK but not 10.9-10.12, since you'll get an error about __darwin_mbstate_t not being defined (sys/_types/_mbstate_t.h just does typedef __darwin_mbstate_t mbstate_t;). I know versions before 10.13 aren't officially supported, but it would be nice to keep supporting partial builds at least.

@Un1q32 Un1q32 requested a review from a team as a code owner April 6, 2025 16:58
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Apr 6, 2025
@llvmbot
Copy link
Member

llvmbot commented Apr 6, 2025

@llvm/pr-subscribers-libcxx

Author: None (Un1q32)

Changes

sys/_types/_mbstate_t.h was added in the 10.9 SDK, but it didn't include machine/types.h for you until 10.13, this results in a funny situation where partial libc++ builds are possible with the 10.8 SDK and the 10.13 SDK but not 10.9-10.12, since you'll get an error about __darwin_mbstate_t not being defined (sys/_types/_mbstate_t.h just does typedef __darwin_mbstate_t mbstate_t;). I know versions before 10.13 aren't officially supported, but it would be nice to keep supporting partial builds at least.


Full diff: https://github.com/llvm/llvm-project/pull/134548.diff

2 Files Affected:

  • (modified) libcxx/include/__cxx03/__mbstate_t.h (+1)
  • (modified) libcxx/include/__mbstate_t.h (+1)
diff --git a/libcxx/include/__cxx03/__mbstate_t.h b/libcxx/include/__cxx03/__mbstate_t.h
index 6c7cfaaa8fe5b..07a30ee881795 100644
--- a/libcxx/include/__cxx03/__mbstate_t.h
+++ b/libcxx/include/__cxx03/__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
diff --git a/libcxx/include/__mbstate_t.h b/libcxx/include/__mbstate_t.h
index c23ea7113ca70..6a819dd34af72 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 __has_include_next(<wchar.h>)
 #  include_next <wchar.h> // use the C standard provider of mbstate_t if present

@philnik777
Copy link
Contributor

See #126669.

@philnik777 philnik777 closed this Apr 7, 2025
@Un1q32 Un1q32 deleted the macos-10.12-sdk branch April 7, 2025 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants