Windows On Arm (WOA)Tips and tricks for porting to win-arm64

Tips and tricks for porting to win-arm64

This page doesn’t try to be a complete porting guide, just a collection of the learnt approaches during porting Python packages and 3rd party libraries.

Common issues

  • Start with x86/x64 build as a reference and understand the "clean" build flow if possible, before trying to fix it on win-arm64.

  • Historically Windows used to be equal to x86/x64, so Intel specific HW features are default enabled.

    • Example: https://github.com/ImageOptim/libimagequant/pull/66/commits/94adecb956eac74801bc035a0c403aaf44866d16

    • Example for a nice build error message:

      xmmintrin.h(27,1): fatal error C1189: #error: This header is specific to X86 and X64 targets -> Intel Streaming SIMD Extensions (SSE) HW feature is turned on, as wrong platform was selected by one of the compiler switches.

       

  • Does the project include a Visual Studio project?

  • Does the project include Arm assembly source file that could be reused for win-arm64?

 

  • Do you have an executable that doesn’t start to run and you don’t see any error messages?

    • If you see this in console, try in GUI (Explorer) again, probably you’ll see some error pop-up window.

    • Do you see this as a CMake error that some simple C or C++ test is not able to run, so the build is aborted?

    • There is a good chance you hit this issue: https://linaro.atlassian.net/wiki/spaces/WOAR/pages/28677636097

 

  • Does the build fail in a very early phrase, reporting there are no C/C++ compiler found?

    • Try to invoke vcvars manually, then repeat it.

      • Powershell

        cmd /k '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsx86_arm64.bat" & powershell'
      • cmd

        "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsx86_arm64.bat"
    • If it’s fixed, you’d need to find where the environment should be set properly by the build process.

 

 

Python related tips

  • Tests

    • Is there a test folder with test pythons scripts, but no hint how to run them?

      • Try install pytest and run this:

        pytest <test directory>

 

  • Is vcvars.bat called some of the inner scripts and not setuptools or distutils?

    • Example: Example: https://github.com/mesonbuild/meson/pull/9409/commits/466ad78239e0f30bed16c40b863a79dc1a80b4b0

    • Don’t you find where is it defined?

      • Try to search for vcvars or vc_arch