zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
50.75k stars 3.14k forks source link

Unable to build Zed on Windows (Arm64 Snapdragon X Elite) #19739

Open darrell-roberts opened 1 month ago

darrell-roberts commented 1 month ago

Check for existing issues

Describe the bug / provide steps to reproduce it

Cloned the repo and setup the required build toolchains for windows.

Cargo build fails on external build for ring. What is interesting is it is building ring 0.16 when the dep has been upgraded to 0.17 for windows ARM support https://github.com/zed-industries/zed/pull/11689.

Looking at cargo tree it looks like all ring deps are 0.17 except for one which is for rustls v20.9.

tree.txt

cargo build output:

error: failed to run custom build command for `ring v0.16.20`

Caused by:
  process didn't exit successfully: `C:\Users\darre\projects\zed\target\debug\build\ring-22c05b0a2ae4113b\build-script-build` (exit code: 101)
  --- stdout
  OPT_LEVEL = Some(0)
  TARGET = Some(aarch64-pc-windows-msvc)
  OUT_DIR = Some(C:\Users\darre\projects\zed\target\debug\build\ring-fa799d6ca067d952\out)
  cargo:rerun-if-env-changed=VCINSTALLDIR
  VCINSTALLDIR = None
  cargo:rerun-if-env-changed=VSTEL_MSBuildProjectFullPath
  VSTEL_MSBuildProjectFullPath = None
  cargo:rerun-if-env-changed=VSCMD_ARG_VCVARS_SPECTRE
  VSCMD_ARG_VCVARS_SPECTRE = None
  cargo:rerun-if-env-changed=WindowsSdkDir
  WindowsSdkDir = None
  cargo:rerun-if-env-changed=WindowsSDKVersion
  WindowsSDKVersion = None
  cargo:rerun-if-env-changed=LIB
  LIB = None
  PATH = Some(C:\Users\darre\projects\zed\target\debug\deps;C:\Users\darre\projects\zed\target\debug;C:\Users\darre\.rustup\toolchains\1.81-aarch64-pc-windows-msvc\lib\rustlib\aarch64-pc-windows-msvc\lib;C:\Users\darre\.rustup\toolchains\1.81-aarch64-pc-windows-msvc\bin;C:\Users\darre\bin;C:\Program Files\Git\clangarm64\bin;C:\Program Files\Git\usr\local\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\darre\bin;C:\tools\ruby27\bin;C:\Python312\Scripts;C:\Python312;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files\Tailscale;C:\Program Files\CMake\bin;C:\Program Files (x86)\Windows Kits\10\Windows Performance Toolkit;C:\ProgramData\chocolatey\bin;C:\Program Files\OpenSSH-Win64;C:\Program Files\PowerShell\7;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Microsoft VS Code\bin;C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\Llvm\x64\bin;C:\Program Files\nodejs;C:\Program Files\LLVM\bin;C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.41.34120\bin\Hostx64\x64;C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x64;C:\Users\darre\.cargo\bin;C:\Users\darre\AppData\Local\Microsoft\WindowsApps;C:\Users\darre\AppData\Local\Microsoft\WinGet\Packages\AgileBits.1Password.CLI_Microsoft.Winget.Source_8wekyb3d8bbwe;C:\Users\darre\AppData\Roaming\npm;C:\tools\neovim\nvim-win64\bin;C:\Program Files\Git\usr\bin\vendor_perl;C:\Program Files\Git\usr\bin\core_perl)
  cargo:rerun-if-env-changed=INCLUDE
  INCLUDE = None
  HOST = Some(aarch64-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=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = 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=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  montgomery.c
  C:\Users\darre\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ring-0.16.20\crypto\fipsmodule\bn\internal.h(191): error C2065: 'BN_ULLONG': undeclared identifier
  C:\Users\darre\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ring-0.16.20\crypto\fipsmodule\bn\internal.h(191): error C2146: syntax error: missing ';' before identifier 'result'
  C:\Users\darre\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ring-0.16.20\crypto\fipsmodule\bn\internal.h(191): warning C4555: result of expression not used
  C:\Users\darre\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ring-0.16.20\crypto\fipsmodule\bn\internal.h(191): error C2065: 'result': undeclared identifier
  C:\Users\darre\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ring-0.16.20\crypto\fipsmodule\bn\internal.h(191): error C2065: 'BN_ULLONG': undeclared identifier
  C:\Users\darre\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ring-0.16.20\crypto\fipsmodule\bn\internal.h(191): error C2146: syntax error: missing ';' before identifier 'a'
  C:\Users\darre\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ring-0.16.20\crypto\fipsmodule\bn\internal.h(191): warning C4552: '*': result of expression not used
  C:\Users\darre\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ring-0.16.20\crypto\fipsmodule\bn\internal.h(192): error C2065: 'result': undeclared identifier
  C:\Users\darre\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ring-0.16.20\crypto\fipsmodule\bn\internal.h(193): error C2065: 'result': undeclared identifier
  C:\Users\darre\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ring-0.16.20\crypto\fipsmodule\bn\internal.h(193): warning C4293: '>>': shift count negative or too big, undefined behavior
  C:\Users\darre\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ring-0.16.20\crypto\fipsmodule\bn\../../limbs/limbs.inl(38): warning C4163: '_addcarry_u64': not available as an intrinsic function
  C:\Users\darre\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ring-0.16.20\crypto\fipsmodule\bn\../../limbs/limbs.inl(38): warning C4163: '_subborrow_u64': not available as an intrinsic function
  C:\Users\darre\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ring-0.16.20\crypto\fipsmodule\bn\../../limbs/limbs.inl(62): warning C4013: '_addcarry_u64' undefined; assuming extern returning int
  C:\Users\darre\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ring-0.16.20\crypto\fipsmodule\bn\../../limbs/limbs.inl(62): warning C4242: '=': conversion from 'int' to 'Carry', possible loss of data
  C:\Users\darre\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ring-0.16.20\crypto\fipsmodule\bn\../../limbs/limbs.inl(76): warning C4242: '=': conversion from 'int' to 'Carry', possible loss of data
  C:\Users\darre\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ring-0.16.20\crypto\fipsmodule\bn\../../limbs/limbs.inl(92): warning C4013: '_subborrow_u64' undefined; assuming extern returning int
  C:\Users\darre\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ring-0.16.20\crypto\fipsmodule\bn\../../limbs/limbs.inl(92): warning C4242: '=': conversion from 'int' to 'Carry', possible loss of data
  C:\Users\darre\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ring-0.16.20\crypto\fipsmodule\bn\../../limbs/limbs.inl(106): warning C4242: '=': conversion from 'int' to 'Carry', possible loss of data

  --- stderr
  running "C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.41.34120\\bin\\HostARM64\\arm64\\cl.exe" "-nologo" "-MD" "-Z7" "-Brepro" "-I" "include" "-W4" "/GS" "/Gy" "/EHsc" "/GR-" "/Zc:wchar_t" "/Zc:forScope" "/Zc:inline" "/Zc:rvalueCast" "/sdl" "/Wall" "/wd4127" "/wd4464" "/wd4514" "/wd4710" "/wd4711" "/wd4820" "/wd5045" "/Od" "/RTCsu" "-DNDEBUG" "-c" "/FoC:\\Users\\darre\\projects\\zed\\target\\debug\\build\\ring-fa799d6ca067d952\\out\\montgomery.obj" "crypto/fipsmodule/bn/montgomery.c"
  thread 'main' panicked at C:\Users\darre\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ring-0.16.20\build.rs:656:9:
  execution failed
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...

Environment

Edition     Windows 11
Processor   Snapdragon(R) X 12-core X1E80100 @ 3.40 GHz   3.42 GHz
Installed RAM   32.0 GB (31.6 GB usable)
System type 64-bit operating system, ARM-based processor

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your Zed.log file to this issue.

Zed.log


bbb651 commented 1 month ago

It's due to ring not supporting arm windows pre-0.17, I narrowed down to a dependency on an old version of async-tungstenite, upgrading it (see #17380) should resolve this (but there're probably other blockers).

