-
Notifications
You must be signed in to change notification settings - Fork 62
clang-tidy is not found when installed in a custom path #19
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
Comments
Do you have --action_env specified? |
No, as far as I have set. Maybe my dependencies set that. I can check and get back to you |
I checked. I didn't specify that. I hope it can be fixed. I have found a hacky workaround to hot patch the clang_tidy path using go-task clang_tidy_path:
cmds:
- sed -i '/^clang-tidy "\$@"$/s|clang-tidy|{{.HOME}}/llvm/bin/clang-tidy -p {{.CWD}}|' {{.run_clang_tidy}}
preconditions:
- test -f {{.run_clang_tidy}}
vars:
run_clang_tidy: ./external/bazel_clang_tidy/clang_tidy/run_clang_tidy.sh
CWD:
sh: git rev-parse --show-toplevel
clang_tidy:
cmds:
- task: clang_tidy_path
- bazel build --config=tidy myproj I run [compile_commands.json] extractor before running clang_tidy: |
You need to set the PATH correctly, and specify action_env accordingly,
otherwise bazel will not find your custom tools. This is unrelated to this
repo.
…On Fri, May 6, 2022, 20:51 Amin Yahyaabadi ***@***.***> wrote:
I checked. I didn't specify that. I hope it can be fixed.
I have found a hacky workaround to hot patch the clang_tidy path using
go-task <https://taskfile.dev/#/>
clang_tidy_path:
cmds:
- sed -i '/^clang-tidy "\$@"$/s|clang-tidy|{{.HOME}}/llvm/bin/clang-tidy/|' {{.run_clang_tidy}}
preconditions:
- test -f {{.run_clang_tidy}}
vars:
run_clang_tidy: ./bazel-myproj/external/bazel_clang_tidy/clang_tidy/run_clang_tidy.sh
tidy:
cmds:
- task: clang_tidy_path
- bazel build --config=tidy myproj
—
Reply to this email directly, view it on GitHub
<#19 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABOYM5GBHIMD7IXTFSAVI3VIVSZNANCNFSM5VGDERXA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
My PATH variable is already set. What should I specify in action_env? I cannot find anything in the documentation. |
Here's the doc: https://docs.bazel.build/versions/main/command-line-reference.html#flag--action_env |
If you are on macOS, see bazelbuild/bazel#12049 |
We created a Here is the related blog if anyone is interested. |
This option allows the selection of a particular toolchain, including an hermetic one. See also: https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-gcc-install-dir Without this option, clang selects the latest toolchain installed on the system, which is not necessarily the one used to build the code and can lead to inconsistencies. This patch is related to issue erenon#19
This option allows the selection of a particular toolchain, including an hermetic one. See also: https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-gcc-install-dir Without this option, clang selects the latest toolchain installed on the system, which is not necessarily the one used to build the code and can lead to inconsistencies. This patch is related to issue #19
Uh oh!
There was an error while loading. Please reload this page.
clang-tidy is not found in run_clang_tidy.sh although it is on the PATH. It seems that the spawn doesn't pass the env variables.
bazel_clang_tidy/clang_tidy/run_clang_tidy.sh
Line 14 in 783aa52
The text was updated successfully, but these errors were encountered: