|
| 1 | +# QtWebEngine Build Guide for Windows |
| 2 | + |
| 3 | +This guide provides step-by-step instructions for building QtWebEngine on Windows, following the [official Qt documentation](https://wiki.qt.io/QtWebEngine/Qt6Build). |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +### Required Software |
| 8 | +1. **Qt 6.8.3** |
| 9 | +2. **Visual Studio Community 2022** |
| 10 | +3. **Node.js** |
| 11 | +4. **Python 3** with html5lib |
| 12 | +5. **Gperf** (install via Chocolatey) |
| 13 | + ```powershell |
| 14 | + choco install gperf |
| 15 | + ``` |
| 16 | +6. **Win Flex-Bison** |
| 17 | + - Download from [SourceForge](https://sourceforge.net/projects/winflexbison/) |
| 18 | + - Copy to Program Files |
| 19 | + - Add to system PATH |
| 20 | +7. **Bison** |
| 21 | + - Download from [SourceForge](https://sourceforge.net/projects/gnuwin32/) |
| 22 | + - Add to system PATH |
| 23 | +8. **Perl** [Strawberry](https://strawberryperl.com/) (required for compiling opus without optimizations) |
| 24 | + |
| 25 | +## Build Instructions |
| 26 | + |
| 27 | +### 1. Clone Repository |
| 28 | +```powershell |
| 29 | +mkdir qt6 |
| 30 | +cd qt6 |
| 31 | +git clone git://code.qt.io/qt/qtwebengine.git |
| 32 | +cd qtwebengine |
| 33 | +``` |
| 34 | + |
| 35 | +### 2. Initialize Submodules |
| 36 | +```powershell |
| 37 | +git submodule init |
| 38 | +git submodule update |
| 39 | +git checkout origin/6.8.3 |
| 40 | +git submodule update |
| 41 | +``` |
| 42 | + |
| 43 | +### 3. Create Build Directory |
| 44 | +```powershell |
| 45 | +mkdir build |
| 46 | +cd build |
| 47 | +``` |
| 48 | + |
| 49 | +### 4. Configure Environment |
| 50 | +Open a new Command Prompt (cmd) and set the following environment variables. Adjust paths and versions according to your system: |
| 51 | + |
| 52 | +```batch |
| 53 | +set QT_PATH=C:\Qt\6.8.3 |
| 54 | +set PYTHONPATH=C:\Users\Administrator\AppData\Local\Programs\Python\Python313\ |
| 55 | +set VC_EDITION=Community |
| 56 | +set MSVC_VER=14.44.35207 |
| 57 | +set MSVC_MAJOR_VER=2022 |
| 58 | +set PROGRAM_FILES=Program Files |
| 59 | +
|
| 60 | +set VC_DIR=C:\%PROGRAM_FILES%\Microsoft Visual Studio\%MSVC_MAJOR_VER%\%VC_EDITION%\VC |
| 61 | +
|
| 62 | +rem Setup VCVars Build |
| 63 | +SET PATH=%PYTHONPATH%;%QT_PATH%\Src\qtbase\bin;C:\Qt\Tools\Ninja;%PATH%; |
| 64 | +
|
| 65 | +rem Initialize Qt Environment |
| 66 | +"%QT_PATH%/msvc%MSVC_MAJOR_VER%_64/bin/qtenv2.bat" |
| 67 | +
|
| 68 | +rem Initialize Visual Studio Environment |
| 69 | +"%VC_DIR%\Auxiliary\Build\vcvarsall.bat" x64 |
| 70 | +``` |
| 71 | + |
| 72 | +### 5. Build QtWebEngine |
| 73 | +```batch |
| 74 | +cd build |
| 75 | +qt-configure-module . -webengine-proprietary-codecs -webengine-pepper-plugins -webengine-printing-and-pdf -webengine-spellchecker |
| 76 | +cmake --build . --parallel --clean-first |
| 77 | +cmake --install . |
| 78 | +cmake --install . --config debug |
| 79 | +``` |
| 80 | + |
| 81 | +## Troubleshooting |
| 82 | + |
| 83 | +### Common Error: Non-static Member Function Call |
| 84 | +If you encounter the error: |
| 85 | +``` |
| 86 | +error C2352: 'cppgc::internal::MarkingStateBase::MarkNoPush': a call of a non-static member function requires an object |
| 87 | +``` |
| 88 | + |
| 89 | +#### Solution 1: Using Compiler Flag |
| 90 | +```batch |
| 91 | +qt-configure-module . -webengine-proprietary-codecs -webengine-pepper-plugins -webengine-printing-and-pdf -webengine-spellchecker -- -DCMAKE_CXX_FLAGS="/D_ALLOW_QUALIFIED_MEMBER_ACCESS=1" |
| 92 | +``` |
| 93 | + |
| 94 | +#### Solution 2: Using Patch |
| 95 | +1. Create patches directory: |
| 96 | + ```batch |
| 97 | + mkdir patches |
| 98 | + ``` |
| 99 | + |
| 100 | +2. Create patch file `marking-state.patch`: |
| 101 | + ```diff |
| 102 | + diff --git a/src/3rdparty/chromium/v8/src/heap/cppgc/marking-state.h b/src/3rdparty/chromium/v8/src/heap/cppgc/marking-state.h |
| 103 | + --- a/src/3rdparty/chromium/v8/src/heap/cppgc/marking-state.h |
| 104 | + +++ b/src/3rdparty/chromium/v8/src/heap/cppgc/marking-state.h |
| 105 | + @@ -361,1 +361,1 @@ |
| 106 | + - return MutatorMarkingState::BasicMarkingState::MarkNoPush(header); |
| 107 | + + return this->BasicMarkingState::MarkNoPush(header); |
| 108 | + ``` |
| 109 | + |
| 110 | +3. Apply the patch: |
| 111 | + ```batch |
| 112 | + git apply patches/marking-state.patch |
| 113 | + ``` |
0 commit comments