User Tools

Site Tools


Translations of this page:



最近の更新



Tag Cloud

en:50_dialy:2025:03:14

2025.03.14 Building Zed Editor on Windows

Building Zed Editor for Windows

1. Install Rust

To download and install: https://www.rust-lang.org/tools/install

winget install Rustlang.Rustup

2. Install MSVC

MSVC (Microsoft Visual C++)

Use Build Tools for Visual Studio

winget install Microsoft.VisualStudio.2022.BuildTools

Add C++ Toolset

Add from Visual Studio Installer

  1. Press Win + S, type “Visual Studio Installer”, and open it.
    • Select “Visual Studio Build Tools”
  2. Click the “Modify” button.
    • Add the “Desktop development with C++” workload
  3. Check the workload that includes the C++ compiler and build tools.
    • Click the “Modify” button to start the installation
  4. Click the “Modify” button to start the installation
    • Restart your PC once the installation is complete.

MSVC Spectre-mitigated Libraries are also required

  1. Select Build Tools for Visual Studio 2022 in the Visual Studio Installer.
  2. Open the Individual components tab.
  3. Search for and check “MSVC v143 Spectre-mitigated Libraries (x86/x64)”.
  4. Click Apply changes to complete the installation.

cmake is also required

winget install Kitware.CMake

3. Install wasm toolchain

A set of development tools for compiling and running code for WebAssembly (WASM).
It usually includes a compiler, runtime, debugger, linker, etc.

rustup target add wasm32-wasip1

4. Clone the source

git clone https://github.com/zed-industries/zed.git

Modify rust-toolchain.toml

targets = [
    "x86_64-apple-darwin",
    "aarch64-apple-darwin",
    "x86_64-unknown-linux-gnu",
    "x86_64-pc-windows-msvc",
    "wasm32-wasip1", # extensions
    "x86_64-unknown-linux-musl", # remote server
]



targets = [ "stable-x86_64-pc-windows-msvc" ]

5. Compile

cd zed
rustup override set stable-x86_64-pc-windows-msvc
cargo build --release

6. Launch

After compilation is complete, zed.exe will be created in the following location:

target\release\zed.exe

Error Collection

cmake is missing

error: failed to run custom build command for `aws-lc-sys v0.27.0`

Caused by:
  process didn't exit successfully: `C:\Users\s-matsui\zed\target\release\build\aws-lc-sys-e3261c7b861cf150\build-script-main` (exit code: 101)
  --- stdout
  cargo:rerun-if-env-changed=AWS_LC_SYS_NO_PREFIX
  cargo:rerun-if-env-changed=AWS_LC_SYS_PREGENERATING_BINDINGS
  cargo:rerun-if-env-changed=AWS_LC_SYS_EXTERNAL_BINDGEN
  cargo:rerun-if-env-changed=AWS_LC_SYS_NO_ASM
  cargo:rerun-if-env-changed=AWS_LC_SYS_CFLAGS
  cargo:rerun-if-env-changed=AWS_LC_SYS_PREBUILT_NASM
  cargo:rerun-if-env-changed=AWS_LC_SYS_C_STD
  cargo:rustc-cfg=x86_64_pc_windows_msvc
  cargo:rerun-if-env-changed=AWS_LC_SYS_CMAKE_BUILDER
  cargo:rerun-if-env-changed=AWS_LC_SYS_STATIC
  default_for Target: 'x86_64-pc-windows-msvc'
  cargo:rerun-if-env-changed=AWS_LC_SYS_STATIC
  cargo:rerun-if-env-changed=CMAKE

  --- stderr
  Missing dependency: cmake

  thread 'main' panicked at C:\Users\s-matsui\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\aws-lc-sys-0.27.0\builder\main.rs:382:40:
  called `Result::unwrap()` on an `Err` value: "Required build dependency is missing. Halting build."
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...

Solution

link.exe is missing

error: linker link.exe not found
  |
  = note: program not found

note: the msvc targets depend on the msvc linker but link.exe was not found

note: please ensure that Visual Studio 2017 or later, or Build Tools for Visual Studio were installed with the Visual C++ option.

note: VS Code is a different product, and is not sufficient.

   Compiling cc v1.2.12
error: could not compile windows_x86_64_msvc (build script) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: could not compile typeid (build script) due to 1 previous error
error: could not compile serde (build script) due to 1 previous error
error: could not compile proc-macro2 (build script) due to 1 previous error

Solution

msvc_spectre_libs is missing

 Compiling clap_builder v4.5.32
warning: msvc_spectre_libs@0.1.2: No spectre-mitigated libs were found. Please modify the VS Installation to add these.
error: failed to run custom build command for msvc_spectre_libs v0.1.2

Caused by:
  process didn't exit successfully: C:\Users\s-matsui\zed\target\release\build\msvc_spectre_libs-362ba44b58252040\build-script-build (exit code: 101)
  --- stdout
  cargo:warning=No spectre-mitigated libs were found. Please modify the VS Installation to add these.

  --- stderr

  thread 'main' panicked at C:\Users\s-matsui\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\msvc_spectre_libs-0.1.2\build.rs:37:13:
  No spectre-mitigated libs were found. Please modify the VS Installation to add these.
  note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...

Solution

Out of memory

   Compiling assistant_slash_commands v0.1.0 (C:\Users\s-matsui\zed\crates\assistant_slash_commands)
   Compiling aws-smithy-xml v0.60.9
   Compiling language_model_selector v0.1.0 (C:\Users\s-matsui\zed\crates\language_model_selector)
rustc-LLVM ERROR: out of memory
Allocation failed
error: could not compile `editor` (lib)

Solution

Limit parallel execution

set CARGO_BUILD_JOBS=1

Try rebuilding with this setting.

en/50_dialy/2025/03/14.txt · Last modified: 2025/03/20 10:45 by matsui