[MDEV-25870] Windows - Fix cross-compilation for ARM64 Created: 2021-06-07  Updated: 2023-09-24  Resolved: 2021-06-07

Status: Closed
Project: MariaDB Server
Component/s: Compiling, Packaging, Platform Windows
Affects Version/s: 10.2, 10.3, 10.4, 10.5, 10.6
Fix Version/s: 10.6.2

Type: Bug Priority: Major
Reporter: Vladislav Vaintroub Assignee: Vladislav Vaintroub
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Duplicate
is duplicated by MDEV-32149 cross-compiling on Windows x64 for ar... Closed

 Description   

Visual Studio 2019 includes ARM64 cross-compiler.
While our CI is not capable of running any tests on it, we can clean up code to remove the
hardcoded assumption that Windows equates Intel, perhaps such a cleanup could be useful in the future, when AMD64 ecosystem evolves

The cross-compilation works like this

patch wolfssl

Fix wolfssl - apply that patch
https://github.com/vaintroub/wolfssl/commit/29968716ea050fd905be55cec7e290a674fd075d

Hopefully it will be fixed soon in wolfssl proper.

build tools used during cross-compilation - comp_err, gen_lex_hash

cd sourcedir
mkdir x64
cd x64
cmake ..
cmake --build . --target import_executables --config relwithdebinfo

build ARM64, crosscompilation

cd sourcedir
mkdir arm64
cd arm64
cmake .. -A ARM64 -DCMAKE_SYSTEM_NAME=Windows -DIMPORT_EXECUTABLES=C:/path/to/sourcedir/x64/import_executables.cmake
cmake --build . --config relwithdebinfo
# packaging, as usual
cmake --build . --config relwithdebinfo --target win_package
cmake --build . --config relwithdebinfo --target MSI

Note , that setting -DCMAKE_SYSTEM_NAME is how CMake known that we're crosscompiling
-DIMPORT_EXECUTABLES=C:/path/to/sourcedir/x64/import_executables.cmake lets the native (x64) auxiliary executables run during build process, and -A ARM64 is CMake-ish way to chose the ARM64 cross-compiler.

To build MSI, WIX toolset version 3.14 is necessary, which is still under development, but betas are available. No other WIX version can handle ARM64 yet.


Generated at Thu Feb 08 09:41:01 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.