Description:
I work on Microsoft Visual C++ testing, where we regularly build popular open-source projects, including yours, with development builds of our compiler and libraries to detect and prevent shipping regressions that would affect you. This also allows us to provide advance notice of breaking changes, which is the case here.
Recently https://github.com/microsoft/STL/pull/5105, revealed an issue in mySQL.
Compiler error with this STL change:
C:\gitP\mysql\mysql-server\plugin\group_replication\libmysqlgcs\src\bindings\xcom\xcom\task.cc(388): error C3083: 'system_clock': the symbol to the left of a '::' must be a type
C:\gitP\mysql\mysql-server\plugin\group_replication\libmysqlgcs\src\bindings\xcom\xcom\task.cc(388): error C2039: 'now': is not a member of 'std::chrono'
C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.42.34433\include\__msvc_chrono.hpp(286): note: see declaration of 'std::chrono'
C:\gitP\mysql\mysql-server\plugin\group_replication\libmysqlgcs\src\bindings\xcom\xcom\task.cc(388): error C3861: 'now': identifier not found
C:\gitP\mysql\mysql-server\plugin\group_replication\libmysqlgcs\src\bindings\xcom\xcom\task.cc(387): error C2672: 'std::chrono::duration_cast': no matching overloaded function found
This was assuming that including <thread> makes the chrono::system_clock type available, which is not guaranteed by the Standard. You need to explicitly include the chrono header in this file, and the error will be resolved.
How to repeat:
1. git clone https://github.com/mysql/mysql-server.git
2. cd mysql/mysql-server
3. mkdir build_amd64
3. cd build_amd64
4. cmake -G "Ninja" -DCMAKE_SYSTEM_VERSION=10.0.22621.0 -DWITH_SSL=C:\gitP\Microsoft\vcpkg\installed\x64-windows ..
5. ninja
Suggested fix:
Add #include <chrono> to the source file.