Skip to content

feat: Add Windows ARM64 (aarch64-pc-windows-msvc) build support#42312

Open
npiesco wants to merge 4 commits intoservo:mainfrom
npiesco:main
Open

feat: Add Windows ARM64 (aarch64-pc-windows-msvc) build support#42312
npiesco wants to merge 4 commits intoservo:mainfrom
npiesco:main

Conversation

@npiesco
Copy link
Copy Markdown
Contributor

@npiesco npiesco commented Feb 3, 2026

Enables Servo to build natively on Windows ARM64.

Problem:
On Windows ARM64, MSVC compiler includes <arm_fp16.h> which defines typedef __fp16 float16_t;. This conflicts with struct float16_t in glslopt's glsl-optimizer/src/util/half_float.h, causing compilation error.

Fix:

  • Cargo.toml: Patch glslopt to use vendored copy with fix
  • third_party/glslopt-patched/: Vendored glslopt with float16_t renamed to mesa_float16_t

Upstream: jamienicol/glslopt-rs#11 (vendored copy can be removed once merged and released.)

Prerequisite PRs:

Tested on Windows 11 ARM64:

  • Rust 1.91.0-aarch64-pc-windows-msvc
  • LLVM 21 ARM64
  • OpenSSL 3.6.1 ARM64
  • MSVC 14.50.35717

@servo-highfive servo-highfive added S-awaiting-review There is new code that needs to be reviewed. S-needs-rebase There are merge conflict errors. labels Feb 3, 2026
@servo-highfive servo-highfive added S-needs-rebase There are merge conflict errors. and removed S-needs-rebase There are merge conflict errors. labels Feb 3, 2026
@servo-highfive servo-highfive added S-needs-rebase There are merge conflict errors. and removed S-needs-rebase There are merge conflict errors. labels Feb 3, 2026
@arihant2math
Copy link
Copy Markdown
Contributor

Might be worth contributing the glslopt fixes to the upstream. The crate seems to be maintained.

@sagudev
Copy link
Copy Markdown
Member

sagudev commented Feb 4, 2026

Why is bumping python needed? All builds 3.11=< have windows arm64 builds per https://www.python.org/downloads/windows/.

We should definitely upstream the fix for glsl. As for other changes can you do separate PR for each of them. This way we can keep thing moving and it will be easier to revert stuff if needed.

@servo-highfive servo-highfive added the S-needs-rebase There are merge conflict errors. label Feb 4, 2026
@servo-highfive servo-highfive added S-needs-rebase There are merge conflict errors. and removed S-needs-rebase There are merge conflict errors. labels Feb 4, 2026
npiesco added a commit to npiesco/servo that referenced this pull request Feb 4, 2026
Windows ARM64 (aarch64-pc-windows-msvc) doesn't have native profiling
support in the background hang monitor. Add it to the list of platforms
that use DummySampler, alongside Linux musl and other unsupported targets.

Part of Windows ARM64 build support: servo#42312
npiesco added a commit to npiesco/servo that referenced this pull request Feb 4, 2026
std::process::Command cannot be reused after calling .output() because
it consumes the command's internal state. The previous code would create
a Command, test it with try_python_command(), and then try to return the
same Command - but by then the command was already consumed.

This refactors try_python_command() to:
1. Take program name and args as parameters
2. Only test if the command works (returning Result<(), String>)
3. Create a FRESH Command in find_python() after confirming it works

Part of Windows ARM64 build support: servo#42312
@servo-highfive servo-highfive added S-needs-rebase There are merge conflict errors. and removed S-needs-rebase There are merge conflict errors. labels Feb 4, 2026
npiesco added a commit to npiesco/servo that referenced this pull request Feb 4, 2026
std::process::Command cannot be reused after calling .output() because
it consumes the command's internal state. The previous code would create
a Command, test it with try_python_command(), and then try to return the
same Command - but by then the command was already consumed.

