Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linker error when building with MSVC2019, CMAKE SHARED_CORE=TRUE #1084

Open
nstrahl opened this issue Nov 3, 2022 · 2 comments
Open

Linker error when building with MSVC2019, CMAKE SHARED_CORE=TRUE #1084

nstrahl opened this issue Nov 3, 2022 · 2 comments

Comments

@nstrahl
Copy link

nstrahl commented Nov 3, 2022

Greetings everyone,

we are trying to build QtWebkit version 5.212 on windows using cmake and MSVC 2019. We had to set SHARED_CORE option to TRUE to avoid a image size (F85C8000) exceeds maximum allowable size error. The problem is that we are getting a lot of linker errors for Webkit2 as shown in this following snippet:

WebProcessPoolMessageReceiver.obj : error LNK2001: unresolved external symbol "protected: static struct JSC::ClassInfo const WebCore::JSDOMGlobalObject::s_info" (?s_info@JSDOMGlobalObject@WebCore@@1UClassInfo@JSC@@B) [C:\vcpkg\buildtrees\qtwebkit\x86-windows-dbg\Source\WebKit2\WebKit2.vcxproj] 13>WebProcessProxyMessageReceiver.obj : error LNK2001: unresolved external symbol "protected: static struct JSC::ClassInfo const WebCore::JSDOMGlobalObject::s_info" (?s_info@JSDOMGlobalObject@WebCore@@1UClassInfo@JSC@@B) [C:\vcpkg\buildtrees\qtwebkit\x86-windows-dbg\Source\WebKit2\WebKit2.vcxproj] 13>WebIDBConnectionToServerMessageReceiver.obj : error LNK2001: unresolved external symbol "protected: static struct JSC::ClassInfo const WebCore::JSDOMGlobalObject::s_info" (?s_info@JSDOMGlobalObject@WebCore@@1UClassInfo@JSC@@B) [C:\vcpkg\buildtrees\qtwebkit\x86-windows-dbg\Source\WebKit2\WebKit2.vcxproj] 13>WebPageQt.obj : error LNK2001: unresolved external symbol "protected: static struct JSC::ClassInfo const WebCore::JSDOMGlobalObject::s_info" (?s_info@JSDOMGlobalObject@WebCore@@1UClassInfo@JSC@@B) [C:\vcpkg\buildtrees\qtwebkit\x86-windows-dbg\Source\WebKit2\WebKit2.vcxproj] 13>DatabaseProcessMessageReceiver.obj : error LNK2001: unresolved external symbol "protected: static struct JSC::ClassInfo const WebCore::JSDOMGlobalObject::s_info" (?s_info@JSDOMGlobalObject@WebCore@@1UClassInfo@JSC@@B) [C:\vcpkg\buildtrees\qtwebkit\x86-windows-dbg\Source\WebKit2\WebKit2.vcxproj] 13>WebIDBConnectionToClientMessageReceiver.obj : error LNK2001: unresolved external symbol "protected: static struct JSC::ClassInfo const WebCore::JSDOMGlobalObject::s_info" (?s_info@JSDOMGlobalObject@WebCore@@1UClassInfo@JSC@@B) [C:\vcpkg\buildtrees\qtwebkit\x86-windows-dbg\Source\WebKit2\WebKit2.vcxproj] 13>WebPageProxyMessageReceiver.obj : error LNK2001: unresolved external symbol "protected: static struct JSC::ClassInfo const WebCore::JSDOMGlobalObject::s_info" (?s_info@JSDOMGlobalObject@WebCore@@1UClassInfo@JSC@@B) [C:\vcpkg\buildtrees\qtwebkit\x86-windows-dbg\Source\WebKit2\WebKit2.vcxproj] 13>WebProcessPoolQt.obj : error LNK2001: unresolved external symbol "protected: static struct JSC::ClassInfo const WebCore::JSDOMGlobalObject::s_info" (?s_info@JSDOMGlobalObject@WebCore@@1UClassInfo@JSC@@B) [C:\vcpkg\buildtrees\qtwebkit\x86-windows-dbg\Source\WebKit2\WebKit2.vcxproj] 13>WebDragClientQt.obj : error LNK2001: unresolved external symbol "protected: static struct JSC::ClassInfo const WebCore::JSDOMGlobalObject::s_info" (?s_info@JSDOMGlobalObject@WebCore@@1UClassInfo@JSC@@B) [C:\vcpkg\buildtrees\qtwebkit\x86-windows-dbg\Source\WebKit2\WebKit2.vcxproj] 13>CoordinatedLayerTreeHost.obj : error LNK2001: unresolved external symbol "protected: static struct JSC::ClassInfo const WebCore::JSDOMGlobalObject::s_info" (?s_info@JSDOMGlobalObject@WebCore@@1UClassInfo@JSC@@B) [C:\vcpkg\buildtrees\qtwebkit\x86-windows-dbg\Source\WebKit2\WebKit2.vcxproj] 13>WebPageCoordinatedGraphics.obj : error LNK2001: unresolved external symbol "protected: static struct JSC::ClassInfo const WebCore::JSDOMGlobalObject::s_info" (?s_info@JSDOMGlobalObject@WebCore@@1UClassInfo@JSC@@B) [C:\vcpkg\buildtrees\qtwebkit\x86-windows-dbg\Source\WebKit2\WebKit2.vcxproj] 13>TextCheckerQt.obj : error LNK2001: unresolved external symbol "protected: static struct JSC::ClassInfo const WebCore::JSDOMGlobalObject::s_info" (?s_info@JSDOMGlobalObject@WebCore@@1UClassInfo@JSC@@B) [C:\vcpkg\buildtrees\qtwebkit\x86-windows-dbg\Source\WebKit2\WebKit2.vcxproj] 13>WebColorPickerQt.obj : error LNK2001: unresolved external symbol "protected: static struct JSC::ClassInfo const WebCore::JSDOMGlobalObject::s_info" (?s_info@JSDOMGlobalObject@WebCore@@1UClassInfo@JSC@@B) [C:\vcpkg\buildtrees\qtwebkit\x86-windows-dbg\Source\WebKit2\WebKit2.vcxproj] 13>WebPageProxyQt.obj : error LNK2001: unresolved external symbol "protected: static struct JSC::ClassInfo const WebCore::JSDOMGlobalObject::s_info" (?s_info@JSDOMGlobalObject@WebCore@@1UClassInfo@JSC@@B) [C:\vcpkg\buildtrees\qtwebkit\x86-windows-dbg\Source\WebKit2\WebKit2.vcxproj] 13>WebPopupMenuProxyQt.obj : error LNK2001: unresolved external symbol "protected: static struct JSC::ClassInfo const WebCore::JSDOMGlobalObject::s_info" (?s_info@JSDOMGlobalObject@WebCore@@1UClassInfo@JSC@@B) [C:\vcpkg\buildtrees\qtwebkit\x86-windows-dbg\Source\WebKit2\WebKit2.vcxproj] 13>QtWebContext.obj : error LNK2001: unresolved external symbol "protected: static struct JSC::ClassInfo const WebCore::JSDOMGlobalObject::s_info" (?s_info@JSDOMGlobalObject@WebCore@@1UClassInfo@JSC@@B) [C:\vcpkg\buildtrees\qtwebkit\x86-windows-dbg\Source\WebKit2\WebKit2.vcxproj] 13>QtWebPageEventHandler.obj : error LNK2001: unresolved external symbol "protected: static struct JSC::ClassInfo const WebCore::JSDOMGlobalObject::s_info" (?s_info@JSDOMGlobalObject@WebCore@@1UClassInfo@JSC@@B) [C:\vcpkg\buildtrees\qtwebkit\x86-windows-dbg\Source\WebKit2\WebKit2.vcxproj] 13>QtWebPageSGNode.obj : error LNK2001: unresolved external symbol "protected: static struct JSC::ClassInfo const WebCore::JSDOMGlobalObject::s_info" (?s_info@JSDOMGlobalObject@WebCore@@1UClassInfo@JSC@@B) [C:\vcpkg\buildtrees\qtwebkit\x86-windows-dbg\Source\WebKit2\WebKit2.vcxproj] 13>QtWebPageUIClient.obj : error LNK2001: unresolved external symbol "protected: static struct JSC::ClassInfo const WebCore::JSDOMGlobalObject::s_info" (?s_info@JSDOMGlobalObject@WebCore@@1UClassInfo@JSC@@B) [C:\vcpkg\buildtrees\qtwebkit\x86-windows-dbg\Source\WebKit2\WebKit2.vcxproj] 13>ItemSelectorContextObject.obj : error LNK2001: unresolved external symbol "protected: static struct JSC::ClassInfo const WebCore::JSDOMGlobalObject::s_info" (?s_info@JSDOMGlobalObject@WebCore@@1UClassInfo@JSC@@B) [C:\vcpkg\buildtrees\qtwebkit\x86-windows-dbg\Source\WebKit2\WebKit2.vcxproj] 13>PageViewportControllerClientQt.obj : error LNK2001: unresolved external symbol "protected: static struct JSC::ClassInfo const WebCore::JSDOMGlobalObject::s_info" (?s_info@JSDOMGlobalObject@WebCore@@1UClassInfo@JSC@@B) [C:\vcpkg\buildtrees\qtwebkit\x86-windows-dbg\Source\WebKit2\WebKit2.vcxproj] 13>QtDialogRunner.obj : error LNK2001: unresolved external symbol "protected: static struct JSC::ClassInfo const WebCore::JSDOMGlobalObject::s_info" (?s_info@JSDOMGlobalObject@WebCore@@1UClassInfo@JSC@@B) [C:\vcpkg\buildtrees\qtwebkit\x86-windows-dbg\Source\WebKit2\WebKit2.vcxproj] 13>QtPageClient.obj : error LNK2001: unresolved external symbol "protected: static struct JSC::ClassInfo const WebCore::JSDOMGlobalObject::s_info" (?s_info@JSDOMGlobalObject@WebCore@@1UClassInfo@JSC@@B) [C:\vcpkg\buildtrees\qtwebkit\x86-windows-dbg\Source\WebKit2\WebKit2.vcxproj] 13>WebPageProxyCoordinatedGraphics.obj : error LNK2001: unresolved external symbol "protected: static struct JSC::ClassInfo const WebCore::JSDOMGlobalObject::s_info" (?s_info@JSDOMGlobalObject@WebCore@@1UClassInfo@JSC@@B) [C:\vcpkg\buildtrees\qtwebkit\x86-windows-dbg\Source\WebKit2\WebKit2.vcxproj] 13>WebInspectorServerQt.obj : error LNK2001: unresolved external symbol "protected: static struct JSC::ClassInfo const WebCore::JSDOMGlobalObject::s_info" (?s_info@JSDOMGlobalObject@WebCore@@1UClassInfo@JSC@@B) [C:\vcpkg\buildtrees\qtwebkit\x86-windows-dbg\Source\WebKit2\WebKit2.vcxproj] 13>StorageManager.obj : error LNK2001: unresolved external symbol "protected: static struct JSC::ClassInfo const WebCore::JSDOMGlobalObject::s_info" (?s_info@JSDOMGlobalObject@WebCore@@1UClassInfo@JSC@@B) [C:\vcpkg\buildtrees\qtwebkit\x86-windows-dbg\Source\WebKit2\WebKit2.vcxproj] ... C:\vcpkg\buildtrees\qtwebkit\x86-windows-dbg\bin\Debug\WebKit2.dll : fatal error LNK1120: 206 unresolved externals [C:\vcpkg\buildtrees\qtwebkit\x86-windows-dbg\Source\WebKit2\WebKit2.vcxproj]

The full output file has been attached.
install-x86-windows-dbg-out.log

The options passet to cmake are:
-DPORT=Qt
-DENABLE_API_TESTS=FALSE
-DENABLE_XSLT=FALSE
-DENABLE_TEST_SUPPORT=FALSE
-DCMAKE_BUILD_TYPE=Debug
-DSHARED_CORE=TRUE

I am building with Qt5.15.6 and obtained all other dependencies with vcpkg.

The configuration and compilation works fine. Its the linking where things start to go wrong. I checked the missing symbols and they are indeed contained within the WebCore.lib so I can't understand why the error occurs. Thanks in advance!

@annulen
Copy link
Member

annulen commented Nov 3, 2022

If you use SHARED_CORE you are on your own, it's quite likely that nobody have ever tested it with MSVC.

To reduce image size you can follow advises from [1], except static-related things (if you want dlls). In particular, you may want to use ENABLE_WEBKIT2=OFF if you don't use QML/QtQuick APIs, and ENABLE_VIDEO=OFF if you don't need audio/video.

[1] https://github.com/qtwebkit/qtwebkit/wiki/Building-static-libraries

@annulen
Copy link
Member

annulen commented Nov 3, 2022

Sorry, I've missed elephant in the room. -DCMAKE_BUILD_TYPE=Debug is what is causing your image size issues. It's highly recommended to use Release builds. If you need debug info and build for 32-bit target, -DUSE_MINIMAL_DEBUG_INFO_MSVC=ON may help. Note that debug builds don't enable optimization by default and will be much slower than release ones.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants