Skip to content

Conversation

anthony-linaro
Copy link

This pull request adds initial support for Windows on ARM platforms, using MSVC (only MSVC, no clang support currently).

For this initial effort, due to the fact that programs are run at build time (generators, etc), it can only be compiled on an ARM64 host, there is no cross-compiling available.

This was tested against Windows SDK version 22000, running on Windows 11. Some tests appear to be intermittent.

To compile, the latest preview of Visual Studio 2022 17.3 must be used, at time of submission this is Preview 4.

For bison, as the original project has a Windows version way way out of date, and not compatible with ARM64, the following was used: https://github.com/lexxmark/winflexbison

CMake has native ARM64 builds, which are required to build this, as part of their latest release candidates.

More info can be found here: https://linaro.atlassian.net/wiki/spaces/WOAR/pages/28708241465/MySQL

This commit adds a secondary method of checking the given libevent
version, in the event of an MSVC ARM64 compilation.
The full fix for this issue will require something of a refactor, which
is out of scope for this initial ARM64 porting effort, only appears when
using VS2022 17.2 or higher
This commit adds initial support for building for an ARM64 target on
windows, using the MSVC compiler.
This commit defines a minimum version of MSVC required for ARM64 builds,
due to an internal compiler error in older versions.
This commit adds a warning/error for ARM64 platforms in the event that
clang is chosen as the compiler.
@mysql-oca-bot
Copy link

