Bug 248803 - [WinCairo] Build error with CMAKE_DISABLE_PRECOMPILE_HEADERS ON after 257057@main
Summary: [WinCairo] Build error with CMAKE_DISABLE_PRECOMPILE_HEADERS ON after 257057@...
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Diego Pino
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-12-05 18:43 PST by Diego Pino
Modified: 2023-04-12 19:01 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Diego Pino 2022-12-05 18:43:01 PST
When building WinCairo if I manually set CMAKE_DISABLE_PRECOMPILE_HEADERS ON I get the following build error:

```
platform\win\LocalizedStringsWin.cpp.obj /FdSource\WebCore\WebCore.pdb /FS -c C:\Users\86185\workspace\webkit\Source\WebCore\platform\win\LocalizedStringsWin.cpp
C:\Users\86185\workspace\webkit\Source\WebCore\platform\LocalizedStrings.h(429): error C2065: 'CFStringRef': undeclared identifier
C:\Users\86185\workspace\webkit\Source\WebCore\platform\LocalizedStrings.h(429): error C2923: 'WTF::RetainPtr': 'CFStringRef' is not a valid template type argument for parameter '<unnamed-symbol>'
C:\Users\86185\workspace\webkit\Source\WebCore\platform\LocalizedStrings.h(429): note: see declaration of 'CFStringRef'
C:\Users\86185\workspace\webkit\Source\WebCore\platform\LocalizedStrings.h(429): error C2065: 'CFStringRef': undeclared identifier
C:\Users\86185\workspace\webkit\Source\WebCore\platform\LocalizedStrings.h(429): error C2146: syntax error: missing ')' before identifier 'key'
[2737/6180] Building CXX object Source\WebCore\CMakeFiles\WebCore.dir\platform\graphics\FormatConverter.cpp.obj
ninja: build stopped: subcommand failed.
```

Shouldn't still be possible to build WinCairo with CMAKE_DISABLE_PRECOMPILE_HEADERS ON?
Comment 1 Fujii Hironori 2022-12-05 19:39:44 PST
Feel free to propose a patch to fix the problem if you want.
BTW, why do you want to disable pch?
Comment 2 Diego Pino 2022-12-05 22:45:47 PST
Pull request: https://github.com/webkit/webkit/pull/7185
Comment 3 Diego Pino 2022-12-06 00:01:00 PST
(In reply to Fujii Hironori from comment #1)
> Feel free to propose a patch to fix the problem if you want.
> BTW, why do you want to disable pch?

Since this change Playwright's Windows build stopped working. Build error is:

```
57><PROGRAMFILES>\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.33.31629\include\xpolymorphic_allocator.h(204,74): error C2059: syntax error: '(' (compiling source file C:\Users\<USERNAME>\webkit\Source\ThirdParty\libwebrtc\Source\third_party\libwebm\mkvmuxer\mkv
57><PROGRAMFILES>\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.33.31629\include\xpolymorphic_allocator.h(287): message : see reference to class template instantiation 'std::pmr::polymorphic_allocator<_Ty>' being compiled (compiling source file C:\Users\<USERNAME
57>mkvmuxerutil.cc
57><PROGRAMFILES>\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.33.31629\include\xpolymorphic_allocator.h(204,1): error C2238: unexpected token(s) preceding ';' (compiling source file C:\Users\<USERNAME>\webkit\Source\ThirdParty\libwebrtc\Source\third_party\libwe
57><PROGRAMFILES>\Microsoft Visual Studio\2022\Enterprise\VC\Tools\MSVC\14.33.31629\include\list(294,37): error C2059: syntax error: '(' (compiling source file C:\Users\<USERNAME>\webkit\Source\ThirdParty\libwebrtc\Source\third_party\libwebm\mkvmuxer\mkvmuxer.cc)
```

This build error is related to downstream changes in Playwright.

To work around this build error I'm trying to disable precompile headers, hoping it will work like it was before this change. That's when I realized disabling precompile headers for Windows is failing upstream. I'm still experimenting, I don't know if managing to build with CMAKE_DISABLE_PRECOMPILE_HEADERS ON will solve the downstream build error.

Still my gut feeling tells me a platform should build regardless this option is enabled or disabled. Maybe I'm ignoring something, idk.
Comment 4 Max Schmitt 2023-01-25 06:03:20 PST
Pull request: https://github.com/WebKit/WebKit/pull/9107
Comment 5 Fujii Hironori 2023-01-25 12:09:06 PST
I prefer Diego's approach fixing CMAKE_DISABLE_PRECOMPILE_HEADERS problems. Does it fail?
Comment 6 Yury Semikhatsky 2023-03-20 14:22:07 PDT
This was fixed on our end downstream. After 257057@main every c++ file in WebKit target is forced to include WebKit2Prefix.h which overrides new and delete definitions. Normally, in WebKit those overrides are removed by config.h which is included in the very top of every *.cpp file. But in our downstream port we cut some corners and included files from Source/ThirdParty, they don't have such include and new/delete were still overridden so the compiler complained about new/delete not being defined with an obscure message.
Comment 7 Diego Pino 2023-04-12 19:01:31 PDT
WinCairo build works now fine when building with `CMAKE_DISABLE_PRECOMPILE_HEADERS ON`.