Summary: | [Qt] MinGW-w64 64-bit build fails when linking libQt5WebKitWidgetsd | ||||||||
---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Jonathan Liu <net147> | ||||||
Component: | WebKit Qt | Assignee: | Nobody <webkit-unassigned> | ||||||
Status: | RESOLVED FIXED | ||||||||
Severity: | Major | CC: | abecsi, hausmann, jturcotte, kai.koehne, vestbo, webkit.review.bot, zcrendel | ||||||
Priority: | P2 | ||||||||
Version: | 528+ (Nightly build) | ||||||||
Hardware: | PC | ||||||||
OS: | Windows 7 | ||||||||
Bug Depends on: | |||||||||
Bug Blocks: | 103747 | ||||||||
Attachments: |
|
Description
Jonathan Liu
2012-12-08 02:07:34 PST
Created attachment 178346 [details]
Full logs configuring and compiling with 8 threads
Full logs attached
Exactly same problem with cross-compilation using mingw32. I found out how to build and link it, now it works. Hope this help to make a patch to fix this. The problem is how Qt5WebKit.dll link with static libraries. 1) so the static libraries now presented in link line part like (see WebKitBuild/Release/Source/Makefile.Release, 'LIBS =' section): ... -lWebKit1 -lWebCore -lJavaScriptCore -Wl,-whole-archive -lWTF -Wl,-no-whole-archive ... thus only -lWTF braced by -Wl,-whole-archive and -Wl,-no-whole-archive, to fix the problem and import functions it shouble be as the following: ... -Wl,-whole-archive -lWTF -Wl,-no-whole-archive -Wl,-whole-archive -lWebKit1 -Wl,-no-whole-archive -Wl,-whole-archive -lWebCore -Wl,-no-whole-archive -Wl,-whole-archive -lJavaScriptCore -Wl,-no-whole-archive ... also the important moment, the following libs: -lshlwapi -lversion must follow -lWebCore, so finally link line part do the job: ... -Wl,-whole-archive -lWTF -Wl,-no-whole-archive -Wl,-whole-archive -lWebKit1 -Wl,-no-whole-archive -Wl,-whole-archive -lWebCore -Wl,-no-whole-archive -lshlwapi -lversion -Wl,-whole-archive -lJavaScriptCore -Wl,-no-whole-archive ... 2) After first step functions should be exported well (and placed into import file .a), but Qt5WebKitWidgets still cannot link, cause it can't find the Qt5WebKit library itself. I did link to it differently and it worked well, the changes in WebKitBuild/Release/Source/Makefile.widgetsapi.Release, section 'LIB =': from '-L<PathToWebkit>/WebKitBuild/Release/lib -lQt5WebKit', to '<PathToWebkit>/WebKitBuild/Release/lib/Qt5WebKit.dll' Hope it help to fix this upstream! No patch yet, but some insights: There's MSVC specific logic in Tools\qmake\mkspecs\features\win32\default_post.prf , Tools\Scripts\generate-win32-export-forwards that "extract[s] exporting linker directives from all static libraries we're linking into the DLL and make sure they are also exported from the DLL.". Maybe we've to write something similar with MinGW tools? I get the following compile error if I try to compile Qt5WebKitd.dll: g++ -shared -Wl,--out-implib,C:\Work\git\qt5\qtbase\lib\libQt5WebKitd.a -o C:\Work\git\qt5\qtbase\lib\Qt5WebKitd.dll obj/debug/qrc_WebCore.o obj/debug/qrc_WebKit.o obj/debug/qrc_InspectorBackendCommands.o -LC:\Qt\qt5_deps\icu\dist\lib -LC:\Qt\qt5_deps\openssl-1.0.1c\dist\lib -LC:/Work/git/qt5/qtbase/lib -lQt5Networkd -lQt5Guid -lQt5Cored -llibEGLd -llibGLESv2d -lgdi32 -luser32 obj\debug\Qt5WebKitd_resource_res.o -Wl,-whole-archive -lWebKit1d -Wl,-no-whole-archive -LC:/Work/git/qt5/qtwebkit/Source/WebKit/debug -Wl,-whole-archive -lWebKit2d -Wl,-no-whole-archive -LC:/Work/git/qt5/qtwebkit/Source/WebKit2/debug -Wl,-whole-archive -lWebCored -Wl,-no-whole-archive -LC:/Work/git/qt5/qtwebkit/Source/WebCore/debug -ladvapi32 -lshell32 -lshlwapi -lversion -llibEGL -llibGLESv2 -lole32 -luser32 -lANGLEd -LC:/Work/git/qt5/qtwebkit/Source/ThirdParty/ANGLE/debug -Wl,-whole-archive -lJavaScriptCored -Wl,-no-whole-archive -LC:/Work/git/qt5/qtwebkit/Source/JavaScriptCore/debug -Wl,-whole-archive -lWTFd -Wl,-no-whole-archive -LC:/Work/git/qt5/qtwebkit/Source/WTF/debug -licuin -licuuc -licudt -lwinmm -lgdi32 -LC:/Work/git/qt5/qtbase/lib -lQt5Quickd -lQt5Qmld -lQt5Sqld -lQt5Guid -lQt5Networkd -lQt5Cored C:/Work/git/qt5/qtwebkit/Source/JavaScriptCore/debug/libJavaScriptCored.a(SymbolTable.o):SymbolTable.cpp:(.text+0x383): undefined reference to `JSC::JSCell::classInfo() const' C:/Work/git/qt5/qtwebkit/Source/JavaScriptCore/debug/libJavaScriptCored.a(StructureChain.o):StructureChain.cpp:(.text+0x40): undefined reference to `JSC::JSCell::classInfo() const' C:/Work/git/qt5/qtwebkit/Source/JavaScriptCore/debug/libJavaScriptCored.a(StructureChain.o):StructureChain.cpp:(.text+0xce): undefined reference to `JSC::JSCell::classInfo() const' C:/Work/git/qt5/qtwebkit/Source/JavaScriptCore/debug/libJavaScriptCored.a(StructureChain.o):StructureChain.cpp:(.text+0x5b9): undefined reference to `JSC::JSCell::classInfo() const' c:/mingw64-4.7.2/bin/../lib/gcc/x86_64-w64-mingw32/4.7.2/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Work/git/qt5/qtwebkit/Source/JavaScriptCore/debug/libJavaScriptCored.a(StructureChain.o): bad reloc address 0x0 in section `.data' collect2.exe: error: ld returned 1 exit status Same undefined reference to JSC::JSCell::classInfo() errors as in https://bugs.webkit.org/show_bug.cgi?id=100592 when compiling debug. Looks like a problem with Qt 5 qmake specific to win32-g++ mkspec. It seems to be removing the duplicate -Wl,-whole-archive and -Wl,-no-whole-archive linker flags. Qt 4 qmake didn't remove the duplicate linker flags. Created attachment 179585 [details]
Patch
Comment on attachment 179585 [details] Patch Attachment 179585 [details] did not pass mac-ews (mac): Output: http://queues.webkit.org/results/15366040 New failing tests: fast/frames/sandboxed-iframe-attribute-parsing.html Comment on attachment 179585 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=179585&action=review LGTM. > Tools/ChangeLog:3 > + Fix linking of libraries with -Wl,-whole-archive The ChangeLog should have the same title as the bug. Bug title updated to match patch. Comment on attachment 179585 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=179585&action=review >> Tools/ChangeLog:3 >> + Fix linking of libraries with -Wl,-whole-archive > > The ChangeLog should have the same title as the bug. I disagree. Is that rule documented somewhere? I find it very unintuitive that the one-line-summaries of patches describe the original bug, not a summary of the fix. (In reply to comment #10) > Bug title updated to match patch. This is equally unintuitive :) We're dealing with two different entities, a bug (report), and a patch (fix), there's no reason to force them to be the same (even if it's what webkit-patch tends to generate). Changed back then. (In reply to comment #11) > (From update of attachment 179585 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=179585&action=review > > >> Tools/ChangeLog:3 > >> + Fix linking of libraries with -Wl,-whole-archive > > > > The ChangeLog should have the same title as the bug. > > I disagree. Is that rule documented somewhere? I find it very unintuitive that the one-line-summaries of patches describe the original bug, not a summary of the fix. Indeed it is not documented, but it is applied as a de-facto rule, since the short description of the changelog is not the same as the one-line-summary in git terminology. I think the title in the changelog should give the context for the patch, which also includes the port and configuration affected, which is in most cases the same as bug title, but this does not mean that the further description of the patch should be the same as the bug report. Anyway, this is subjective and does not affect the relevance of the patch. Comment on attachment 179585 [details]
Patch
r=me
Theoretically this line could also be placed elsewhere (it's a config, not a per-library kind of thing), but then having it near the --whole-archive LIBS addition makes it clearer that those two are related.
Yeah I don't think it's an actual _rule_ that the first line has to be that, but webkit-patch chooses it as default when filling out ChangeLogs. That I think is a sensible default and if the title of the bug is suitable for the changelog, then it's a good fit. Otherwise I think anyone is free to change it.
Comment on attachment 179585 [details] Patch Clearing flags on attachment: 179585 Committed r137886: <http://trac.webkit.org/changeset/137886> All reviewed patches have been landed. Closing bug. *** Bug 103491 has been marked as a duplicate of this bug. *** |