Hi, thank you for your contribution. Please confirm this code is submitted under the terms of the OCA (Oracle's Contribution Agreement) you have previously signed by cutting and pasting the following text as a comment:
"I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it."
Thanks

@anthony-linaro
Copy link
Author

I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

@mysql-oca-bot
Copy link

Hi, thank you for your contribution. Your code has been assigned to an internal queue. Please follow
bug http://bugs.mysql.com/bug.php?id=107981 for updates.
Thanks

@adiantek
Copy link

adiantek commented Mar 31, 2025

Tried to compile 8.0.41, but I couldn't start (stuck at InnoDB generate done). Now, I run your script and:

  1075>Done Building Project "C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\sql\sql_main.vcxproj" (
       default targets) -- FAILED.
    28>Done Building Project "C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\sql\sql_main.vcxproj.me
       taproj" (default targets) -- FAILED.
    27>Done Building Project "C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\storage\innobase\innoba
       se.vcxproj.metaproj" (default targets) -- FAILED.
    24>Done Building Project "C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\sql\GenMysqldDef.vcxpro
       j.metaproj" (default targets) -- FAILED.
   103>Done Building Project "C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\sql\mysqld.vcxproj.meta
       proj" (default targets) -- FAILED.
   102>Done Building Project "C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\plugin\audit_null\audit
       _null.vcxproj.metaproj" (default targets) -- FAILED.
   257>Done Building Project "C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\unittest\gunit\group_re
       plication\group_replication_compatibility_module-t.vcxproj.metaproj" (default targets) -- FAILED.
   501>Done Building Project "C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\router\tests\integratio
       n\routertest_integration_routing_reuse.vcxproj.metaproj" (default targets) -- FAILED.
   254>Done Building Project "C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\plugin\group_replicatio
       n\group_replication.vcxproj.metaproj" (default targets) -- FAILED.
   315>Done Building Project "C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\unittest\gunit\componen
       ts\mysql_server\minimal_chassis_test_driver-t.vcxproj.metaproj" (default targets) -- FAILED.
     2>Done Building Project "C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\ALL_BUILD.vcxproj.metap
       roj" (default targets) -- FAILED.
     1>Done Building Project "C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\MySQL.sln" (default tar
       gets) -- FAILED.

Build FAILED.

       "C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\MySQL.sln" (default target) (1) ->
       "C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\ALL_BUILD.vcxproj.metaproj" (default target)
       (2) ->
       "C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\utilities\GenClientError.vcxproj.metaproj" (d
       efault target) (5) ->
       "C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\utilities\comp_client_err.vcxproj.metaproj" (
       default target) (6) ->
       "C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\strings\strings.vcxproj.metaproj" (default ta
       rget) (10) ->
       "C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\mysys\mysys.vcxproj.metaproj" (default target
       ) (11) ->
       "C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\mysys\mysys_objlib.vcxproj.metaproj" (default
        target) (12) ->
       "C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\mysys\mysys_objlib.vcxproj" (default target)
       (105) ->
       (ClCompile target) ->
         C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\mysys\stacktrace.cc(444,9): warning C4068: unknown
        pragma 'error' [C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\mysys\mysys_objlib.vcxproj]
         C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\mysys\stacktrace.cc(461,1): warning C4700: uniniti
       alized local variable 'machine' used [C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\mysys\my
       sys_objlib.vcxproj]


       "C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\MySQL.sln" (default target) (1) ->
       "C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\ALL_BUILD.vcxproj.metaproj" (default target)
       (2) ->
       "C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\testclients\bug25714.vcxproj.metaproj" (defau
       lt target) (116) ->
       "C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\libmysql\mysqlclient.vcxproj.metaproj" (defau
       lt target) (118) ->
       "C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\libmysql\mysqlclient.vcxproj" (default target
       ) (764) ->
       (Lib target) ->
         libcrypto.lib(libcrypto-1_1-arm64.dll) : warning LNK4006: __NULL_IMPORT_DESCRIPTOR already defined in libssl.l
       ib(libssl-1_1-arm64.dll); second definition ignored [C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server
       \build\libmysql\mysqlclient.vcxproj]


       "C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\MySQL.sln" (default target) (1) ->
       "C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\ALL_BUILD.vcxproj.metaproj" (default target)
       (2) ->
       "C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\sql\GenMysqldDef.vcxproj.metaproj" (default t
       arget) (24) ->
       "C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\storage\innobase\innobase.vcxproj.metaproj" (
       default target) (27) ->
       "C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\sql\sql_main.vcxproj.metaproj" (default targe
       t) (28) ->
       "C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\sql\sql_main.vcxproj" (default target) (1075)
        ->
       (ClCompile target) ->
         C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\sql\sql_yacc.cc(46200,1): warning C4102: 'yy
       exhaustedlab': unreferenced label [C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\sql\sql_mai
       n.vcxproj]


       "C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\MySQL.sln" (default target) (1) ->
       "C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\ALL_BUILD.vcxproj.metaproj" (default target)
       (2) ->
       "C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\unittest\gunit\merge_small_tests-t.vcxproj.me
       taproj" (default target) (308) ->
       "C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\unittest\gunit\merge_small_tests-t.vcxproj" (
       default target) (936) ->
       (ClCompile target) ->
         C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\include\vector(1644,43): err
       or C2440: 'initializing': cannot convert from 'Mem_root_allocator<T>' to '_Alloc &' [C:\Users\barwn\Downloads\re
       producible-mysql\v2\mysql-server\build\unittest\gunit\merge_small_tests-t.vcxproj]
       C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\include\vector(1644,43): error
        C2440:         with [C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\unittest\gunit\merge_sma
       ll_tests-t.vcxproj]
       C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\include\vector(1644,43): error
        C2440:         [ [C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\unittest\gunit\merge_small_
       tests-t.vcxproj]
       C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\include\vector(1644,43): error
        C2440:             T=int [C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\unittest\gunit\merg
       e_small_tests-t.vcxproj]
       C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\include\vector(1644,43): error
        C2440:         ] [C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\unittest\gunit\merge_small_
       tests-t.vcxproj]
       C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\include\vector(1644,43): error
        C2440:         and [C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\unittest\gunit\merge_smal
       l_tests-t.vcxproj]
       C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\include\vector(1644,43): error
        C2440:         [ [C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\unittest\gunit\merge_small_
       tests-t.vcxproj]
       C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\include\vector(1644,43): error
        C2440:             _Alloc=stlalloc_unittest::Mem_root_allocator_wrapper<int> [C:\Users\barwn\Downloads\reproduc
       ible-mysql\v2\mysql-server\build\unittest\gunit\merge_small_tests-t.vcxproj]
       C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\include\vector(1644,43): error
        C2440:         ] [C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\unittest\gunit\merge_small_
       tests-t.vcxproj]
         C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\include\vector(1644,43): err
       or C2440: 'initializing': cannot convert from 'Malloc_allocator<T>' to '_Alloc &' [C:\Users\barwn\Downloads\repr
       oducible-mysql\v2\mysql-server\build\unittest\gunit\merge_small_tests-t.vcxproj]
       C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\include\vector(1644,43): error
        C2440:         with [C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\unittest\gunit\merge_sma
       ll_tests-t.vcxproj]
       C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\include\vector(1644,43): error
        C2440:         [ [C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\unittest\gunit\merge_small_
       tests-t.vcxproj]
       C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\include\vector(1644,43): error
        C2440:             T=int [C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\unittest\gunit\merg
       e_small_tests-t.vcxproj]
       C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\include\vector(1644,43): error
        C2440:         ] [C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\unittest\gunit\merge_small_
       tests-t.vcxproj]
       C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\include\vector(1644,43): error
        C2440:         and [C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\unittest\gunit\merge_smal
       l_tests-t.vcxproj]
       C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\include\vector(1644,43): error
        C2440:         [ [C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\unittest\gunit\merge_small_
       tests-t.vcxproj]
       C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\include\vector(1644,43): error
        C2440:             _Alloc=stlalloc_unittest::Malloc_allocator_wrapper<int> [C:\Users\barwn\Downloads\reproducib
       le-mysql\v2\mysql-server\build\unittest\gunit\merge_small_tests-t.vcxproj]
       C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\include\vector(1644,43): error
        C2440:         ] [C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\unittest\gunit\merge_small_
       tests-t.vcxproj]


       "C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\MySQL.sln" (default target) (1) ->
       "C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\ALL_BUILD.vcxproj.metaproj" (default target)
       (2) ->
       "C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\sql\GenMysqldDef.vcxproj.metaproj" (default t
       arget) (24) ->
       "C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\storage\innobase\innobase.vcxproj.metaproj" (
       default target) (27) ->
       "C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\sql\sql_main.vcxproj.metaproj" (default targe
       t) (28) ->
       "C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\sql\sql_main.vcxproj" (default target) (1075)
        ->
         C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\include\utility(504,17): err
       or C2678: binary '==': no operator found which takes a left-hand operand of type '_Ty1' (or there is no acceptab
       le conversion) [C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\sql\sql_main.vcxproj]
       C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\include\utility(504,17): error
        C2678:         with [C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\sql\sql_main.vcxproj]
       C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\include\utility(504,17): error
        C2678:         [ [C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\sql\sql_main.vcxproj]
       C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\include\utility(504,17): error
        C2678:             _Ty1=const Role_id [C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\sql\sq
       l_main.vcxproj]
       C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\include\utility(504,17): error
        C2678:         ] [C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\sql\sql_main.vcxproj]
         C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\include\utility(504,48): err
       or C2678: binary '==': no operator found which takes a left-hand operand of type 'const _Ty2' (or there is no ac
       ceptable conversion) [C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\sql\sql_main.vcxproj]
       C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\include\utility(504,48): error
        C2678:         with [C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\sql\sql_main.vcxproj]
       C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\include\utility(504,48): error
        C2678:         [ [C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\sql\sql_main.vcxproj]
       C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\include\utility(504,48): error
        C2678:             _Ty2=Role_id [C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\sql\sql_main
       .vcxproj]
       C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.43.34808\include\utility(504,48): error
        C2678:         ] [C:\Users\barwn\Downloads\reproducible-mysql\v2\mysql-server\build\sql\sql_main.vcxproj]

    4 Warning(s)
    4 Error(s)

Time Elapsed 02:02:28.04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants