RESOLVED DUPLICATE of bug 35607 34922
Mingw-w64 fixes for QtWebKit (WebCore and JavaScriptCore)
https://bugs.webkit.org/show_bug.cgi?id=34922
Summary Mingw-w64 fixes for QtWebKit (WebCore and JavaScriptCore)
vanboxem.ruben
Reported 2010-02-13 09:31:50 PST
Created attachment 48706 [details] patch with fixes required by QtWebkit for mingw64 mingw-w64 can compile 64-bit binaries for Windows. While patching Qt 4.6, I came across some bugs (mostly pointer casts) that were problematic in the compilation of QtWebkit. Patches are the same as merge request for Qt (but patch needed to be redirected here for Webkit component): http://qt.gitorious.org/qt/qt/merge_requests/2308
Attachments
patch with fixes required by QtWebkit for mingw64 (4.70 KB, patch)
2010-02-13 09:31 PST, vanboxem.ruben
no flags
patch with fixes required by QtWebkit for mingw64 (6.35 KB, patch)
2010-02-13 10:04 PST, vanboxem.ruben
no flags
version 2 of patch, no changelog yet (8.46 KB, patch)
2010-02-15 12:43 PST, vanboxem.ruben
no flags
patch with fixes required by QtWebkit for mingw64 -v2 (10.16 KB, patch)
2010-02-15 13:51 PST, vanboxem.ruben
no flags
patch with fixes required by QtWebkit for mingw64 -v2 (9.85 KB, patch)
2010-02-15 13:54 PST, vanboxem.ruben
no flags
patch with fixes required by QtWebkit for mingw64 -v2 (9.76 KB, patch)
2010-02-16 23:35 PST, vanboxem.ruben
no flags
patch with fixes required by QtWebkit for mingw64 -v3 (9.35 KB, patch)
2010-02-17 09:03 PST, vanboxem.ruben
abarth: review-
patch with fixes required by QtWebkit for mingw64 -v3 (9.52 KB, patch)
2010-03-22 11:18 PDT, vanboxem.ruben
no flags
patch with fixes required by QtWebkit for mingw64 -v3 (9.35 KB, patch)
2010-03-22 12:18 PDT, vanboxem.ruben
no flags
Benjamin Poulain
Comment 1 2010-02-13 09:52:07 PST
Great you already posted the patches here :) You need to create a Changelog for you patch. Execute the script prepare-changelog: WebKitTools/Script/prepare-changelog --bug 34922 Then, edit the changelog files to explain the changes, and submit the diff, changelog included.
vanboxem.ruben
Comment 2 2010-02-13 10:04:06 PST
Created attachment 48707 [details] patch with fixes required by QtWebkit for mingw64 add missing changelogs to diff
Zoltan Herczeg
Comment 3 2010-02-15 05:53:26 PST
(In reply to comment #2) > Created an attachment (id=48707) [details] > patch with fixes required by QtWebkit for mingw64 > > add missing changelogs to diff Hm, these stray defines are not the WebKit way. We have COMPILER(MINGW) and CPU(X86_64) in JavaScriptCore/wtf/Platform.h Their combination looks better... (but you still need to update these macro definitions for your platform) Would also be interesting to see whether the JIT can be enabled on your platform (see ENABLE_JIT macros in the same header file).
vanboxem.ruben
Comment 4 2010-02-15 09:01:16 PST
Will fix this by editing platform.h, COMPILER(MINGW) section: /* COMPILER(MINGW) - MinGW GCC */ /* COMPILER(MINGW64) - mingw-w64 GCC - only used as additional check to exclude mingw.org specific functions */ #ifdef __MINGW32__ #define WTF_COMPILER_MINGW 1 #include <_mingw.h> /* private MinGW header */ # ifdef __MINGW64_VERSION_MAJOR /* best way to check for mingw-w64 vs mingw.org */ # define WTF_COMPILER_MINGW64 1 # endif /* __MINGW64_VERSION_MAJOR */ #endif /* __MINGW32__ */ This is required to differentiate between the two #if ( COMPILER(MINGW) && !COMPILER(MINGW64) ) but default to standard COMPILER(MINGW) behavior. Additional patched files will be added, but take a bit more time. I'm checking the build with perl WebKitTools/Scripts/build-webkit --qt from cmd.exe with mingw64/bin and bison, flex... in PATH.
Zoltan Herczeg
Comment 5 2010-02-15 12:26:46 PST
Ok, I understand your intention, but it is unusual in WebKit to concatenate the compiler and cpu id. We Have COMPILER(GCC), COMPILER(RVCT), CPU(SPARC64), CPU(PPC32), but we don't have COMPILER(MSVC64), or CPU(GCC_X86). This naming convention was not my idea, but we should follow them. > #if ( COMPILER(MINGW) && !COMPILER(MINGW64) ) can't we simply use #if ( COMPILER(MINGW) && !CPU(X86_64) ) ?
vanboxem.ruben
Comment 6 2010-02-15 12:33:57 PST
The problem is, *if* mingw.org ever decides to bring out a 64-bit version, they still have access to different functions, and use a different crt. For example, in JavaScriptCore/runtime/Collector.cpp, mingw.org has its own implementation, whereas mingw-w64 allows the msvc codepath to be taken. Also, for the mingw-w32 variant (also from the mingw-w64 team), which produces 32-bit binaries, the given example will not compile, because some mingw.org functions (Collector.cpp:line 324:__mingw_aligned_free and line 233 __mingw_aligned_malloc) are not implemented in mingw-w64/w32, because they have the msvc functions. To see this difference, we either need a way to check __MINGW64_VERSION_MAJOR (the only stable way to check for the difference), which I implemented like so. I hope you understand the reasoning behind my decision. PS: I did not concatenate the CPU in the COMPILER check, mingw-w32 will also register as COMPILER(MINGW64), because of the reason stated above.
vanboxem.ruben
Comment 7 2010-02-15 12:43:47 PST
Created attachment 48770 [details] version 2 of patch, no changelog yet Preliminary patch including new (additional) COMPILER(MINGW64) instead of ifdefs for __MINGW64_VERSION_MAJOR Additional changes were made vs the previous patch (PluginView.cpp and TransformationMatrix.h), discovered when compiling webkit for Qt on mingw-w64.
WebKit Review Bot
Comment 8 2010-02-15 12:47:52 PST
Attachment 48770 [details] did not pass style-queue: Failed to run "WebKitTools/Scripts/check-webkit-style" exit_code: 1 WebCore/platform/text/TextStream.h:31: Alphabetical sorting problem. [build/include_order] [4] WebCore/platform/text/TextStream.h:50: Tab found; better to use spaces [whitespace/tab] [1] WebCore/platform/text/TextStream.h:50: Extra space after ( [whitespace/parens] [2] JavaScriptCore/wtf/Platform.h:954: Tab found; better to use spaces [whitespace/tab] [1] WebCore/plugins/win/PluginViewWin.cpp:1025: Tab found; better to use spaces [whitespace/tab] [1] WebCore/plugins/win/PluginViewWin.cpp:1025: Extra space after ( [whitespace/parens] [2] JavaScriptCore/runtime/Collector.cpp:569: Tab found; better to use spaces [whitespace/tab] [1] JavaScriptCore/runtime/Collector.cpp:569: Extra space after ( [whitespace/parens] [2] JavaScriptCore/runtime/Collector.cpp:579: Tab found; better to use spaces [whitespace/tab] [1] JavaScriptCore/runtime/Collector.cpp:579: Extra space after ( [whitespace/parens] [2] WebCore/platform/text/TextStream.cpp:112: Tab found; better to use spaces [whitespace/tab] [1] WebCore/platform/text/TextStream.cpp:112: Extra space after ( [whitespace/parens] [2] Total errors found: 12 If any of these errors are false positives, please file a bug against check-webkit-style.
Zoltan Herczeg
Comment 9 2010-02-15 13:33:04 PST
(In reply to comment #6) You mean mingw64 is more like a different platform instead of a 64 bit mingw compiler. Why didn't they give it a different name then? Anyway, would be interesting to hear the others opinion. One more note: please remove the /home/Ruben/webkit-svn/WebKit/WebCore/bindings/scripts in WebKitTools/Scripts/build-webkit
vanboxem.ruben
Comment 10 2010-02-15 13:51:13 PST
Created attachment 48776 [details] patch with fixes required by QtWebkit for mingw64 -v2 patch v2 proper with changelog modifications
vanboxem.ruben
Comment 11 2010-02-15 13:54:51 PST
Created attachment 48777 [details] patch with fixes required by QtWebkit for mingw64 -v2 removed double changelog addition. Sorry about the mess.
vanboxem.ruben
Comment 12 2010-02-15 13:57:14 PST
Yes, in that aspect, mingw64 is a different platform, but it also uses much of mingw.org's functionality, and to keep backward compatibility with many projects (as a lot of projects, like ogg, vorbis, flac, gsl, fftw) build on mingw64 without change. I hope I have elaborated enough to be convincing :)
Gabor Loki
Comment 13 2010-02-16 05:23:53 PST
>-#if COMPILER(MINGW) >+#if ( COMPILER(MINGW) && !COMPILER(MINGW64) ) Although the style bot did not say anything about this change, I think this looks bad. I have never seen such an #if construct. First of all, leave no space between parentheses and its content! Additionally, in this case there is no reason to put parentheses around this expression. > /* COMPILER(MINGW) - MinGW GCC */ >-#if defined(MINGW) || defined(__MINGW32__) >+/* COMPILER(MINGW64) - mingw-w64 GCC - only used as additional check to exclude mingw.org specific functions */ >+#if defined (__MINGW32__) > #define WTF_COMPILER_MINGW 1 >-#endif >+#include <_mingw.h> /* private MinGW header */ >+# if defined (__MINGW64_VERSION_MAJOR) /* best way to check for mingw-w64 vs mingw.org */ >+# define WTF_COMPILER_MINGW64 1 >+# endif /* __MINGW64_VERSION_MAJOR */ >+#endif /* __MINGW32__ */ Hmmm, __MINGW32__ is set for MINGW64 as well. So, you do not need the following extra check on x86: > #if PLATFORM(QT) > #if (CPU(X86) && OS(WINDOWS) && COMPILER(MINGW) && GCC_VERSION >= 40100) \ >+ || (CPU(X86) && OS(WINDOWS) && COMPILER(MINGW64) && GCC_VERSION >= 40100) \
vanboxem.ruben
Comment 14 2010-02-16 23:35:37 PST
Created attachment 48865 [details] patch with fixes required by QtWebkit for mingw64 -v2 Style fixes not caught by style-bot.
vanboxem.ruben
Comment 15 2010-02-17 09:03:18 PST
Created attachment 48905 [details] patch with fixes required by QtWebkit for mingw64 -v3 - Fixed broken patch that fixed style problems. - Changed getStackBase so that OS(WINDOWS) && CPU(X86) && COMPILER(GCC) uses the mingw.org asm block (and for obvious reasons not the msvc __asm one)
Thierry Bastian
Comment 16 2010-03-01 01:19:13 PST
*** Bug 35376 has been marked as a duplicate of this bug. ***
vanboxem.ruben
Comment 17 2010-03-09 12:49:44 PST
Any progress on this issue? Thanks.
Tor Arne Vestbø
Comment 18 2010-03-10 06:41:15 PST
Please follow the QtWebKit bug reporting guidelines when reporting bugs. See http://trac.webkit.org/wiki/QtWebKitBugs Specifically: - The 'QtWebKit' component should only be used for bugs/features in the public QtWebKit API layer, not to signify that the bug is specific to the Qt port of WebKit http://trac.webkit.org/wiki/QtWebKitBugs#Component - Add the keyword 'Qt' to signal that it's a Qt-related bug http://trac.webkit.org/wiki/QtWebKitBugs#Keywords
Jocelyn Turcotte
Comment 19 2010-03-11 01:44:22 PST
(In reply to comment #17) > Any progress on this issue? Thanks. I can't give you review+ but the patch looks good to me. The only complaint I got is that COMPILER(MINGW64) might be confusing, especially if we start having stuff like COMPILER(MINGW64) && !CPU(X86_64) for MinGW-w32. What do you think about adding the extra W: COMPILER(MINGWW64) ?
vanboxem.ruben
Comment 20 2010-03-13 05:49:45 PST
I understand it may be confusing, but the shorthand way of saying you're using the mingw-w64/w32 toolchain is mingw64. For example functions that are provided by the mingw64 vs mingw.org project are shared across bitness, so you need a bitness-independent way of checking the toolchain/compiler used). The extra W would imply you are using "mingw-w64", but mingw64 could mean both *-w64 and *-w32 (IMHO). I see it like this: MINGW64 -> mingw-w64/w32 MINGWW64 -> mingw-w64 MINGWW32 -> mingw-w32 (necessary addition, which will forever be confused with regular MINGW) I understand their project name isn't the best choice for stuff like this, but I presume it started as 64-bit only, but they then realized it could be much more and 32-bit as well.
Adam Barth
Comment 21 2010-03-22 09:16:29 PDT
Comment on attachment 48905 [details] patch with fixes required by QtWebkit for mingw64 -v3 + #elif OS(WINDOWS) && CPU(X86_64) \ No need for a line break here. (Several instances of this comment.) - typedef unsigned long uword; + typedef uintptr_t uword; Are you sure this change is correct? It would seem to have effects beyond Mingw-w64. Similarly, uint32 => uintptr_t.
vanboxem.ruben
Comment 22 2010-03-22 11:18:40 PDT
Created attachment 51313 [details] patch with fixes required by QtWebkit for mingw64 -v3 the line breaks have been removed. firstly: uword is used here for pointer casts, which makes uintptr_t a good replacement secondly: unsigned long in 32-bit in 32-bit and 64-bit windows, so that makes it a bad choice for this situation.
vanboxem.ruben
Comment 23 2010-03-22 12:18:08 PDT
Created attachment 51327 [details] patch with fixes required by QtWebkit for mingw64 -v3 now without hiccups (note to self, don't modify patch files by hand)
vanboxem.ruben
Comment 24 2010-03-22 12:36:54 PDT
The new svn version has these patches applied, but in a bad way (my first attempt at a patch). This is why the latest patch fails to apply. For example: http://svn.webkit.org/repository/webkit/trunk/JavaScriptCore/runtime/Collector.cpp line 323 has the !defined(__MINGW64_VERSION_MAJOR) appended to it. Anyone know what happened?
vanboxem.ruben
Comment 25 2010-03-22 12:40:24 PDT
Found reference to this bug report in the changelog present in current svn: https://bugs.webkit.org/show_bug.cgi?id=35607 Doesn't seem reviewed and stuff though??
Benjamin Poulain
Comment 26 2010-03-22 14:03:21 PDT
(In reply to comment #25) > Found reference to this bug report in the changelog present in current svn: > https://bugs.webkit.org/show_bug.cgi?id=35607 > > Doesn't seem reviewed and stuff though?? From 35607, https://bug-35607-attachments.webkit.org/attachment.cgi?id=49852 already landed (see the history: https://bugs.webkit.org/show_activity.cgi?id=35607 ).
vanboxem.ruben
Comment 27 2010-03-22 14:09:11 PDT
Well, it's a sucky patch IMHO. There is some stuff in there (like the "defined(__MINGW64_VERSION_MAJOR)") that goes straight against comment #3 here... among other things.
Benjamin Poulain
Comment 28 2010-03-22 14:21:39 PDT
(In reply to comment #27) > Well, it's a sucky patch IMHO. There is some stuff in there (like the > "defined(__MINGW64_VERSION_MAJOR)") that goes straight against comment #3 > here... among other things. I really can't help you, I don't know much about MinGW. But you should definitely comment on https://bugs.webkit.org/show_bug.cgi?id=35607 If you want, I can mark this task as a duplicate of 35607, and you can contribute directly on 35607 (it seems that one has gained more visibility). If a patch of 35607 is not correct, you can add a patch in the task to fix it.
vanboxem.ruben
Comment 29 2010-03-24 13:37:44 PDT
I'd like that. Will I have to make a patch that undoes the other patch or just patch over it? Thanks
Benjamin Poulain
Comment 30 2010-03-24 14:32:55 PDT
(In reply to comment #29) > I'd like that. Will I have to make a patch that undoes the other patch or just > patch over it? Thanks It is probably easier to patch over it. *** This bug has been marked as a duplicate of bug 35607 ***
Note You need to log in before you can comment on or make changes to this bug.