Skip to content

Windows ARM64 native builds fail: bun:ffi unavailable in stable Bun, bun-pty ships x64-only DLL #45875

Closed

Description

@ataidecarlos

Summary

Building and running opencode natively on Windows on ARM (arm64, e.g. Snapdragon X laptops) hits two runtime gaps. The build itself works with Bun 1.4.0 (packages/opencode/script/build.ts already lists a win32 arm64 target), but the TUI and #pty shell sessions break.

1. TUI renderer needs bun:ffi, which stable Bun disables on windows-aarch64

OpenTUI (@opentui/core) loads a native opentui.dll through bun:ffi. Stable Bun 1.3.x ships bun:ffi compiled out on windows-aarch64 (TinyCC has no ARM64 backend), so the TUI fails at startup with:

Failed to initialize OpenTUI render library: bun:ffi dlopen() is not available in this build (TinyCC is disabled)

Bun 1.4.0+ ships an engine-native FFI that works on Windows ARM64, so this is resolved by requiring Bun >= 1.4.0 there.

2. bun-pty ships only an x64 Windows DLL

bun-pty@0.4.8's Windows binary (rust_pty.dll) is x64-only and cannot be loaded by an arm64 process, breaking shell sessions via #pty. bun-pty is a Rust crate using the portable-pty backend and cross-compiles cleanly — it just needs a win32-arm64 build published (repo: github.com/sursaone/bun-pty).

Suggested fixes

  • Document and/or enforce Bun >= 1.4.0 for windows-arm64 (CI matrix + docs).
  • bun-pty: publish a windows-arm64 build, or have opencode vendor/swap the DLL for arm64 (the current local workaround does exactly this via a postinstall step).

Verified context

  • Native single-file build (opencode-windows-arm64) succeeds with Bun 1.4.0 (arm64) on Windows 11 ARM64.
  • Everything else in the toolchain (esbuild, tree-sitter, @opentui/core-win32-arm64, etc.) resolves for arm64 out of the box.

Happy to send the local patch (postinstall DLL swap + install script windows-arm64 combo) as a PR if useful.

Activity

  1. github-actions commented on Aug 28, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Please check those threads to see if your issue is already being tracked or if there is useful context there. If your report covers something not addressed in those issues (particularly the bun-pty x64-only DLL for Windows ARM64), feel free to note that distinction.

  2. ataidecarlos commented on Aug 28, 2026

    @ataidecarlos
    Author

    Update: pre-existing PRs already cover both gaps — #44665 (install allowlist, by the issue author) and #44946 (Bun pin 1.4.0 + compatibility fixes, by the issue author). My PRs #45877/#45878 were closed as duplicates in favor of those. The remaining follow-up is the bun-pty x64-only Windows DLL (upstream: github.com/sursaone/bun-pty).

  3. dakehero commented on Aug 31, 2026

    @dakehero

    The remaining native bun-pty piece is now proposed in sursaone/bun-pty#46.

    It adds a separately named Windows ARM64 DLL, native ARM64 build/publish jobs, static CRT linkage, runtime selection with the existing x64 fallback preserved, and a bun build --compile ARM64 smoke test. I validated the ARM64 artifact locally on Windows 11 ARM64 with Bun 1.4.0: 86 unit tests and 11 integration tests pass, and the compiled executable runs successfully outside the repository.

    Once released, this should complement #44665 and #44946 on the OpenCode side.

  4. Psychlist1972 commented on Oct 10, 2026

    @Psychlist1972

    Hi All

    Is anyone here aware of other blockers here for Arm64 support? Folks are trying this on the new Surface Laptop Ultra and other RTX Spark devices but are immediately blocked due to this problem. I just tried 1.18.35 and it fails on my Snapdragon devices as well.

    Pete
    Microsoft

  5. dakehero commented on Oct 10, 2026

    @dakehero

    Hi @Psychlist1972 , I checked the current release and the upstream fixes.
    The bun-pty ARM64 work is published in 0.4.11. Its npm package includes the native rust_pty_arm64.dll, and the loader selects it on win32/arm64. OpenCode 1.18.35 and current dev still pin bun-pty 0.4.8.
    The CLI release pipeline also still uses the global Bun 1.3.14 pin. The Windows-only 1.4.2 override does not apply to the CLI build, which runs on Ubuntu. Stable Bun has supported Windows ARM64 FFI since 1.4.0.
    There is a new development for #44946: Bun 1.4.3 was released today and includes the fix for oven-sh/bun#42837, the compiled splitting regression reported with 1.4.1/1.4.2. It looks worth updating the proposed bump to 1.4.3 and validating the compiled artifact with bun-pty 0.4.11.
    The shell installer also still excludes windows-arm64; #44665 was closed without merging.

  6. dakehero commented on Oct 10, 2026

    @dakehero

    I’ve updated OpenCode to use bun-pty 0.4.11, and it works fine locally on Windows ARM64 with Bun 1.4.3. @Psychlist1972

  7. Psychlist1972 commented on Oct 12, 2026

    @Psychlist1972

    9. I’ve updated OpenCode to use bun-pty 0.4.11, and it works fine locally on Windows ARM64 with Bun 1.4.3. @Psychlist1972

    Thank you!

    Pete
    Microsoft

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions