Skip to content

[qt5-base] Don't link to "MinCore.lib", it breaks compatibility with Windows 7#10806

Closed
davidebeatrici wants to merge 1 commit intomicrosoft:masterfrom
davidebeatrici:qt-no-mincore
Closed

[qt5-base] Don't link to "MinCore.lib", it breaks compatibility with Windows 7#10806
davidebeatrici wants to merge 1 commit intomicrosoft:masterfrom
davidebeatrici:qt-no-mincore

Conversation

@davidebeatrici
Copy link
Contributor

@davidebeatrici davidebeatrici commented Apr 13, 2020

From https://docs.microsoft.com/en-us/windows/win32/apiindex/windows-81-api-sets:

Binaries that link to MinCore.lib or MinCore_Downlevel.lib are not designed to work on Windows 7, Windows Server 2008 R2 or earlier. Binaries that need to run on earlier versions of Windows or Windows Server must not use either MinCore.lib or MinCore_Downlevel.lib.

More specifically, linking an application to a target provided by this port causes it to fail to load because it looks for unavailable UCRT DLLs.

This pull request changes the port so that it links to the "normal" libraries rather than MinCore.lib, effectively making the port compatible with Windows 7.

Please note that UxTheme.lib was already missing:

Qt5Widgets.lib(qwizard_win.obj) : error LNK2019: unresolved external symbol __imp_OpenThemeData referenced in function "public: class QColor __cdecl QVistaHelper::basicWindowFrameColor(void)" (?basicWindowFrameColor@QVistaHelper@@QEAA?AVQColor@@XZ)
Qt5Widgets.lib(qwizard_win.obj) : error LNK2019: unresolved external symbol __imp_DrawThemeBackground referenced in function "public: virtual void __cdecl QVistaBackButton::paintEvent(class QPaintEvent *)" (?paintEvent@QVistaBackButton@@UEAAXPEAVQPaintEvent@@@Z)
Qt5Widgets.lib(qwizard_win.obj) : error LNK2019: unresolved external symbol __imp_GetThemeColor referenced in function "public: class QColor __cdecl QVistaHelper::basicWindowFrameColor(void)" (?basicWindowFrameColor@QVistaHelper@@QEAA?AVQColor@@XZ)
Qt5Widgets.lib(qwizard_win.obj) : error LNK2019: unresolved external symbol __imp_GetThemeSysFont referenced in function "struct tagLOGFONTW __cdecl getCaptionLogFont(void *)" (?getCaptionLogFont@@YA?AUtagLOGFONTW@@PEAX@Z)
Qt5Widgets.lib(qwizard_win.obj) : error LNK2019: unresolved external symbol __imp_IsThemeActive referenced in function "private: static bool __cdecl QVistaHelper::drawBlackRect(class QRect const &,struct HDC__ *)" (?drawBlackRect@QVistaHelper@@CA_NAEBVQRect@@PEAUHDC__@@@Z)
Qt5Widgets.lib(qwizard_win.obj) : error LNK2019: unresolved external symbol __imp_SetWindowThemeAttribute referenced in function "public: void __cdecl QVistaHelper::setTitleBarIconAndCaptionVisible(bool)" (?setTitleBarIconAndCaptionVisible@QVistaHelper@@QEAAX_N@Z)
Qt5Widgets.lib(qwizard_win.obj) : error LNK2019: unresolved external symbol __imp_DrawThemeTextEx referenced in function "private: bool __cdecl QVistaHelper::drawTitleText(class QPainter *,class QString const &,class QRect const &,struct HDC__ *)" (?drawTitleText@QVistaHelper@@AEAA_NPEAVQPainter@@AEBVQString@@AEBVQRect@@PEAUHDC__@@@Z)

@Neumann-A
Copy link
Contributor

Please try #10644 instead. The wrapper has been remove there and was replaced with a *.prl parser.
Also Win7 is already at end of life.

@davidebeatrici
Copy link
Contributor Author

I will, thank you.

Windows 7 is still supported for ESU (Extended Security Updates) users: https://support.microsoft.com/en-us/help/4527878/faq-about-extended-security-updates-for-windows-7

@davidebeatrici
Copy link
Contributor Author

I confirm #10644 fixes the issue.

@JackBoosY
Copy link
Contributor

@davidebeatrici So, do you want to continue this PR?

@davidebeatrici
Copy link
Contributor Author

Yes, it seems that #10644 is W.I.P.

@JackBoosY
Copy link
Contributor

Please get failure log here.

@davidebeatrici
Copy link
Contributor Author

Is the failure related to my changes?

I don't see failure logs for any Qt ports.

