diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-07-16 14:54:25 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-07-18 14:00:44 +0200 |
commit | b4ad5d9d2b96baacd0180ead50de5195ca78af2d (patch) | |
tree | b80478e0874813a0b4b861d6a61eb91450ad52af | |
parent | ccc997a8b47e2d0bd7afb467c11f20fb8eed5c73 (diff) | |
download | qtwebkit-b4ad5d9d2b96baacd0180ead50de5195ca78af2d.tar.gz |
[Qt] MSVC: unresolved external symbol __DllMainCRTStartup@12
https://bugs.webkit.org/show_bug.cgi?id=91229
Reviewed by NOBODY (OOPS!).
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:
-rw-r--r-- | Tools/ChangeLog | 30 | ||||
-rwxr-xr-x | Tools/Scripts/generate-win32-export-forwards | 23 | ||||
-rw-r--r-- | Tools/qmake/mkspecs/features/win32/default_post.prf | 17 |
3 files changed, 55 insertions, 15 deletions
diff --git a/Tools/ChangeLog b/Tools/ChangeLog index 5ed428bc0..cfb10f4f7 100644 --- a/Tools/ChangeLog +++ b/Tools/ChangeLog @@ -1,3 +1,33 @@ +2012-07-16 Simon Hausmann <simon.hausmann@nokia.com> + + [Qt] MSVC: unresolved external symbol __DllMainCRTStartup@12 + https://bugs.webkit.org/show_bug.cgi?id=91229 + + Reviewed by NOBODY (OOPS!). + + 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-18 Simon Hausmann <simon.hausmann@nokia.com> [ANGLE] On QT, use Bison and Flex during ANGLE build diff --git a/Tools/Scripts/generate-win32-export-forwards b/Tools/Scripts/generate-win32-export-forwards index e75b430f4..768b3ba93 100755 --- a/Tools/Scripts/generate-win32-export-forwards +++ b/Tools/Scripts/generate-win32-export-forwards @@ -27,22 +27,27 @@ import subprocess 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, errors = dumpBin.communicate(); + return output -exportedSymbolRegexp = re.compile("\s*(?P<symbol>/EXPORT:.+)"); +libraries = sys.argv[1 : len(sys.argv) - 1] +outputFileName = sys.argv[len(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 != None: + 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() diff --git a/Tools/qmake/mkspecs/features/win32/default_post.prf b/Tools/qmake/mkspecs/features/win32/default_post.prf index d45d0455e..116556701 100644 --- a/Tools/qmake/mkspecs/features/win32/default_post.prf +++ b/Tools/qmake/mkspecs/features/win32/default_post.prf @@ -25,16 +25,21 @@ load(default_post) 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) { + win32: suffix = d + mac: suffix = _debug + } + 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 |