Skip to content

Clangd, clang-format, and clang-tidy are required to be in distribution since 1.4.0 #481

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

Open
scasagrande opened this issue Apr 14, 2025 · 5 comments

Comments

@scasagrande
Copy link
Contributor

scasagrande commented Apr 14, 2025

Problem

Updating from 1.3.0 to 1.4.0 requires an llvm distribution that contains clangd, clang-format, and clang-tidy

Example error output:

ERROR: /home/runner/.cache/bazel/_bazel_runner/05e35152b9f4d639f0caf72c58272633/sandbox/processwrapper-sandbox/1/execroot/_main/_tmp/20b0fbcfb3bd545ee034011c9840c284/_bazel_runner/3a2f3221680ba9580bde03029baa3e75/external/rules_rust++i+rules_rust_tinyjson/BUILD.bazel:4:37: Compiling Rust (without process_wrapper) rlib tinyjson (4 files) [for tool] failed: missing input file '@@toolchains_llvm++llvm+llvm_toolchain//:bin/clang-format'
ERROR: /home/runner/.cache/bazel/_bazel_runner/05e35152b9f4d639f0caf72c58272633/sandbox/processwrapper-sandbox/1/execroot/_main/_tmp/20b0fbcfb3bd545ee034011c9840c284/_bazel_runner/3a2f3221680ba9580bde03029baa3e75/external/rules_rust++i+rules_rust_tinyjson/BUILD.bazel:4:37: Compiling Rust (without process_wrapper) rlib tinyjson (4 files) [for tool] failed: missing input file '@@toolchains_llvm++llvm+llvm_toolchain//:bin/clang-tidy'
ERROR: /home/runner/.cache/bazel/_bazel_runner/05e35152b9f4d639f0caf72c58272633/sandbox/processwrapper-sandbox/1/execroot/_main/_tmp/20b0fbcfb3bd545ee034011c9840c284/_bazel_runner/3a2f3221680ba9580bde03029baa3e75/external/rules_rust++i+rules_rust_tinyjson/BUILD.bazel:4:37: Compiling Rust (without process_wrapper) rlib tinyjson (4 files) [for tool] failed: missing input file '@@toolchains_llvm++llvm+llvm_toolchain//:bin/clangd'
ERROR: /home/runner/.cache/bazel/_bazel_runner/05e35152b9f4d639f0caf72c58272633/sandbox/processwrapper-sandbox/1/execroot/_main/_tmp/20b0fbcfb3bd545ee034011c9840c284/_bazel_runner/3a2f3221680ba9580bde03029baa3e75/external/rules_rust++i+rules_rust_tinyjson/BUILD.bazel:4:37: Compiling Rust (without process_wrapper) rlib tinyjson (4 files) [for tool] failed: 3 input file(s) do not exist

Likely cause

#463

Prior to this pr, clang-format and clang-tidy were available via @llvm_toolchain_llvm//:bin/clang-format and @llvm_toolchain_llvm//:bin/clang-tidy, but were not requirements.

Discussion

If this is what we want, we should update document this and update some common "slimmer" llvm distributions, such as:

@fmeum
Copy link
Member

fmeum commented Apr 14, 2025

Instead of documenting additional requirements, we should probably just make the logic at

for tool_name, symlink_name in tools.items():
rctx.symlink(llvm_dist_rel_path + "bin/" + tool_name, tools_path_prefix + symlink_name)
symlinked_tools_str = "".join([
"\n" + (" " * 8) + "\"" + tools_path_prefix + symlink_name + "\","
for symlink_name in tools.values()
])
more intelligent by testing for existence. Would you be interested in sending a PR for this?

@scasagrande
Copy link
Contributor Author

Sure, I'll take a look this week

@darkrift
Copy link

@scasagrande have you had time to check this out ? We just faced this issue last week because we also use static-clang from dzbarsky.

While static-clang has a trick to add empty binaries in their archive, this would be an even better fix so that the tools are dynamic according to the pulled distribution

@scasagrande
Copy link
Contributor Author

Here was my first attempt, but it doesn't work: #483

See the comments as to why

@scasagrande
Copy link
Contributor Author

scasagrande commented May 12, 2025

I'm actually a confused as to why clang-format and clang-tidy were added in #463 when they were previously accessible via @llvm_toolchain_llvm//:clang-format and @llvm_toolchain_llvm//:clang-tidy

filegroup(
name = "clang-tidy",
srcs = ["bin/clang-tidy"],
)
filegroup(
name = "clang-format",
srcs = ["bin/clang-format"],
)

and clangd should be accessible via the general export:

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

3 participants