@Neumann-A
Copy link
Contributor

the problem is related to the vcpkg_cmake_wrapper.cmake it simply cannot work correctly for static builds. Fixing the issue here requires linking crypt32.lib additionally

@davidebeatrici
Copy link
Contributor Author

Shouldn't OpenSSL link to that instead?

@Neumann-A
Copy link
Contributor

CMakes FindOpenSSL does not automatically link against crypt32.lib in static builds.

@davidebeatrici
Copy link
Contributor Author

I see, that's unfortunate.

I will update the pull request, thank you.

…Windows 7

From https://docs.microsoft.com/en-us/windows/win32/apiindex/windows-81-api-sets:

"Binaries that link to MinCore.lib or MinCore_Downlevel.lib are not designed to work on Windows 7, Windows Server 2008 R2 or earlier. Binaries that need to run on earlier versions of Windows or Windows Server must not use either MinCore.lib or MinCore_Downlevel.lib."

More specifically, linking an application to a target provided by this port causes it to fail to load because it looks for unavailable UCRT DLLs.

This commit changes the port so that it links to the "normal" libraries rather than MinCore.lib, effectively making the port compatible with Windows 7.

Please note that "UxTheme.lib" was already missing:

Qt5Widgets.lib(qwizard_win.obj) : error LNK2019: unresolved external symbol __imp_OpenThemeData referenced in function "public: class QColor __cdecl QVistaHelper::basicWindowFrameColor(void)" (?basicWindowFrameColor@QVistaHelper@@qeaa?AVQColor@@xz)
Qt5Widgets.lib(qwizard_win.obj) : error LNK2019: unresolved external symbol __imp_DrawThemeBackground referenced in function "public: virtual void __cdecl QVistaBackButton::paintEvent(class QPaintEvent *)" (?paintEvent@QVistaBackButton@@UEAAXPEAVQPaintEvent@@@z)
Qt5Widgets.lib(qwizard_win.obj) : error LNK2019: unresolved external symbol __imp_GetThemeColor referenced in function "public: class QColor __cdecl QVistaHelper::basicWindowFrameColor(void)" (?basicWindowFrameColor@QVistaHelper@@qeaa?AVQColor@@xz)
Qt5Widgets.lib(qwizard_win.obj) : error LNK2019: unresolved external symbol __imp_GetThemeSysFont referenced in function "struct tagLOGFONTW __cdecl getCaptionLogFont(void *)" (?getCaptionLogFont@@ya?AUtagLOGFONTW@@Peax@Z)
Qt5Widgets.lib(qwizard_win.obj) : error LNK2019: unresolved external symbol __imp_IsThemeActive referenced in function "private: static bool __cdecl QVistaHelper::drawBlackRect(class QRect const &,struct HDC__ *)" (?drawBlackRect@QVistaHelper@@CA_NAEBVQRect@@PEAUHDC__@@@z)
Qt5Widgets.lib(qwizard_win.obj) : error LNK2019: unresolved external symbol __imp_SetWindowThemeAttribute referenced in function "public: void __cdecl QVistaHelper::setTitleBarIconAndCaptionVisible(bool)" (?setTitleBarIconAndCaptionVisible@QVistaHelper@@QEAAX_N@Z)
Qt5Widgets.lib(qwizard_win.obj) : error LNK2019: unresolved external symbol __imp_DrawThemeTextEx referenced in function "private: bool __cdecl QVistaHelper::drawTitleText(class QPainter *,class QString const &,class QRect const &,struct HDC__ *)" (?drawTitleText@QVistaHelper@@AEAA_NPEAVQPainter@@AEBVQString@@AEBVQRect@@PEAUHDC__@@@z)
@JackBoosY
Copy link
Contributor

@Neumann-A Any question else?

@Neumann-A
Copy link
Contributor

@JackBoosY: No but if this is merged into master it will generate a merge conflict in #10644 which probably means CI will rerun unnecessarily for #10644 when I solve that merge conflict. The rerun is unnecessary since I completely removed the wrapper in #10644 since it does not correctly work if there are additional dependencies which vcpkg currently does not take into account correctly.

@JackBoosY JackBoosY added needs-further-review info:needs-maintainer-attention Lets the current 'on rotation' vcpkg maintainer know they need to look at this. labels Apr 15, 2020
@Neumann-A
Copy link
Contributor

since #10644 has been merge this PR can be closed

according to #10806 (comment)

@davidebeatrici
Copy link
Contributor Author

Thank you very much for your work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

info:needs-maintainer-attention Lets the current 'on rotation' vcpkg maintainer know they need to look at this.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants