-
Notifications
You must be signed in to change notification settings - Fork 14.5k
[libcxx] Fix compiling for macOS versions before 10.13 #126669
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
[libcxx] Fix compiling for macOS versions before 10.13 #126669
Conversation
utimensat was introduced in macOS 10.13. UTIME_OMIT is still defined even when targeting 10.9 from newer versions of macOS, so this can't be used as a signal for utimensat availability.
Thank you for submitting a Pull Request (PR) to the LLVM Project! This PR will be automatically labeled and the relevant teams will be notified. If you wish to, you can add reviewers by using the "Reviewers" section on this page. If this is not working for you, it is probably because you do not have write permissions for the repository. In which case you can instead tag reviewers by name in a comment by using If you have received no comments on your PR for a week, you can request a review by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate is once a week. Please remember that you are asking for valuable time from other developers. If you have further questions, they may be answered by the LLVM GitHub User Guide. You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums. |
@llvm/pr-subscribers-libcxx Author: Benjamin Schaaf (BenjaminSchaaf) Changesutimensat was introduced in macOS 10.13. UTIME_OMIT is still defined even when targeting 10.9 from newer versions of macOS, so this can't be used as a signal for utimensat availability. Full diff: https://github.com/llvm/llvm-project/pull/126669.diff 1 Files Affected:
diff --git a/libcxx/src/filesystem/time_utils.h b/libcxx/src/filesystem/time_utils.h
index 89352e5bd6abbbb..e82738eb7036372 100644
--- a/libcxx/src/filesystem/time_utils.h
+++ b/libcxx/src/filesystem/time_utils.h
@@ -32,8 +32,14 @@
# include <sys/time.h> // for ::utimes as used in __last_write_time
#endif
+// MacOS version 10.13 introduces utimensat
+#if defined(__APPLE__)
+# if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \
+ __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101300)
+# define _LIBCPP_USE_UTIMENSAT
+# endif
// We can use the presence of UTIME_OMIT to detect platforms that provide utimensat.
-#if defined(UTIME_OMIT)
+#elif defined(UTIME_OMIT)
# define _LIBCPP_USE_UTIMENSAT
#endif
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As documented on our support page, we officially support back to macOS 10.13, but we dropped support for older versions: https://libcxx.llvm.org/#platform-and-compiler-support
Does that mean patches won't be accepted for fixing older versions? |
Yes. You can of course ask for older versions being supported, but that requires CI support and some reasoning why it's still required. We can't support old systems forever. |
In the case of macOS versions older than 10.13, we don't support it because even recent Xcode versions have dropped support for back-deploying that far back. |
Closing since that platform is intentionally not supported anymore. |
utimensat was introduced in macOS 10.13. UTIME_OMIT is still defined even when targeting 10.9 from newer versions of macOS, so this can't be used as a signal for utimensat availability.