Bug #116594 [MSVC] MySQL failed to build with msvc on Windows when add ASAN option
Submitted: 8 Nov 6:13 Modified: 11 Nov 12:10
Reporter: Liu June Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Compiling Severity:S2 (Serious)
Version:8.4, 8.0 OS:Windows
Assigned to: CPU Architecture:x86

[8 Nov 6:13] Liu June
Description:
MySQL failed to build with msvc on Windows when add ASAN option due to below errors:

time_util.obj : error LNK2019: unresolved external symbol "class absl::lts_20230802::time_internal::cctz::time_zone __cdecl absl::lts_20230802::time_internal::cctz::utc_time_zone(void)" (?utc_time_zone@cctz@time_internal@lts_20230802@absl@@YA?AVtime_zone@1234@XZ) referenced in function "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl google::protobuf::util::`anonymous namespace'::FormatTime(__int64,int)" (?FormatTime@?A0xd207e08b@util@protobuf@google@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@_JH@Z) [C:\gitP\mysql\mysql-server\build_amd64\extra\protobuf\protobuf-24.4\libprotobuf.vcxproj]
  C:\gitP\mysql\mysql-server\build_amd64\library_output_directory\Release\libprotobuf.dll : fatal error LNK1120: 1 unresolved externals [C:\gitP\mysql\mysql-server\build_amd64\extra\protobuf\protobuf-24.4\libprotobuf.vcxproj]
  time_util.obj : error LNK2019: unresolved external symbol "class absl::lts_20230802::time_internal::cctz::time_zone __cdecl absl::lts_20230802::time_internal::cctz::utc_time_zone(void)" (?utc_time_zone@cctz@time_internal@lts_20230802@absl@@YA?AVtime_zone@1234@XZ) referenced in function "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl google::protobuf::util::`anonymous namespace'::FormatTime(__int64,int)" (?FormatTime@?A0xd207e08b@util@protobuf@google@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@_JH@Z) [C:\gitP\mysql\mysql-server\build_amd64\extra\protobuf\protobuf-24.4\libprotobuf.vcxproj]
  C:\gitP\mysql\mysql-server\build_amd64\library_output_directory\Release\libprotobuf.dll : fatal error LNK1120: 1 unresolved externals [C:\gitP\mysql\mysql-server\build_amd64\extra\protobuf\protobuf-24.4\libprotobuf.vcxproj]

How to repeat:
1. git clone https://github.com/mysql/mysql-server C:\gitP\mysql
2. Open VS2022 x64 Native Tools command.
3. set _CL_= /fsanitize=address /GS- /wd5072 & set _LINK_= /InferASanLibs 
4. mkdir C:\gitP\mysql\mysql-server\build_amd64 & cd /d C:\gitP\mysql\mysql-server\build_amd64
5. set PATH=C:\tools\msys64\usr\bin;%PATH%
6. cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_SYSTEM_VERSION=10.0.22621.0  -DWITH_SSL=C:\gitP\Microsoft\vcpkg\installed\x64-windows ..
6. msbuild /p:Platform=x64 /p:Configuration=Release MySQL.sln /t:Rebuild
[11 Nov 12:10] MySQL Verification Team
Hello Liu June,

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

regards,
Umesh