WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 171618
[Win][Meta] Build WebKit using Clang
https://bugs.webkit.org/show_bug.cgi?id=171618
Summary
[Win][Meta] Build WebKit using Clang
Don Olmstead
Reported
2017-05-03 14:14:28 PDT
Tracking bug for supporting Clang builds on Windows.
Attachments
WIP patch
(12.83 KB, patch)
2018-09-06 00:42 PDT
,
Fujii Hironori
no flags
Details
Formatted Diff
Diff
WIP patch
(14.29 KB, patch)
2018-09-06 02:40 PDT
,
Fujii Hironori
no flags
Details
Formatted Diff
Diff
WIP patch
(5.84 KB, patch)
2018-09-12 22:13 PDT
,
Fujii Hironori
no flags
Details
Formatted Diff
Diff
WIP Patch not to define WTF_COMPILER_MSVC
(8.87 KB, patch)
2018-09-17 23:41 PDT
,
Fujii Hironori
no flags
Details
Formatted Diff
Diff
WIP Patch to define WTF_COMPILER_MSVC
(2.81 KB, patch)
2018-09-17 23:42 PDT
,
Fujii Hironori
no flags
Details
Formatted Diff
Diff
"-T ClangCL" patch
(541 bytes, patch)
2023-09-26 00:30 PDT
,
Fujii Hironori
no flags
Details
Formatted Diff
Diff
Show Obsolete
(6)
View All
Add attachment
proposed patch, testcase, etc.
Fujii Hironori
Comment 1
2018-09-06 00:42:15 PDT
Created
attachment 349006
[details]
WIP patch
> perl Tools\Scripts\build-webkit --release --wincairo --ninja --cmakeargs="-DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl -DCMAKE_C_FLAGS=-m64 -DCMAKE_CXX_FLAGS=-m64"
Fujii Hironori
Comment 2
2018-09-06 02:40:12 PDT
Created
attachment 349010
[details]
WIP patch
Fujii Hironori
Comment 3
2018-09-06 23:26:37 PDT
I uploaded build logs showing all compilation errors.
https://gist.github.com/fujii/ea5a60634e44f9c2a84cf3d3de95e2ad
I'm using LLVM-8.0.0-
r339319
-win64.exe.
Fujii Hironori
Comment 4
2018-09-07 00:48:11 PDT
LLVM Project Blog: Clang is now used to build Chrome for Windows
http://blog.llvm.org/2018/03/clang-is-now-used-to-build-chrome-for.html
I believe this is the right direction WinCairo port should follow.
Fujii Hironori
Comment 5
2018-09-12 22:13:47 PDT
Created
attachment 349627
[details]
WIP patch Compiler macro definitions should be rethought. Current definitions: WTF_COMPILER_GCC_OR_CLANG 0 WTF_COMPILER_CLANG 1 WTF_COMPILER_MSVC 1 * It is weird WTF_COMPILER_GCC_OR_CLANG is off even though WTF_COMPILER_CLANG is on. * Should WTF_COMPILER_MSVC be on?
Fujii Hironori
Comment 6
2018-09-13 21:20:09 PDT
Here are the built-in macro definitions of Clang for Windows: _MSC_VER: 1914 __GNUC__ is not defined __clang__: 1 clang version 8.0.0 (trunk) Target: x86_64-pc-windows-msvc check program:
https://gist.github.com/fujii/4547bda099b3568f46ee164674b1f60d
Fujii Hironori
Comment 7
2018-09-17 20:08:29 PDT
Using clang-cl to ship Windows builds - Google Group
https://groups.google.com/forum/m/#!topic/mozilla.dev.platform/wwO48xXFx0A
1443590 - Use clang-cl for Windows builds we ship to users
https://bugzilla.mozilla.org/show_bug.cgi?id=1443590
glandium.org » Blog Archive » Firefox is now built with clang LTO on all* platforms
https://glandium.org/blog/?p=3888
Fujii Hironori
Comment 8
2018-09-17 23:41:40 PDT
Created
attachment 350006
[details]
WIP Patch not to define WTF_COMPILER_MSVC WTF_COMPILER_GCC_OR_CLANG 1 WTF_COMPILER_CLANG 1 WTF_COMPILER_MSVC 0
Fujii Hironori
Comment 9
2018-09-17 23:42:43 PDT
Created
attachment 350007
[details]
WIP Patch to define WTF_COMPILER_MSVC WTF_COMPILER_GCC_OR_CLANG 0 WTF_COMPILER_CLANG 1 WTF_COMPILER_MSVC 1
Fujii Hironori
Comment 10
2018-09-18 20:16:03 PDT
Comment on
attachment 350006
[details]
WIP Patch not to define WTF_COMPILER_MSVC It seems safer that Clang for Windows builds the same code path with MSVC in the transition phase.
Fujii Hironori
Comment 11
2018-09-25 03:02:06 PDT
WinCairo port can be built by Clang for Windows (with zillions of compilation warnings).
https://trac.webkit.org/r236450
I took benchmarks: ARES-6: MSVC: 37.24ms Clang: 35.85ms (faster) Speedometer: MSVC: 59.38 (faster) Clang: 56.9 (I needed some trial for Clang because Clang built executable is unstable and did finish the benchmark.) Build Time: Ninja+MSVC: 30min (much faster) Ninja+Clang+link.exe: 50min
Fujii Hironori
Comment 12
2018-09-25 03:03:17 PDT
(In reply to Fujii Hironori from
comment #11
)
> (I needed some trial for Clang because Clang built executable is unstable > and did finish the benchmark.)
did not finish
Fujii Hironori
Comment 13
2018-09-25 18:52:47 PDT
(In reply to Fujii Hironori from
comment #12
)
> (In reply to Fujii Hironori from
comment #11
) > > (I needed some trial for Clang because Clang built executable is unstable > > and did finish the benchmark.) > > did not finish
I was wrong. MSVC builds are also unstable for the benchmark. This is not Clang builds issue.
Fujii Hironori
Comment 14
2018-09-25 20:28:00 PDT
(In reply to Fujii Hironori from
comment #11
)
> Build Time: > > Ninja+MSVC: 30min (much faster) > Ninja+Clang+link.exe: 50min
This slowness is caused by the zillions of compilation warnings. If I apply the part of
Comment 8
patch to suppress the warning, the build time becomes comparable.
> ==================================================================== > WebKit is now built (32m:13s). > ====================================================================
Fujii Hironori
Comment 15
2018-09-25 20:34:13 PDT
How to: Debug an Executable Not Part of a Visual Studio Solution | Microsoft Docs
https://docs.microsoft.com/en-us/previous-versions/dotnet/netframework-3.0/0bxe8ytt(v=vs.85
)
Fujii Hironori
Comment 16
2018-10-23 02:44:48 PDT
* Set up
http://releases.llvm.org/download.html#7.0.0
LLVM-7.0.0-win64.exe Add path to clang-cl and ninja * Build set CC=clang-cl set CXX=clang-cl perl Tools\Scripts\build-webkit --release --wincairo --ninja * Remaining Tasks - Create a Docker image with clang-cl - Fix more compilation warnings
Fujii Hironori
Comment 17
2019-11-24 18:00:20 PST
This is a blocker for Clang 9.
Bug 201759
– [Win][Clang 9][MiniBrowser] comip.h(174,16): error: conflicting types for '_com_ptr_t' Keep you clang-cl 8.0.1 at the moment.
Fujii Hironori
Comment 18
2020-02-04 00:22:44 PST
New blocker:
Bug 204831
– [Win] lld-link: error: /manifestdependency: is not allowed in .drectve
Don Olmstead
Comment 19
2021-02-05 08:50:33 PST
Can we close this now?
Fujii Hironori
Comment 20
2021-02-05 13:18:46 PST
There are still remaining compilation warnings. And, I'm maintaining internal WinCairo clang-cl Jenkins jobs, but there is no public bots using clang-cl. So, I'm using this ticket to let anyone know the current status.
https://trac.webkit.org/wiki/BuildingCairoOnWindows#CompileWinCairowithClang
When will WinCairo bots switch to Clang? The MSVC lambda bug is annoying. (
Bug 209358
)
Fujii Hironori
Comment 21
2021-04-19 13:48:53 PDT
LLVM 12.0.0 was released. I upgraded it for all internal Jenkins workers.
Fujii Hironori
Comment 22
2021-11-03 13:55:09 PDT
I upgraded the internal Jenkins workers to Clang 13.0.0.
Fujii Hironori
Comment 23
2021-12-26 18:26:33 PST
The latest WinCairo can't compile with Clang.
Bug 234696
– [Clang][Win] NotificationData.h(47,5): error: reference to 'UUID' is ambiguous
Fujii Hironori
Comment 24
2023-04-17 18:19:48 PDT
Build time:
> perl .\Tools\Scripts\build-webkit --debug --skip-library-update --no-fatal-warnings
263045@main
MSVC: 22m:13s Clang: 25m:16s Size of WebKitBuild directory: $ du -hs WebKitBuild/Debug MSVC: 14G Clang: 7.5G
Ian Grunert
Comment 25
2023-07-22 19:20:14 PDT
This blocks FTL on windows (
bug 145366
) - the generated AirOpcodeGenerated.h contains code that builds on clang but warns on MSVC. Could fix the generator to stop spitting out switch statements with a default case and no case labels, but it might be easier to wait till the switch to clang happens?
Ian Grunert
Comment 26
2023-07-23 13:54:51 PDT
Went ahead and fixed those switch statements in
bug 259429
Fujii Hironori
Comment 27
2023-09-26 00:30:57 PDT
Created
attachment 467870
[details]
"-T ClangCL" patch It's possible to use CMake Visual Studio generator and clang-cl extension. However, there are two problems at the moment. 1. You have to apply a patch to set "-T ClangCL" CMake switch. 2. CMake Visual Studio generator ignores some compiler warning disabling switches like /wd4100. It reports compiler warnings. You have to give --no-fatal-warnings switches. How to build WebKit Windows port with Visual Studio and clang-cl 1. Install LLVM extension.
https://learn.microsoft.com/en-us/cpp/build/clang-support-msbuild
2. Apply the "-T ClangCL" patch 3. Invoke "perl .\Tools\Scripts\build-webkit --no-ninja --no-fatal-warnings" in WebKit command prompt. Or, you can open the solution file: 3. Invoke "perl .\Tools\Scripts\build-webkit --no-ninja --no-fatal-warnings --generate-project-only" in WebKit command prompt. 4. Invoke "devenv WebKitBuild\Release\WebKit.sln" in WebKit command prompt.
Fujii Hironori
Comment 28
2023-09-26 13:15:07 PDT
We don't need the patch.
> perl .\Tools\Scripts\build-webkit --debug --no-fatal-warnings --no-ninja --cmakeargs="-T ClangCL"
Fujii Hironori
Comment 29
2023-10-03 18:59:56 PDT
The build instruction has been updated.
https://github.com/WebKit/Documentation/commit/739ce4449adb3de8e272a4221b67468b404644e2
No remaining tasks. Closed.
Radar WebKit Bug Importer
Comment 30
2023-10-03 19:00:29 PDT
<
rdar://problem/116439320
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug