Bug #92943 MySql build failed on MSVC under /permissive- mode
Submitted: 25 Oct 2018 7:52 Modified: 31 Oct 2018 17:21
Reporter: Quella Zhang Email Updates:
Status: Closed Impact on me:
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:branch 5.7, 5.7.24 OS:Microsoft Windows
Assigned to: CPU Architecture:Any

[25 Oct 2018 7:52] Quella Zhang
We (the Microsoft C++ team) use the MySQL project as part of our "Real world code" tests.  I noticed a few issues in windows specific code when building MySQL with the MSVC compiler in its conformance mode (/permissive-).  For more information on /permissive- see our blog https://blogs.msdn.microsoft.com/vcblog/2016/11/16/permissive-switch/.

D:\MySQL\src\libmysql\authentication_win\handshake.h(103,40): error C4596: 'packet_processing_loop': illegal qualified name in member declaration
  int Handshake::packet_processing_loop();
D:\MySQL\src\libmysql\authentication_win\handshake_client.cc(267,21): warning C4267: '=': conversion from 'size_t' to 'byte', possible loss of data
    *ptr++= len >> 8;
D:\MySQL\src\rapid\plugin\group_replication\libmysqlgcs\include\mysql\gcs\xplatform\my_xp_cond.h(126,48): error C4596: 'get_milliseconds': illegal qualified name in member declaration
  static DWORD My_xp_cond_win::get_milliseconds(const struct timespec *abstime);
D:\MySQL\src\sql\mysqld.cc(5295,6): error C2664:  'BOOL NTService::got_service_option(char **,char *)': cannot convert argument 2 from 'const char [15]' to 'char *' [D:\MySQL\build_x86\sql\sql.vcxproj]
D:\MySQL\src\sql\mysqld.cc(5295,6): error C2664:   if (Service.got_service_option(argv, "install-manual")) [D:\MySQL\build_x86\sql\sql.vcxproj]
D:\MySQL\src\sql\mysqld.cc(5295,6): error C2664:      ^ [D:\MySQL\build_x86\sql\sql.vcxproj]
       D:\MySQL\src\sql\mysqld.cc(5295,6): message :  Conversion from string literal loses const qualifier (see /Zc:strictStrings) [D:\MySQL\build_x86\sql\sql.vcxproj]
D:\MySQL\src\sql\mysqld.cc(7248,59): error C2440:  '=': cannot convert from 'const char [6]' to 'char *' [D:\MySQL\build_x86\sql\sql.vcxproj]
D:\MySQL\src\sql\mysqld.cc(7248,59): error C2440:   shared_memory_base_name= default_shared_memory_base_name; [D:\MySQL\build_x86\sql\sql.vcxproj]
D:\MySQL\src\sql\mysqld.cc(7248,59): error C2440:                                                           ^ [D:\MySQL\build_x86\sql\sql.vcxproj]
       D:\MySQL\src\sql\mysqld.cc(7248,59): message :  Conversion from string literal loses const qualifier (see /Zc:strictStrings) [D:\MySQL\build_x86\sql\sql.vcxproj]

How to repeat:
1.git clone -b 5.7 https://github.com/mysql/mysql-server.git D:\MySQL\src
2.it's rely on boost 1.59,so extract boost_1_59_0.zip to D:\MySQL\
3.set _CL_=/permissive-
4.mkdir build_x86 && pushd build_x86
5.cmake -G "Visual Studio 15 2017" -DCMAKE_SYSTEM_VERSION=10.0.17134.0 -DWITH_NDB_JAVA=0 -DWITH_BOOST=..\boost_1_59_0 ..\src
6.msbuild /p:Configuration=Debug;Platform=Win32 build_x86\MySQL.sln /t:Rebuild /m /p:BuildInParallel=true
[25 Oct 2018 12:32] Umesh Shastry
Hello Quella Zhang,

Thank you for the report and feedback.
Observed this with 5.7.24 build.

[25 Oct 2018 19:48] Omer Barnir
Also, further information on the MySQL 8.0 C++ code improvements:
[31 Oct 2018 17:21] Paul Dubois
Posted by developer:
Fixed in 8.0.15.

Corrections were made to enable successful builds under Visual Studio
on Windows with the /permissive flag turned on.
[16 Nov 2018 13:53] Paul Dubois
Posted by developer:
Fixed in 8.0.14, not 8.0.15.