Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot build on Windows due to missing clang dlls #27535

Closed
stefnotch opened this issue Jan 3, 2025 · 3 comments
Closed

Cannot build on Windows due to missing clang dlls #27535

stefnotch opened this issue Jan 3, 2025 · 3 comments

Comments

@stefnotch
Copy link

stefnotch commented Jan 3, 2025

Version: Deno 7d66018 (one of the latest commits)

When attempting to build Deno on Windows 10 by following these instructions, I run into the following problem.

error: failed to run custom build command for `libuv-sys-lite v1.48.2`

Caused by:
  process didn't exit successfully: `C:\Coding\GitHub\Tools\deno\target\debug\build\libuv-sys-lite-b69ec193f23d297d\build-script-build` (exit code: 101)
  --- stderr
  thread 'main' panicked at C:\Users\Stefnotch\.cargo\registry\src\index.crates.io-6f17d22bba15001f\bindgen-0.70.1\lib.rs:622:27:
  Unable to find libclang: "couldn't find any valid shared libraries matching: ['clang.dll', 'libclang.dll'], set the `LIBCLANG_PATH` environment variable to a path where one of these files can be found (invalid: [])"
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

For anyone attempting to reproduce this: Upon following the instructions, the cmake dependency does not immediately work. Instead I had to pick one of those 3 options

  1. Run through the visual studio "Developer Command Prompt for VS 2022". This doesn't work with Rust Analyzer though.
  2. Add cmake to the system path.
  3. Or patch deno to not use cmake. See stefnotch@9ef65b7
@dsherret
Copy link
Member

dsherret commented Jan 3, 2025

I think maybe you need to install lvvm. This is what I have:

> clang --version
clang version 18.1.8
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files\LLVM\bin

@stefnotch
Copy link
Author

That seems correct, I do need to install LLVM, since https://github.com/nathanwhit/libuv-sys-lite depends on bindgen, which depends on clang/LLVM https://rust-lang.github.io/rust-bindgen/requirements.html .

There doesn't seem to be an easy way of improving this, since libuv has some platform specific headers. So if one wants to pre-generate the generated bindings, one has to generate it for Windows and Linux at the very least.

Alternatively, one could provide a development flag to exclude the libuv dependency from Deno.

Though the most important step is simply to update the instructions on how to build Deno from source https://docs.deno.com/runtime/contributing/building_from_source/#windows
(Also, I did not need the protobuf compiler to build Deno? Is that part of the instructions outdated?)

@dsherret
Copy link
Member

dsherret commented Jan 5, 2025

Though the most important step is simply to update the instructions on how to build Deno from source https://docs.deno.com/runtime/contributing/building_from_source/#windows

Yes, the repo is here: https://github.com/denoland/docs

Though IMO it’s bad that the instructions are in a separate repo because they get out of date more easily. Related: denoland/website_feedback#71 (comment)

@dsherret dsherret closed this as completed Jan 5, 2025
@dsherret dsherret changed the title Cannot build on Windows Cannot build on Windows due to missing clang dlls Jan 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants