Description:
MySQL Server compilation fails prematurely on Windows when specifying an OpenSSL directory containing a space such as -DWITH_SSL="C:/Program Files/OpenSSL". "C:/Program Files/OpenSSL" is the default installation directory of OpenSSL 3.x. The compilation failure occurs during MySQL Client linking with the following error:
"/OUT:C:\mysql-8.0.31\build\archive_output_directory\RelWithDebInfo\mysqlclient.lib" /NOLOGO /MACHINE:X64 /machine:x64 C:/Program
LINK : fatal error LNK1104: cannot open file 'C:\Program' [C:\mysql-8.0.31\build\libmysql\mysqlclient.vcxproj]
How to repeat:
Compile MySQL Server on Windows and specify an OpenSSL directory containing a space such as -DWITH_SSL="C:/Program Files/OpenSSL".
Suggested fix:
Configure cmake to generate the libmysql\mysqlclient.vcxproj file so it contains quotes around OpenSSL directories within the <AdditionalOptions> XML element. For example, the work around for this bug is to manually modify the libmysql\mysqlclient.vcxproj file by changing 4 lines that look like this:
<AdditionalOptions>%(AdditionalOptions) /machine:x64 C:/Program Files/OpenSSL/lib/libssl.lib C:/Program Files/OpenSSL/lib/libcrypto.lib</AdditionalOptions>
to this:
<AdditionalOptions>%(AdditionalOptions) /machine:x64 "C:/Program Files/OpenSSL/lib/libssl.lib" "C:/Program Files/OpenSSL/lib/libcrypto.lib"</AdditionalOptions>
prior to building with cmake.