Skip to content

Commit fd9c2e4

Browse files
committed
Initial commit
0 parents  commit fd9c2e4

File tree

1 file changed

+228
-0
lines changed

1 file changed

+228
-0
lines changed

README.md

Lines changed: 228 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,228 @@
1+
# Building QtWebEngine/QtPdf for Windows ARM64
2+
3+
This guide provides comprehensive instructions for building QtWebEngine and QtPdf for Windows ARM64 architecture. As of the current Qt releases, official ARM64 binaries for QtWebEngine are not available, making this build process necessary for ARM64 development.
4+
5+
## Prerequisites
6+
7+
### System Requirements
8+
- Windows 10/11 x64 system for cross-compilation
9+
- Visual Studio 2022 with MSVC toolchain
10+
- At least 16GB RAM (32GB recommended)
11+
- 50GB+ free disk space
12+
- Git for version control
13+
14+
### Required Visual Studio Components
15+
Ensure you have the following Visual Studio 2022 components installed:
16+
- **MSVC v143 - VS 2022 C++ x64/x86 build tools**
17+
- **MSVC v143 - VS 2022 C++ ARM64 build tools**
18+
- **Windows 11 SDK** (latest version)
19+
- **CMake tools for Visual Studio**
20+
- **Git for Windows**
21+
- **MSVC v143 - VS 2022 C++ ATL for latest v143 build tools (x86 & x64)**
22+
- **MSVC v143 - VS 2022 C++ ATL for latest v143 build tools (ARM64)**
23+
24+
## Step 1: Install Qt 6 for x64 (Host) and ARM64 (Target)
25+
26+
### Option 1: Using aqt (Recommended)
27+
28+
First, install the Python package manager and aqt:
29+
```bash
30+
pip install aqtinstall
31+
```
32+
33+
Install Qt 6 for Windows x64 (host compiler):
34+
```bash
35+
aqt install-qt --outputdir C:\Qt windows desktop 6.9.0 win64_msvc2022_64
36+
```
37+
38+
Install Qt 6 for Windows ARM64 (target compiler):
39+
```bash
40+
aqt install-qt --outputdir C:\Qt windows desktop 6.9.0 win64_msvc2022_arm64
41+
```
42+
43+
### Option 2: Qt Online Installer
44+
45+
1. Download the Qt Online Installer from [qt.io](https://www.qt.io/download)
46+
2. Install Qt 6.9.0 with the following components:
47+
- **MSVC 2022 64-bit** (host)
48+
- **MSVC 2022 ARM64** (target)
49+
50+
## Step 2: Clone and Prepare QtWebEngine Source
51+
52+
Open **x64 Native Tools Command Prompt for VS 2022** and execute:
53+
54+
```bash
55+
# Navigate to your desired build location
56+
cd C:\
57+
58+
# Clone the QtWebEngine repository
59+
git clone https://code.qt.io/qt/qtwebengine.git
60+
cd qtwebengine
61+
62+
# Checkout the desired version (match your Qt version)
63+
git checkout 6.9.0
64+
65+
# Initialize and update all submodules (this will take time)
66+
git submodule update --init --recursive
67+
68+
# Return to the root directory
69+
cd ..
70+
```
71+
72+
## Step 3: Build GN (Google's Build System) for Cross-Compilation
73+
74+
GN must be built first as a native x64 binary before cross-compiling QtWebEngine.
75+
76+
```bash
77+
# Create build directory
78+
mkdir build-qtwebengine-arm64
79+
cd build-qtwebengine-arm64
80+
81+
# Configure to build only GN initially
82+
C:\Qt\6.9.0\msvc2022_64\bin\qt-configure-module.bat ..\qtwebengine -- -DBUILD_ONLY_GN=ON
83+
84+
# Build GN (may fail on first attempt - this is normal)
85+
cmake --build . --parallel
86+
87+
# Build again (should succeed on second attempt)
88+
cmake --build . --parallel
89+
```
90+
91+
> **Note**: The GN build often fails on the first attempt due to dependency resolution. Running the build command twice typically resolves this issue.
92+
93+
## Step 4: Cross-Compile QtWebEngine/QtPdf for ARM64
94+
95+
### Open Cross-Compilation Environment
96+
97+
You need to switch to the ARM64 cross-compilation environment. Do one of the following:
98+
99+
**Option A**: Run the batch file directly:
100+
```bash
101+
"C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsamd64_arm64.bat"
102+
```
103+
104+
**Option B**: Open "**x64_arm64 Cross Tools Command Prompt for VS 2022**" from the Start Menu
105+
106+
### Configure and Build
107+
108+
Navigate back to your build directory and configure for ARM64:
109+
110+
```bash
111+
cd C:\build-qtwebengine-arm64
112+
113+
# Configure for ARM64 cross-compilation
114+
C:\Qt\6.9.0\msvc2022_arm64\bin\qt-configure-module.bat ..\qtwebengine -- -DQT_HOST_PATH=C:\Qt\6.9.0\msvc2022_64 -DFEATURE_webengine_build=OFF
115+
```
116+
117+
### Build Options
118+
119+
Choose one of the following based on your needs:
120+
121+
**To build only QtPdf** (faster, recommended for most users):
122+
```bash
123+
C:\Qt\6.9.0\msvc2022_arm64\bin\qt-configure-module.bat ..\qtwebengine -- -DQT_HOST_PATH=C:\Qt\6.9.0\msvc2022_64 -DFEATURE_webengine_build=OFF
124+
```
125+
126+
**To build both QtPdf and QtWebEngine** (slower, complete build):
127+
```bash
128+
C:\Qt\6.9.0\msvc2022_arm64\bin\qt-configure-module.bat ..\qtwebengine -- -DQT_HOST_PATH=C:\Qt\6.9.0\msvc2022_64 -DFEATURE_webengine_build=ON
129+
```
130+
131+
### Start the Build Process
132+
133+
```bash
134+
# Begin the build (this will take several hours)
135+
cmake --build . --parallel
136+
```
137+
138+
## Step 5: Install QtWebEngine/QtPdf
139+
140+
After the build is complete, you need to install the libraries. It's recommended to install to a separate directory to avoid conflicts with your native Qt installation.
141+
142+
### Install to a Custom Directory (Recommended)
143+
144+
```bash
145+
# Install to a separate ARM64-specific directory
146+
cmake --install . --prefix C:\Qt-arm64
147+
148+
# Alternative: Install to a versioned directory
149+
cmake --install . --prefix C:\Qt\6.9.0-arm64
150+
```
151+
152+
### Create a Redistributable Archive
153+
154+
After installation, you can create a ZIP archive for easy distribution:
155+
156+
```bash
157+
# Navigate to the installation directory
158+
cd C:\Qt-arm64
159+
160+
# Create a ZIP archive (requires 7-zip or similar)
161+
# Using PowerShell:
162+
Compress-Archive -Path ".\*" -DestinationPath "C:\QtWebEngine-6.9.0-ARM64.zip"
163+
164+
# Or using 7-zip (if installed):
165+
7z a "C:\QtWebEngine-6.9.0-ARM64.zip" "C:\Qt-arm64\*"
166+
```
167+
168+
## Build Time Expectations
169+
170+
- **QtPdf only**: 30-60 minutes (depending on hardware)
171+
- **QtPdf + QtWebEngine**: 2-6 hours (depending on hardware)
172+
173+
## Troubleshooting
174+
175+
### Common Issues
176+
177+
1. **GN Build Fails**
178+
- Solution: Run the build command twice as shown in Step 3
179+
180+
2. **Out of Memory Errors**
181+
- Reduce parallel jobs: `cmake --build . --parallel 4`
182+
- Ensure you have adequate RAM and virtual memory
183+
184+
3. **Missing Dependencies**
185+
- Verify all Visual Studio components are installed
186+
- Check that both x64 and ARM64 MSVC toolchains are available
187+
188+
4. **Git Submodule Issues**
189+
- Run: `git submodule update --init --recursive --force`
190+
191+
### Verification
192+
193+
After a successful build and installation, you should find the ARM64 libraries in:
194+
- `C:\Qt-arm64\lib\` (if using custom installation directory)
195+
- `C:\Qt\6.9.0\msvc2022_arm64\lib\` (if installed to existing Qt directory)
196+
- Or in your build directory under appropriate subdirectories (before installation)
197+
198+
Key files to look for:
199+
- `Qt6WebEngine.dll` and `Qt6WebEngine.lib` (if building full QtWebEngine)
200+
- `Qt6Pdf.dll` and `Qt6Pdf.lib` (QtPdf libraries)
201+
- `Qt6WebEngineCore.dll` (core WebEngine components)
202+
203+
## Usage
204+
205+
Once built and installed, you can use QtWebEngine/QtPdf in your ARM64 applications by:
206+
207+
1. **Setting your Qt installation path**: Point your development environment to the ARM64 installation directory (e.g., `C:\Qt-arm64`)
208+
2. **Configuring your project**: Set your project to target ARM64 architecture
209+
3. **Linking against the libraries**: Link against the newly built QtWebEngine/QtPdf libraries
210+
4. **Deploying**: Include the ARM64 DLLs with your application distribution
211+
212+
### Using the Custom Installation
213+
214+
If you installed to `C:\Qt-arm64`, you can:
215+
- Set `CMAKE_PREFIX_PATH` to `C:\Qt-arm64` in your CMake projects
216+
- Or set `QTDIR` environment variable to `C:\Qt-arm64`
217+
- Add `C:\Qt-arm64\bin` to your PATH for runtime DLL discovery
218+
219+
## Additional Notes
220+
221+
- This process requires significant disk space and time
222+
- Building on a machine with SSD storage will significantly improve build times
223+
- Consider using a dedicated build machine or VM with ample resources
224+
- Keep your Qt version, Visual Studio, and Windows SDK up to date for best compatibility
225+
226+
## Contributing
227+
228+
If you encounter issues or have improvements to this guide, please feel free to submit issues or pull requests.

0 commit comments

Comments
 (0)