Thursday, December 8, 2022

[Technical] WPILib installation on ARM64 Windows

[EDIT: WPILib's installer supports installation on ARM64 as of this PR. ARM64 Windows support is discussed in detail in that thread.]

If you find yourself on a FIRST Robotics team looking to compete in the 2023 season and you're working on the software for the robot, you will probably find yourself attempting to install WPILib.

The standard path is to go to the GitHub releases page, download the relevant ISO, mount it, and run the installer. I was last on a FIRST team in 2006, and I find this system refreshingly simple.

The documentation is clear that ARM64 Windows 10 and 11 are not supported. While I greatly appreciate this candor, ARM64 Windows 11 is easy to support by leveraging x64 emulation. (Disclaimer: I work on the team at Microsoft that implemented and maintains this emulation layer.)

Please note that this is stepping off the supported path, so there may be dragons.

Installation requires enlightening the installer to choose x64 when it sees ARM64.

  1. Install Visual Studio (2019 or 2022; I used 2022 17.5.0 Preview 1.0) with the .NET Desktop Development workload.
  2. Clone the installer repository. git clone https://github.com/wpilibsuite/WPILibInstaller-Avalonia.git
  3. Open the .sln file at the root of the repo with Visual Studio.
  4. Modify WPILibInstaller-Avalonia/Utils/PlatformUtils.cs to map ARM64 to x64.
    1. In commit e4f0039cb, I changed line 50 from
    2. if (currentArch == Architecture.X64)
    3. to
    4. if (currentArch == Architecture.X64 || currentArch == Architecture.Arm64)
  5. Start the Develop Command Prompt for your installation of Visual Studio.
  6. Change to the cloned source directory.
  7. Build the standalone EXE version of the project with dotnet publish. dotnet publish -r win10-x64 -p:PublishSingleFile=true
  8. Unpack the WPILib ISO.
  9. Find WPILibInstaller.exe in the unpacked folder and replace it with <repo root>\WPILibInstaller-Avalonia\bin\Debug\net7.0\win10-x64\publish\WPILibInstaller.exe.
  10. Run the new WPILibInstaller.exe from the unpacked folder.

So far, so good...we'll see how far I get with the rest.

No comments:

Post a Comment