This refactors try_python_command() to:
1. Take program name and args as parameters
2. Only test if the command works (returning Result<(), String>)
3. Create a FRESH Command in find_python() after confirming it works

Part of Windows ARM64 build support: servo#42312

Signed-off-by: npiesco <[email protected]>
npiesco added a commit to npiesco/servo that referenced this pull request Feb 4, 2026
Windows ARM64 (aarch64-pc-windows-msvc) doesn't have native profiling
support in the background hang monitor. Add it to the list of platforms
that use DummySampler, alongside Linux musl and other unsupported targets.

Part of Windows ARM64 build support: servo#42312

Signed-off-by: npiesco <[email protected]>
This commit enables Servo to build natively on Windows ARM64.

Changes:
- Cargo.toml: Patch glslopt to use vendored version with ARM64 fix
- third_party/glslopt-patched/: Vendored glslopt-rs with float16_t renamed
  to mesa_float16_t to avoid conflicts with ARM NEON intrinsics in arm_fp16.h
- README.md: Add Windows ARM64 to supported platforms

The glslopt fix has been submitted upstream: jamienicol/glslopt-rs#11
Once merged, the vendored copy can be removed.

Related PRs:
- fix(build): Fix Command reuse bug in find_python() - #TBD
- fix(background_hang_monitor): Use DummySampler on Windows ARM64 - #TBD

Tested on Windows 11 ARM64 with:
- Rust 1.91.0-aarch64-pc-windows-msvc
- Python 3.11+ ARM64 via uv
- LLVM 21 ARM64
- OpenSSL 3.6.1 ARM64
- MSVC 14.50.35717

Signed-off-by: npiesco <[email protected]>
@servo-highfive servo-highfive removed the S-needs-rebase There are merge conflict errors. label Feb 4, 2026
@servo-highfive servo-highfive added the S-needs-rebase There are merge conflict errors. label Feb 4, 2026
@servo-highfive servo-highfive removed the S-needs-rebase There are merge conflict errors. label Feb 4, 2026
@npiesco
Copy link
Copy Markdown
Contributor Author

npiesco commented Feb 4, 2026

Why is bumping python needed? All builds 3.11=< have windows arm64 builds per https://www.python.org/downloads/windows/.

We should definitely upstream the fix for glsl. As for other changes can you do separate PR for each of them. This way we can keep thing moving and it will be easier to revert stuff if needed.

You're right about Python, reverted it back to 3.11. When working on this I just used the version I had on my system already.

I split out the other changes into separate PRs:

  • build.rs Command reuse fix: fix/build-rs-command-reuse branch (will open PR shortly)
  • DummySampler ARM64 fallback: fix/arm64-windows-dummy-sampler branch (will open PR shortly)

This PR now only contains glslopt vendoring for ARM64 Windows support. Upstream fix is at: https://github.com/jamienicol/glslopt-rs/pull/11

npiesco added a commit to npiesco/servo that referenced this pull request Feb 5, 2026
Windows ARM64 (aarch64-pc-windows-msvc) doesn't have native profiling
support in the background hang monitor. Add it to the list of platforms
that use DummySampler, alongside Linux musl and other unsupported targets.

Part of Windows ARM64 build support: servo#42312

Signed-off-by: npiesco <[email protected]>
github-merge-queue bot pushed a commit that referenced this pull request Feb 6, 2026
Windows ARM64 (aarch64, MSVC) does not support native profiling. PR
updates platform configuration to route Windows ARM64 to DummySampler,
aligning it with other unsupported targets (e.g., Linux musl) and fixing
build compatibility.

PR #42312
- Updates platform configuration + conditional compilation
- Background hang monitor (lib.rs) now selects DummySampler on Windows
ARM64
- Uses DummySampler as SamplerImpl for aarch64 Windows

build/compatibility fix only.

---------

Signed-off-by: npiesco <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-awaiting-review There is new code that needs to be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants