Building Installation Package for ARM64 on x64
-
Hi,
I have an existing setup to build a repo based on an application binary for x64, the native architecture on my Windows machine, but now I need to build for a Microsoft Surface that uses ARM64. When I went to set that up, I discovered there is no windeployqt.exe equivalent for the msvc2022_arm64 platform. Is that intentional? Is it missing, and I need to download it manually somehow? I installed msvc2022_arm64 and there just seems to be missing tools in the bin folder. Any advice would be appreciated.
-
I have been looking for the same thing, but unfortunately the Qt Company does not seem to offer a documentation on the subject just yet. I had to go through the Qt's source codes, but finally found a solution:
Assuming your host OS is Windows x86_64 and you want to compile Windows arm64 packages for your project.
- Install both versions (arm64, x86_64) of Qt and MSVC (make sure you select arm64 packages when you are installing MSVC on Visual Studio Installer; not arm).
- Compile your project with the following commands (on cmd.exe):
cd your_project_folder call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsamd64_arm64.bat" C:\Qt\6.8.0\msvc2022_arm64\bin\qt-cmake.bat -S . -B build-arm64 -G Ninja -DQT_HOST_PATH=C:\Qt\6.8.0\msvc2022_64 -DCMAKE_BUILD_TYPE=Release cmake --build build-arm64 --parallel --config Release
Assuming you are using Ninja as the generator (but you can remove
-G Ninja
if you don't) - Deploy your project with
windeployqt
by passing--qtpaths
option like below (on cmd.exe):C:\Qt\6.8.0\msvc2022_64\bin\windeployqt.exe --qtpaths "C:\Qt\6.8.0\msvc2022_arm64\bin\qtpaths.bat" ...
So we are using
windeployqt.exe
from themsvc2022_64
setup, but letting it use themsvc2022_arm64
setup while deploying the dependencies by passing the--qtpaths
argument.I have built my project with that but was not able to test it on an arm64 machine yet, so please let us know if it works.
Edit 1: Apparently this requires that your Qt installation do reside in
C:\Qt
path. If your Qt installation path is different than that, you may try to circumvent this problem by editing out the paths listed in...msvc2022_arm64\bin\target_qt.conf
file.Edit 2: There seems to be a bug in the Qt 6.8.0
win64_msvc2022_arm64_cross_compiled
setup (i.e., I realized it when I installed it via the aqtinstall tool on my CI machine; but there was no such bug when I installed the same Qt setup to my personal computer using official Qt installation tool a few days back.) Make sure the path to your x64 setup inside theC:\Qt\6.8.0\msvc2022_arm64\bin\qtpaths.bat
file is correct (edit the bat file if it contains the wrong path due to the bug I just mentioned).Hope it helps.