Title: [123465] trunk/Tools
Revision
123465
Author
hausm...@webkit.org
Date
2012-07-24 06:24:30 -0700 (Tue, 24 Jul 2012)

Log Message

[Qt] MSVC: unresolved external symbol __DllMainCRTStartup@12
https://bugs.webkit.org/show_bug.cgi?id=91229

Reviewed by Jocelyn Turcotte.

In order to successfully link a DLL on Windows we need to have at least
one object file (or compilation unit). The forward export header files were
supposed to be that, but unfortunately the rule in win32/default_post.prf for
creating the header files had some bugs, among others that it did an exists()
check on the depending static library. At the time qmake is ran those libraries
do not exist yet and therefore the corresponding extra compiler rules were never
created, resulting in empty OBJECTS/SOURCES.

Even without such an exists() check, qmake extra compilers require the files
referred to in the .input variable to exist at qmake time. In this case the input
files were the static libraries, which do not exist yet.

This patch solves this by using a qmake extra target instead of extra
compiler, which does not have this limitation. The target is referenced
through the extension of GENERATED_SOURCES.

The patch also adds a d/_debug suffix for debug builds, do allow for separate
symbol exports if necessary.

* Scripts/generate-win32-export-forwards: Support multiple input files, i.e.
consider the last argument to be the output file and everything else input.
* qmake/mkspecs/features/win32/default_post.prf:

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (123464 => 123465)


--- trunk/Tools/ChangeLog	2012-07-24 13:14:46 UTC (rev 123464)
+++ trunk/Tools/ChangeLog	2012-07-24 13:24:30 UTC (rev 123465)
@@ -1,3 +1,33 @@
+2012-07-24  Simon Hausmann  <simon.hausm...@nokia.com>
+
+        [Qt] MSVC: unresolved external symbol __DllMainCRTStartup@12
+        https://bugs.webkit.org/show_bug.cgi?id=91229
+
+        Reviewed by Jocelyn Turcotte.
+
+        In order to successfully link a DLL on Windows we need to have at least
+        one object file (or compilation unit). The forward export header files were
+        supposed to be that, but unfortunately the rule in win32/default_post.prf for
+        creating the header files had some bugs, among others that it did an exists()
+        check on the depending static library. At the time qmake is ran those libraries
+        do not exist yet and therefore the corresponding extra compiler rules were never
+        created, resulting in empty OBJECTS/SOURCES.
+
+        Even without such an exists() check, qmake extra compilers require the files
+        referred to in the .input variable to exist at qmake time. In this case the input
+        files were the static libraries, which do not exist yet.
+
+        This patch solves this by using a qmake extra target instead of extra
+        compiler, which does not have this limitation. The target is referenced
+        through the extension of GENERATED_SOURCES.
+
+        The patch also adds a d/_debug suffix for debug builds, do allow for separate
+        symbol exports if necessary.
+
+        * Scripts/generate-win32-export-forwards: Support multiple input files, i.e.
+        consider the last argument to be the output file and everything else input.
+        * qmake/mkspecs/features/win32/default_post.prf:
+
 2012-07-24  Balazs Kelemen  <kbal...@webkit.org>
 
         [Qt] Add quirks for running the web process in a profiler shell, like valgrind

Modified: trunk/Tools/Scripts/generate-win32-export-forwards (123464 => 123465)


--- trunk/Tools/Scripts/generate-win32-export-forwards	2012-07-24 13:14:46 UTC (rev 123464)
+++ trunk/Tools/Scripts/generate-win32-export-forwards	2012-07-24 13:24:30 UTC (rev 123465)
@@ -27,22 +27,27 @@
 import sys
 import re
 
-dumpBin = subprocess.Popen("dumpbin /directives " + sys.argv[1], stdout=subprocess.PIPE, universal_newlines=True);
+def exportForwardsForLibrary(library):
+    dumpBin = subprocess.Popen("dumpbin /directives " + library, stdout=subprocess.PIPE, universal_newlines=True)
 
-output, errors = dumpBin.communicate();
+    output = dumpBin.communicate()[0]
+    return output
 
-exportedSymbolRegexp = re.compile("\s*(?P<symbol>/EXPORT:.+)");
+libraries = sys.argv[1 : -1]
+outputFileName = sys.argv[-1]
 
+exportedSymbolRegexp = re.compile("\s*(?P<symbol>/EXPORT:.+)")
 symbols = set()
 
-for line in output.splitlines():
-    match = exportedSymbolRegexp.match(line)
-    if match != None:
-        symbols.add(match.group("symbol"))
+for lib in libraries:
+    for line in exportForwardsForLibrary(lib).splitlines():
+        match = exportedSymbolRegexp.match(line)
+        if match:
+            symbols.add(match.group("symbol"))
 
-print "Forwarding %s symbols from static library %s" % (len(symbols), sys.argv[1])
+print "Forwarding %s symbols from %s" % (len(symbols), " ".join(libraries))
 
-exportFile = open(sys.argv[2], "w")
+exportFile = open(outputFileName, "w")
 for symbol in symbols:
     exportFile.write("#pragma comment(linker, \"%s\")\n" % symbol);
 exportFile.close()

Modified: trunk/Tools/qmake/mkspecs/features/win32/default_post.prf (123464 => 123465)


--- trunk/Tools/qmake/mkspecs/features/win32/default_post.prf	2012-07-24 13:14:46 UTC (rev 123464)
+++ trunk/Tools/qmake/mkspecs/features/win32/default_post.prf	2012-07-24 13:24:30 UTC (rev 123465)
@@ -25,16 +25,18 @@
 shared:contains(TEMPLATE, lib) {
     for(target, POST_TARGETDEPS) {
         libdep = $$find(target, .*\\.lib)
-        exists($$libdep): LIBSWITHEXPORTS += $$libdep
+        !isEmpty(libdep): LIBSWITHEXPORTS += $$libdep
     }
 }
 
 !isEmpty(LIBSWITHEXPORTS) {
-    exportgen.input = LIBSWITHEXPORTS
-    exportgen.output = exports_${QMAKE_FILE_BASE}.cpp
-    exportgen.commands = python $${ROOT_WEBKIT_DIR}$${QMAKE_DIR_SEP}Tools$${QMAKE_DIR_SEP}Scripts$${QMAKE_DIR_SEP}generate-win32-export-forwards ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT}
-    exportgen.variable_out = SOURCES
-    QMAKE_EXTRA_COMPILERS += exportgen
+    suffix =
+    CONFIG(debug, debug|release): suffix = d
+    forwarded_exports.target = forwarded-exports$${suffix}.cpp
+    forwarded_exports.commands = python $${ROOT_WEBKIT_DIR}$${QMAKE_DIR_SEP}Tools$${QMAKE_DIR_SEP}Scripts$${QMAKE_DIR_SEP}generate-win32-export-forwards $$LIBSWITHEXPORTS $$forwarded_exports.target
+    forwarded_exports.depends = $$LIBSWITHEXPORTS
+    QMAKE_EXTRA_TARGETS += forwarded_exports
+    GENERATED_SOURCES += $$forwarded_exports.target
 }
 
 # To ensure the Qt export macros are set to dllexport
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to