Support #12073
openCould not build Wt 4.10.1 with MSVC 193 due C++17
0%
Description
When trying the build Wt 4.10.1 with Visual Studio 2022 (MSVC 19.33) I have the follow error:
wtdbomysql.vcxproj -> C:\temp\Wt\Dbo\backend\Release\wtdbomysql.lib
Building Custom Rule C:/temp/Wt/Dbo/backend/CMakeLists.txt
Postgres.C
C:\temp\Wt\Dbo\backend\Postgres.C(123,26): error C2079: 'buf' uses undefined class 'std::array<char,30>' [C:\Users\uilia\.conan2\p\b\wt96dc29e19fdc7\b\build\src\Wt\Dbo\backend\wtdbopostgres.vcxproj]
C:\temp\backend\Postgres.C(124,63): error C2661: 'std::to_chars': no overloaded function takes 2 arguments [C:\Users\uilia\.conan2\p\b\wt96dc29e19fdc7\b\build\src\Wt\Dbo\backend\wtdbopostgres.vcxproj]
C:\temp\backend\Postgres.C(126,8): error C3536: 'returnValue': cannot be used before it is initialized [C:\Users\uilia\.conan2\p\b\wt96dc29e19fdc7\b\build\src\Wt\Dbo\backend\wtdbopostgres.vcxproj]
C:temp\Wt\Dbo\backend\Postgres.C(148,26): error C2079: 'buf' uses undefined class 'std::array<char,30>' [C:\Users\uilia\.conan2\p\b\wt96dc29e19fdc7\b\build\src\Wt\Dbo\backend\wtdbopostgres.vcxproj]
C:\temp\Wt\Dbo\backend\Postgres.C(149,63): error C2661: 'std::to_chars': no overloaded function takes 2 arguments [C:\Users\uilia\.conan2\p\b\wt96dc29e19fdc7\b\build\src\Wt\Dbo\backend\wtdbopostgres.vcxproj]
C:\temp\Wt\Dbo\backend\Postgres.C(151,8): error C3536: 'returnValue': cannot be used before it is initialized [C:\Users\uilia\.conan2\p\b\wt96dc29e19fdc7\b\build\src\Wt\Dbo\backend\wtdbopostgres.vcxproj]
I found a related change here: https://github.com/emweb/wt/commit/7956a40c736aae9c5be87ed68d19e2b00bb81bc2
It seems like when building with Visual Studio, it found std::to_chars, but does no match with the expected interface.
Same version I can build both on Linux and Mac, only Windows + Visual Studio I having that error.
About the configuration that I used:
arch=x86_64
build_type=Release
compiler=msvc
compiler_version=19.33
runtime=dynamic (MD)
os=Windows
I'm using a toolchain file to configure the build, so here is the current CMake configuration:
set(CMAKE_BUILD_TYPE Release)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_MSVC_RUNTIME_LIBRARY "$<$<CONFIG:Release>:MultiThreadedDLL>")
set(BUILD_SHARED_LIBS OFF)
set(SHARED_LIBS OFF)
set(BUILD_EXAMPLES OFF)
set(BUILD_TESTS OFF)
set(ENABLE_SSL ON)
set(ENABLE_HARU OFF)
set(ENABLE_PANGO OFF)
set(ENABLE_SQLITE ON)
set(ENABLE_POSTGRES ON)
set(ENABLE_FIREBIRD OFF)
set(ENABLE_MYSQL ON)
set(ENABLE_MSSQLSERVER OFF)
set(ENABLE_QT4 OFF)
set(ENABLE_QT5 OFF)
set(ENABLE_LIBWTTEST OFF)
set(ENABLE_LIBWTDBO ON)
set(ENABLE_OPENGL OFF)
set(ENABLE_UNWIND OFF)
set(WT_NO_STD_LOCALE OFF)
set(WT_NO_STD_WSTRING OFF)
set(MULTI_THREADED ON)
set(USE_SYSTEM_SQLITE3 ON)
set(DEBUG OFF)
set(CONNECTOR_HTTP TRUE)
set(CONNECTOR_FCGI OFF)
set(CONNECTOR_ISAPI ON)
set(BOOST_DYNAMIC OFF)
set(BOOST_PREFIX ...)
set(ZLIB_PREFIX ...)
set(SSL_PREFIX ...)
set(OPENSSL_LIBRARIES ...)
set(OPENSSL_INCLUDE_DIR ...)
... Include folder and lib folders ...
Could you please check if it's a bug or just another Visual Studio limitation with C++17 features?
The full build log is attached. BTW, I'm using Conan build Wt, and so far, we had no problem building it, only this new release 4.10.1 it happens.
Files
Updated by Uilian Ries about 1 year ago
In case I pass CMAKE_CXX_STANDARD=14 it works.
Updated by Matthias Van Ceulebroeck 28 days ago
- Assignee set to Matthias Van Ceulebroeck
- Target version set to 4.11.2
Hey Uilian,
thanks for the report, and my apologies for the very late response. I don't build for Windows very often, so I put this ticket back a little, and then lost track of it.
I will assign it to a concrete version to investigate further.
It does at first glance indeed seem like a C++17 MSVC idiosyncrasy. So likely an additional check for MSVC needs to take place to see whether it is supported.