LGUG2Z / komorebi

A tiling window manager for Windows 🍉
https://lgug2z.github.io/komorebi/
Other
9.21k stars 187 forks source link

[FEAT]: Support aarch64 builds on GitHub Actions #1058

Open LGUG2Z opened 6 days ago

LGUG2Z commented 6 days ago

Sponsorship Information

GitHub Sponsors

Suggestion

In the last week there have been two aarch64 machine users who have joined the community and with the growing popularity of both the software and ARM Windows laptops, it probably won't be long until there are more.

We need to have aarch64 builds happening as part of our regular builds against every commit and PR, and also have aarch64 builds available in the tagged releases.

Things that need to be researched:

This is probably also a good time to completely overhaul our GitHub actions workflows since they are a huge mess and I hate touching them.

Alternatives Considered

LGUG2Z commented 6 days ago

I tried running cross build --target aarch64-pc-windows-msvc locally and got this error:

The following warnings were emitted during compilation:

warning: libz-sys@1.1.20: Compiler family detection failed due to error: ToolNotFound: Failed to find tool. Is `cl.exe` installed? (see https://docs.rs/cc/latest/cc/#compile-time-requirements for help)

error: failed to run custom build command for `libz-sys v1.1.20`

Caused by:
  process didn't exit successfully: `C:\Users\LGUG2Z\komorebi\target\debug\build\libz-sys-460dba889d8e73a0\build-script-build` (exit code: 1)
  --- stdout
  cargo:rerun-if-env-changed=LIBZ_SYS_STATIC
  cargo:rerun-if-changed=build.rs
  cargo:rerun-if-changed=zng/cmake.rs
  cargo:rerun-if-changed=zng/cc.rs
  note, vcpkg did not find zlib: Could not find Vcpkg tree: No vcpkg installation found. Set the VCPKG_ROOT environment variable or run 'vcpkg integrate install'
  TARGET = Some(aarch64-pc-windows-msvc)
  OPT_LEVEL = Some(0)
  cargo:rerun-if-env-changed=VCINSTALLDIR
  VCINSTALLDIR = None
  cargo:rerun-if-env-changed=VSTEL_MSBuildProjectFullPath
  VSTEL_MSBuildProjectFullPath = None
  HOST = Some(x86_64-pc-windows-msvc)
  cargo:rerun-if-env-changed=CC_aarch64-pc-windows-msvc
  CC_aarch64-pc-windows-msvc = None
  cargo:rerun-if-env-changed=CC_aarch64_pc_windows_msvc
  CC_aarch64_pc_windows_msvc = None
  cargo:rerun-if-env-changed=TARGET_CC
  TARGET_CC = None
  cargo:rerun-if-env-changed=CC
  CC = None
  cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
  cargo:warning=Compiler family detection failed due to error: ToolNotFound: Failed to find tool. Is `cl.exe` installed? (see https://docs.rs/cc/latest/cc/#compile-time-requirements for help)
  RUSTC_WRAPPER = None
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  CARGO_CFG_TARGET_FEATURE = Some(neon)
  DEBUG = Some(true)
  cargo:rerun-if-env-changed=CFLAGS_aarch64-pc-windows-msvc
  CFLAGS_aarch64-pc-windows-msvc = None
  cargo:rerun-if-env-changed=CFLAGS_aarch64_pc_windows_msvc
  CFLAGS_aarch64_pc_windows_msvc = None
  cargo:rerun-if-env-changed=TARGET_CFLAGS
  TARGET_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None

  --- stderr

  error occurred: Failed to find tool. Is `cl.exe` installed? (see https://docs.rs/cc/latest/cc/#compile-time-requirements for help)

I installed all the C++ development tools from the Visual Studio installer but I still don't have cl.exe 🤔

LGUG2Z commented 6 days ago

https://www.qovery.com/blog/how-to-make-rust-multi-arch-release-easy/

Could possibly be useful, though I would like to remove our dependency on goreleaser completely 🤔

bbedward commented 6 days ago

You likely need to host an arm64 windows GitHub runner. Not sure if cross compiling is possible given this projects dependencies.

there are some hosted services such as WarpBuild, but not sure if they have windows arm64 runners (seems like not)

LGUG2Z commented 5 days ago

Not sure if cross compiling is possible given this projects dependencies

Luckily I found this action which did a lot of the heavy lifting with regards to cross-compilation: https://github.com/houseabsolute/actions-rust-cross - I don't know what it does but it works!

LGUG2Z commented 5 days ago

I iterated on a bunch of changes I had to enable this in the whkd repo: https://github.com/LGUG2Z/whkd/blob/a04b9d5fc19e689efc488ec76f887806fda4ce11/.github/workflows/windows.yaml#L23

I managed to cut a release with both x86_64 and aarch64 binaries through the workflow and I've migrated largely the same approach here: https://github.com/LGUG2Z/komorebi/commit/92dd3169ca3f51d3856c532cec7b9448baa92405

I have set up a release dry run job which will run on every master commit to hopefully get ahead of any breaking workflow changes quickly in the future.

From the whkd update experience it seems like the WinGet updater action will not pick up the new arch target so it will need to be updated manually when the action creates the PR to the WinGet pkgs repo. Still not sure if the scoop updater will pick it up as it hasn't found v0.2.2 yet...