RESOLVED FIXED 88873
[Qt][Win] Symbols are not exported in QtWebKit5.dll
https://bugs.webkit.org/show_bug.cgi?id=88873
Summary [Qt][Win] Symbols are not exported in QtWebKit5.dll
Simon Hausmann
Reported 2012-06-12 07:43:01 PDT
In the WebKit2 static library we Q_DECL_EXPORT a bunch of classes/functions, but when linking QtWebKit5.dll those symbols are not exported when compiling with MSVC. This is how the MSVC toolchain behaves. The suggested workaround is to run a little script over the static libraries we create to extract all the symbols that are marked for export and make sure that they are actually exported (and not discarded!) in the final dll.
Attachments
Script to facilitate symbol exports (847 bytes, text/x-python)
2012-06-12 07:45 PDT, Simon Hausmann
no flags
Patch (5.17 KB, patch)
2012-06-26 03:51 PDT, Simon Hausmann
no flags
Patch (5.24 KB, patch)
2012-06-26 06:34 PDT, Simon Hausmann
no flags
Patch (5.60 KB, patch)
2012-06-26 06:47 PDT, Simon Hausmann
no flags
Patch (5.22 KB, patch)
2012-06-26 06:53 PDT, Simon Hausmann
vestbo: review+
Simon Hausmann
Comment 1 2012-06-12 07:45:53 PDT
Created attachment 147084 [details] Script to facilitate symbol exports The attached scripts implements the basic functionality needed. Symbols marked for export get a /EXPORT:<name of mangled symbol> in the linker directive section of the .obj file (and thus .lib file). We can extract all these with the script and generate a new file with linker pragmas that should be compiled into QtWebKit5.dll and makes sure that the symbols we want to export are also referenced.
Simon Hausmann
Comment 2 2012-06-25 21:51:23 PDT
After the changes for bug #78109 this is now needed for the the Windows build altogether, because the WK1 API is now also in a separate static library.
Simon Hausmann
Comment 3 2012-06-26 03:51:03 PDT
Jocelyn Turcotte
Comment 4 2012-06-26 04:58:47 PDT
Comment on attachment 149504 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=149504&action=review > Tools/Scripts/mkexports:43 > +print "Found %s symbols in %s" % (len(symbols), sys.argv[1]) This could describe the action made on this symbol for those not knowing what this is about, something like "Forwarding the export of symbol %s from static lib %s". > Tools/qmake/mkspecs/features/win32/default_post.prf:25 > +contains(TARGET, $$resolveFinalLibraryName($${QT.webkit.name})) { Just a nitpick but it's a bit weird to place it in default_post and then add a condition on TARGET. A different way of doing it could be to put a function in functions.prf and call it from api.pri and WebKit1.pro. > Tools/qmake/mkspecs/features/win32/default_post.prf:35 > + exportgen.commands = python $${ROOT_WEBKIT_DIR}$${QMAKE_DIR_SEP}Tools$${QMAKE_DIR_SEP}Scripts$${QMAKE_DIR_SEP}mkexports ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT} If we have to put the script in Tools/Scripts we could name it a bit more like the local script name style. Something like "generate-win32-export-forwards" maybe.
Simon Hausmann
Comment 5 2012-06-26 05:13:22 PDT
Comment on attachment 149504 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=149504&action=review >> Tools/Scripts/mkexports:43 >> +print "Found %s symbols in %s" % (len(symbols), sys.argv[1]) > > This could describe the action made on this symbol for those not knowing what this is about, something like "Forwarding the export of symbol %s from static lib %s". Good idea, will change that. >> Tools/qmake/mkspecs/features/win32/default_post.prf:25 >> +contains(TARGET, $$resolveFinalLibraryName($${QT.webkit.name})) { > > Just a nitpick but it's a bit weird to place it in default_post and then add a condition on TARGET. > A different way of doing it could be to put a function in functions.prf and call it from api.pri and WebKit1.pro. True. Either that or we simply don't do that check and always implement this behaviour when TEMPLATE = lib and contains(CONFIG, shared) Essentially this is adding the missing bits on win32 that --whole-archive is on linux for example. >> Tools/qmake/mkspecs/features/win32/default_post.prf:35 >> + exportgen.commands = python $${ROOT_WEBKIT_DIR}$${QMAKE_DIR_SEP}Tools$${QMAKE_DIR_SEP}Scripts$${QMAKE_DIR_SEP}mkexports ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT} > > If we have to put the script in Tools/Scripts we could name it a bit more like the local script name style. Something like "generate-win32-export-forwards" maybe. Alright, I like export-forwards in the name.
Simon Hausmann
Comment 6 2012-06-26 06:34:53 PDT
Simon Hausmann
Comment 7 2012-06-26 06:47:12 PDT
Simon Hausmann
Comment 8 2012-06-26 06:53:57 PDT
Simon Hausmann
Comment 9 2012-06-26 07:29:20 PDT
Note You need to log in before you can comment on or make changes to this bug.