MDEV-36938 Fix MSI install failure when ADDLOCAL omits required runtime

Since 10.11.12 (commit 8363d05f4df8b5c787), executables are built with
the dynamic C runtime (/MD), introducing a dependency on
vcruntime140.dll.
VC++ runtime is typically installed via the VCCRT feature, which is
included by default as part of the hidden/default ALWAYSINSTALL feature
set. However, when users specify the ADDLOCAL property, it overrides the
default selection and may omit critical features like VCCRT. This leads to
installation failures.

Fix: Add a custom action that ensures mandatory features (e.g., VCCRT)
are appended to the ADDLOCAL property at install time. This guarantees
essential runtime components are always installed, even when a custom
feature set is selected.
This commit is contained in:
Vladislav Vaintroub 2025-06-04 09:46:06 +02:00
parent 5a6732983d
commit 5729d89cd5
2 changed files with 20 additions and 0 deletions

View File

@ -357,6 +357,11 @@ SET(CPACK_WIX_INCLUDES
)
ENDFOREACH()
LIST(LENGTH WIX_FEATURE_AlwaysInstall_COMPONENTS len)
IF (len LESS_EQUAL 0)
MESSAGE(FATAL_ERROR "AlwaysInstall_COMPONENTS is empty")
ENDIF()
LIST(JOIN WIX_FEATURE_AlwaysInstall_COMPONENTS "," MANDATORY_FEATURES)
CONFIGURE_FILE(${SRCDIR}/mysql_server.wxs.in
${CMAKE_CURRENT_BINARY_DIR}/mysql_server.wxs)

View File

@ -63,6 +63,21 @@
<CustomAction Id="LaunchUrl" BinaryKey="WixCA" DllEntry="WixShellExec" Execute="immediate" Return="check" Impersonate="yes" />
<!--
When msiexec /i ADDLOCAL=<feature_list> is used, usually only features in
the <feature_list> are installed. owever there are things we always want to
be there, there is ALWAYSINSTALL feature id, hidden in UI for that.
Modify ADDLOCAL list by adding mandatory features.
-->
<CustomAction Id="ForceAddMandatoryFeatures"
Property="ADDLOCAL"
Value="[ADDLOCAL],@MANDATORY_FEATURES@"/>
<InstallUISequence>
<Custom Action="ForceAddMandatoryFeatures" Before="CostFinalize">ADDLOCAL</Custom>
</InstallUISequence>
<InstallExecuteSequence>
<Custom Action="ForceAddMandatoryFeatures" Before="CostFinalize">ADDLOCAL</Custom>
</InstallExecuteSequence>
<!--
User interface dialogs