Skip to content

Commit ebf6b75

Browse files
Merge pull request #152 from operepo/qt_6.8.3_build_and_deploy_info
added instruction to qtwebenginer 6.8.3 and windows deployment script…
2 parents f2c35d1 + eff03f4 commit ebf6b75

2 files changed

Lines changed: 180 additions & 0 deletions

File tree

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
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+
```
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
@echo off
2+
setlocal EnableDelayedExpansion
3+
4+
:: Qt and Visual Studio settings
5+
set QT_VER=6.8.3
6+
set QT_VER_FOLDER=6_8_3
7+
set QT_PATH=C:\Qt\%QT_VER%
8+
set VC_EDITION=Community
9+
set MSVC_VER=14.44.35207
10+
set MSVC_MAJOR_VER=2022
11+
set PROGRAM_FILES=Program Files
12+
13+
:: Get project root dynamically using git
14+
for /f %%i in ('git rev-parse --show-toplevel') do set PROJECT_ROOT=%%i
15+
if errorlevel 1 (
16+
:: Fallback to script location if not in git repo
17+
set PROJECT_ROOT=%~dp0..
18+
)
19+
20+
:: Set build type from argument or default to both
21+
set BUILD_TYPE=%1
22+
if "%BUILD_TYPE%"=="" set BUILD_TYPE=both
23+
if not "%BUILD_TYPE%"=="debug" if not "%BUILD_TYPE%"=="release" if not "%BUILD_TYPE%"=="both" (
24+
echo Invalid build type. Use: debug, release, or both
25+
exit /b 1
26+
)
27+
28+
:: Setup paths
29+
set MSVC_BINARIES=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Redist\MSVC\%MSVC_VER%\x64\Microsoft.VC143.CRT
30+
set CODE_ROOT=%PROJECT_ROOT%\client_tools\lms\src\OPE_LMS
31+
set RELEASE_BUILD_DIR=%CODE_ROOT%\build\Desktop_Qt_%QT_VER_FOLDER%_MSVC%MSVC_MAJOR_VER%_64bit-Release\release
32+
set DEBUG_BUILD_DIR=%CODE_ROOT%\build\Desktop_Qt_%QT_VER_FOLDER%_MSVC%MSVC_MAJOR_VER%_64bit-Debug\debug
33+
34+
:: Setup Qt environment if not already done
35+
if "%QT_ENV_SETUP%" NEQ "1" (
36+
call "%QT_PATH%/msvc%MSVC_MAJOR_VER%_64/bin/qtenv2.bat"
37+
call "C:\%PROGRAM_FILES%\Microsoft Visual Studio\%MSVC_MAJOR_VER%\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
38+
set QT_ENV_SETUP=1
39+
)
40+
41+
echo Building... [%BUILD_TYPE% mode]
42+
43+
:: Deploy for Release
44+
if "%BUILD_TYPE%"=="release" goto :release
45+
if "%BUILD_TYPE%"=="both" goto :release
46+
goto :debug_check
47+
48+
:release
49+
echo Deploying Release build...
50+
%QT_PATH%\msvc%MSVC_MAJOR_VER%_64\bin\windeployqt.exe %TRANSLATIONS% --force --compiler-runtime --qmldir "%CODE_ROOT%" --libdir "%RELEASE_BUILD_DIR%" --dir "%RELEASE_BUILD_DIR%" --plugindir "%RELEASE_BUILD_DIR%\plugins" "%RELEASE_BUILD_DIR%\OPE_LMS.exe"
51+
echo "Copying MSVC Binaries to %RELEASE_BUILD_DIR%"
52+
xcopy /Y "%MSVC_BINARIES%\*" "%RELEASE_BUILD_DIR%"
53+
54+
:debug_check
55+
if "%BUILD_TYPE%"=="debug" goto :debug
56+
if "%BUILD_TYPE%"=="both" goto :debug
57+
goto :end
58+
59+
:debug
60+
echo Deploying Debug build...
61+
%QT_PATH%\msvc%MSVC_MAJOR_VER%_64\bin\windeployqt.exe %TRANSLATIONS% --force --compiler-runtime --qmldir "%CODE_ROOT%" --libdir "%DEBUG_BUILD_DIR%" --dir "%DEBUG_BUILD_DIR%" --plugindir "%DEBUG_BUILD_DIR%\plugins" "%DEBUG_BUILD_DIR%\OPE_LMS.exe"
62+
echo "Copying MSVC Binaries to %DEBUG_BUILD_DIR%"
63+
xcopy /Y "%MSVC_BINARIES%\*" "%DEBUG_BUILD_DIR%"
64+
65+
:end
66+
echo Done Building!
67+
endlocal

0 commit comments

Comments
 (0)