diff options
author | Yuhang Zhao <[email protected]> | 2023-10-23 13:10:44 +0800 |
---|---|---|
committer | Yuhang Zhao <[email protected]> | 2023-11-02 16:49:40 +0000 |
commit | 8842391e5c1c1e751d5d8fca53556d9e8c80196b (patch) | |
tree | d873446828df3512a22a60ff671de9c3e67720bf | |
parent | c5b3fd134b9e88322379fb34616662690c7acbb8 (diff) |
windeployqt: improve MSVC runtime detection
MSVC runtime dlls also include vccorelibXXX.dll, concrtXXX.dll,
beside these traditional dlls, it's also possible to link against
the new UCRT runtime, the ucrtbase.dll (and possibly including
the API Set dlls), so we need to add some more checks to make
windeployqt more robust. I've tested a custom Qt build locally,
which I managed to make it link to ucrtbase.dll only, and this
code works fine.
Pick-to: 6.6
Change-Id: I00bc8666d8850aac279b8747465879e39348ba02
Reviewed-by: Oliver Wolff <[email protected]>
Reviewed-by: Timothée Keller <[email protected]>
-rw-r--r-- | src/tools/windeployqt/utils.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/tools/windeployqt/utils.cpp b/src/tools/windeployqt/utils.cpp index badb81d7c38..1e5b01ff50d 100644 --- a/src/tools/windeployqt/utils.cpp +++ b/src/tools/windeployqt/utils.cpp @@ -673,13 +673,23 @@ static inline MsvcDebugRuntimeResult checkMsvcDebugRuntime(const QStringList &de qsizetype pos = 0; if (lib.startsWith("MSVCR"_L1, Qt::CaseInsensitive) || lib.startsWith("MSVCP"_L1, Qt::CaseInsensitive) - || lib.startsWith("VCRUNTIME"_L1, Qt::CaseInsensitive)) { + || lib.startsWith("VCRUNTIME"_L1, Qt::CaseInsensitive) + || lib.startsWith("VCCORLIB"_L1, Qt::CaseInsensitive) + || lib.startsWith("CONCRT"_L1, Qt::CaseInsensitive) + || lib.startsWith("UCRTBASE"_L1, Qt::CaseInsensitive)) { qsizetype lastDotPos = lib.lastIndexOf(u'.'); pos = -1 == lastDotPos ? 0 : lastDotPos - 1; } - if (pos > 0 && lib.contains("_app"_L1, Qt::CaseInsensitive)) - pos -= 4; + if (pos > 0) { + const auto removeExtraSuffix = [&lib, &pos](const QString &suffix) -> void { + if (lib.contains(suffix, Qt::CaseInsensitive)) + pos -= suffix.size(); + }; + removeExtraSuffix("_app"_L1); + removeExtraSuffix("_atomic_wait"_L1); + removeExtraSuffix("_codecvt_ids"_L1); + } if (pos) return lib.at(pos).toLower() == u'd' ? MsvcDebugRuntime : MsvcReleaseRuntime; |