Skip to content

rust-analyzer server binary on Windows doesn't ship required Visual C++ Runtime #20970

@ColinFinck

Description

@ColinFinck

Running rust-analyzer 0.3.2667 on a fresh Windows installation fails, because VCRUNTIME140.DLL is missing on that system and doesn't come with a default Windows installation.

This error and the solution of installing the missing Visual C++ Redistributable is hard to grasp for the average user, because rust-analyzer fails silently. You need to open the OUTPUT tab in VS Code, jump to "rust-analyzer Language Server" and translate the error stating:

Server process exited with error code 3221225781.

I see two viable solutions here:

  1. Auto-install the missing Visual C++ Runtime package. I remember a time when every Windows installer detected the presence of that package and auto-installed it if missing. Is that also possible when installing VS Code extensions?

  2. Build the rust-analyzer server binary with a static CRT. This may marginally increase the size of the binary, but entirely removes the DLL dependency. Adding the Rust flag -Ctarget-feature=+crt-static should be sufficient to achieve that.

CC @Veykril

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions