Commit 3bfe305c authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV-22555 Windows, packaging: binaries depend on vcruntime140_1.dll, which is not in MSI

When server is compiled with recent VS2019, then executables,
have dependency on  vcruntime140_1.dll

While we include the VC redistributable merge modules into our MSI package,
those merge modules were stale (taken from older VS version, 2017)

Since VS2019 brough new DLL dependency by introducing new exception handling
https://devblogs.microsoft.com/cppblog/making-cpp-exception-handling-smaller-x64
thus the old MSMs were not enough.

The fix is to change logic in win/packaging/CMakeLists.txt to look up for
the correct, new MSMs.

The bug only affects 10.4,as we compile with static CRT before 10.4,
and partly-statically(just vcruntime stub is statically linked, but not UCRT)
after 10.4

For the fix to work, it required also some changes on the build machine
(vs_installer, modify VS2019 installation, add Individual Component
"C++ 2019 Redistributable MSMs")
parent 38f6c47f
......@@ -189,7 +189,7 @@ IF(MSVC_CRT_TYPE MATCHES "/MD")
"$ENV{${ProgramFilesX86}}/Common Files/Merge Modules"
"$ENV{ProgramFiles}/Common Files/Merge Modules"
)
ELSEIF(MSVC_VERSION LESS 2000)
ELSEIF(MSVC_VERSION LESS 1920)
# VS2017
SET(VCREDIST_MSM_FILENAME Microsoft_VC141_CRT_${WIX_ARCH_SUFFIX}.msm)
FILE(GLOB MSM_LIST "C:/Program Files*/Microsoft Visual Studio/2017/*/VC/Redist/MSVC/*/MergeModules/${VCREDIST_MSM_FILENAME}")
......@@ -198,9 +198,13 @@ IF(MSVC_CRT_TYPE MATCHES "/MD")
LIST(GET MSM_LIST 0 VCRedist_MSM)
ENDIF()
ELSE()
# Post-VS2017. Needs to be ported when new VS is out
MESSAGE(WARNING
"Name of redistributable merge module not known for this version of MSVC")
# VS2019
SET(VCREDIST_MSM_FILENAME Microsoft_VC142_CRT_${WIX_ARCH_SUFFIX}.msm)
FILE(GLOB MSM_LIST "C:/Program Files*/Microsoft Visual Studio/2019/*/VC/Redist/MSVC/*/MergeModules/${VCREDIST_MSM_FILENAME}")
LIST(LENGTH MSM_LIST LEN)
IF(LEN GREATER 0)
LIST(GET MSM_LIST 0 VCRedist_MSM)
ENDIF()
ENDIF()
IF (NOT VCRedist_MSM)
MESSAGE(WARNING "Can't find merge module ${VCREDIST_MSM_FILENAME}")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment