movableink / webkit

Unofficial mirror of the WebKit SVN repository
http://www.webkit.org/
59 stars 11 forks source link

Strange ZLIB errors - WebCore does not compile anymore #34

Open quarcko opened 6 months ago

quarcko commented 6 months ago

Strange thing happened, when i first built webkit with MINGW untill the very end, there were no such errors, i swear :laughing: but while fixing JS assembly, and finally got back here to recompile WebCore, this happened:

In file included from C:/Qt/Qt6.5.3/6.5.3/mingw_64/include/QtZlib/zlib.h:34,
                 from C:/Qt/webkit/Source/WebCore/Modules/compression/CompressionStreamEncoder.h:34,
                 from C:/Qt/webkit/build-win/WebCore/DerivedSources/JSCompressionStreamEncoder.h:23,
                 from C:/Qt/webkit/build-win/WebCore/DerivedSources/JSLocalDOMWindow.cpp:125,
                 from C:\Qt\webkit\build-win\WebCore\DerivedSources\unified-sources\UnifiedSource-3a52ce78-88.cpp:7:
C:/Qt/webkit/Source/WebCore/layout/formattingContexts/inline/InlineRect.h: In member function 'void WebCore::Layout::InlineRect::z_inflate(WebCore::Layout::InlineLayoutUnit)':
C:/Qt/webkit/Source/WebCore/layout/formattingContexts/inline/InlineRect.h:326:12: error: 'using InlineLayoutRect = class WebCore::FloatRect' {aka 'class WebCore::FloatRect'} has no memb
er named 'z_inflate'; did you mean 'inflate'?
  326 |     m_rect.inflate(inflate);

AND

In file included from C:/Qt/Qt6.5.3/6.5.3/mingw_64/include/QtZlib/zlib.h:34,
                 from C:/Qt/webkit/Source/WebCore/Modules/websockets/WebSocketDeflater.cpp:38,
                 from C:\Qt\webkit\build-win\WebCore\DerivedSources\unified-sources\UnifiedSource-f8afad56-57.cpp:3:
C:/Qt/webkit/Source/WebCore/Modules/websockets/WebSocketFrame.cpp: In static member function 'static WebCore::WebSocketFrame::ParseFrameResult WebCore::WebSocketFrame::parseFrame(uint8_
t*, size_t, WebCore::WebSocketFrame&, const uint8_t*&, WTF::String&)':
C:/Qt/webkit/Source/WebCore/Modules/websockets/WebSocketFrame.cpp:114:11: error: 'struct WebCore::WebSocketFrame' has no member named 'z_compress'; did you mean 'compress'?
  114 |     frame.compress = compress;
      |           ^~~~~~~~
C:/Qt/webkit/Source/WebCore/Modules/websockets/WebSocketFrame.cpp: In constructor 'WebCore::WebSocketFrame::WebSocketFrame(WebCore::WebSocketFrame::OpCode, bool, bool, bool, const uint8
_t*, size_t)':
C:/Qt/webkit/Source/WebCore/Modules/websockets/WebSocketFrame.cpp:175:7: error: class 'WebCore::WebSocketFrame' does not have any field named 'z_compress'
  175 |     , compress(compress)

It looks like zlib.h has some #defines that override inflate and compress keywords, but why the hell zlib is included here? How this "derived-sources" mechanism work?

lets say this file, where the macro expands and messes up: C:/Qt/webkit/Source/WebCore/layout/formattingContexts/inline/InlineRect.h

has no references to anything in: C:\Qt\webkit\build-win\WebCore\DerivedSources\unified-sources\UnifiedSource-3a52ce78-88.cpp

and this unified-sources has no mention of "InlineRect.h"?

so how "InlineRect.h" is able to find "zlib.h"?

quarcko commented 6 months ago

OK, so the actual problem was tha CMAKE for some reason included ZLIB from QT: C:/Qt/Qt6.5.3/6.5.3/mingw_64/include/QtZlib/zlib.h

temporarily i just rename 'QtZlib' directory and compilation goes happily further. But thats not solution

HELP: How to tell CMAKE not to search for QtZlib?

aquiles2k commented 6 months ago

I had something loosely similar with my issue with macro WTF_MAKE_FAST_ALLOCATED which needed me to add include for wtf/FastMalloc.h I have no clue how this worked in normal WebKit without the include.

Anyway, doesn't qt config has a option for zlib handling? like -qt-zlib or -system-zlib

See https://doc.qt.io/qt-6/configure-options.html

aquiles2k commented 6 months ago

And in cmake, can't you just redefine the variables like ZLIB_INCLUDE_DIR / ZLIB_LIBRARY_RELEASE? Search the CMakeCache.txt for actual names.

quarcko commented 6 months ago

Yes, i have these variables set, that's why compilation goes OK if i rename QtZlib dir. The problem is that cmake from somewhere added one more variable:

Qt6ZlibPrivate_DIR C:/Qt/Qt6.5.3/6.5.3/mingw_64/lib/cmake/Qt6ZlibPrivate

and it gets priority as i understant from where #include is taken..

probably my pre-compiled QT 6.5.3 is configured wit -qt-zlib but is it possible to override this just for WebKit compilation?

quarcko commented 6 months ago

QT6-WEBKIT-MINGW

quarcko commented 6 months ago

Yeah, but it freezes... If i disable JavaScript - then it loads this landing page OK, but freezes on search tried other websites - some of them load without fonts, some of them also crash. JavaScript mouse tester actually loaded and worked all right..

so all in all, don't know what to do next, does not feel very usable atm.

quarcko commented 6 months ago

Hmm, it seems that it has something to do with this message right before the freeze:

warning: LauncherApplication::exec: Must be called from the main thread