https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88749
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I don't understand why the configure script would not have set
_GLIBCXX_USE_UTIME when utimbuf and utime() are apparently available (because
GCC is suggesting them as alternatives for posix::utimbuf and posix::utime).
I think this should fix it, but as Andrew requested, please provide a lot more
information about your target:
--- a/libstdc++-v3/src/filesystem/ops.cc
+++ b/libstdc++-v3/src/filesystem/ops.cc
@@ -909,7 +909,7 @@ fs::last_write_time(const path& p
__attribute__((__unused__)),
ec.assign(errno, std::generic_category());
else
ec.clear();
-#elif _GLIBCXX_HAVE_UTIME_H
+#elif _GLIBCXX_USE_UTIME && _GLIBCXX_HAVE_SYS_STAT_H
posix::utimbuf times;
times.modtime = s.count();
times.actime = do_stat(p, ec, [](const auto& st) { return st.st_atime; },