darrell-roberts commented 1 month ago

It's due to ring not supporting arm windows pre-0.17, I narrowed down to a dependency on an old version of async-tungstenite, upgrading it (see #17380) should resolve this (but there're probably other blockers).

Thanks. I updated that along with rustls to 0.23 (which required making some changes to crates/client/src/client.rs). I now get the runtime error reported here: https://github.com/zed-industries/zed/issues/17374

frankniujc commented 2 weeks ago

It turns out that the x64 windows zed and arm64 ubuntu (running in wsl) also won't launch.

frankniujc commented 1 week ago

For version 0.162.3, zed can be compiled directly without any issue with ring. However, I still can't launch zed on arm64 windows (Qualcomm X Elite). Here's the error message.

PS C:\Users\frank\Desktop\zed\target\debug> .\zed.exe
[2024-11-20T23:54:17-05:00 ERROR fs] Error { kind: Generic("Input watch path is neither a file nor a directory."), paths: [] }
[2024-11-20T23:54:18-05:00 ERROR fs] Error { kind: Generic("Input watch path is neither a file nor a directory."), paths: [] }
[2024-11-20T23:54:18-05:00 ERROR fs] Error { kind: Generic("Input watch path is neither a file nor a directory."), paths: [] }
[2024-11-20T23:54:18-05:00 ERROR fs] Error { kind: Generic("Input watch path is neither a file nor a directory."), paths: [] }
[2024-11-20T23:54:18-05:00 ERROR blade_graphics::hal::init] No composite alpha flag for transparency: OPAQUE
[2024-11-20T23:54:19-05:00 ERROR zed::reliability] {
  "thread": "main",
  "payload": "called `Result::unwrap()` on an `Err` value: ([0x0], ERROR_UNKNOWN)",
  "location_data": {
    "file": "C:\\Users\\frank\\.cargo\\git\\checkouts\\blade-b2bcd1de1cf7ab6a\\e142a3a\\blade-graphics\\src\\vulkan\\pipeline.rs",
    "line": 546
  },
  "backtrace": [
    "backtrace::backtrace::dbghelp64::trace",
    "backtrace::backtrace::trace_unsynchronized<backtrace::capture::impl$4::create::closure_env$0>",
    "backtrace::backtrace::trace<backtrace::capture::impl$4::create::closure_env$0>",
    "backtrace::capture::Backtrace::create",
    "backtrace::capture::Backtrace::new",
    "zed::reliability::init_panic_hook::closure$0",
    "alloc::boxed::impl$50::call",
    "std::panicking::rust_panic_with_hook",
    "std::panicking::begin_panic_handler::closure$0",
    "std::sys::backtrace::__rust_end_short_backtrace<std::panicking::begin_panic_handler::closure_env$0,never$>"
  ],
  "app_version": "0.162.3",
  "release_channel": "Zed",
  "os_name": "Windows",
  "os_version": "10.0.26100",
  "architecture": "aarch64",
  "panicked_on": 1732164859317,
  "system_id": "7023e526-e0ae-428a-9251-4ca39ebae4d0",
  "installation_id": "a3ad595a-3a9d-4df1-be3f-9bcd3eebe914",
  "session_id": "eb4fa707-5621-4fde-8ec1-c1ed4a7ad41b"
}

It seems that the issue is Blade currently does not support Qualcomm X Elite GPUs. A comment from June 2024 mentioned the lack of a Vulkan SDK for ARM64 Windows as a limitation. However, that’s no longer the case---there is now a Vulkan SDK available for ARM64 Windows. https://vulkan.lunarg.com/sdk/home#windows.

I’ve tried installing the Vulkan SDK and runtime, but this doesn’t resolve the issue. I’m still encountering the following error:

called `Result::unwrap()` on an `Err` value: ([0x0], ERROR_UNKNOWN)

This leads me to believe that the issue lies with X Elite GPUs and Adreno GPUs not being added to the supported hardware list in Blade. Now that Vulkan has ARM64 support, could these GPUs be added to the compatibility list so we can enable Blade to work with Qualcomm chips?

I have an update with my previous comment, I can get linux zed running in WSL when running in X11 mode.