codechecker
codechecker copied to clipboard
Finding version-suffixed Clang analyzers from `PATH` not working, even with `CC_ANALYZERS_FROM_PATH=1`
Describe the bug The logic that finds version-suffixed Clang binaries (from self-built entities or from PPA) does not work, it just keeps saying
[WARNING][2022-05-21 11:20:28] {analyzer} [14955] <140279203762176> - analyzer_types.py:122 print_unsupported_analyzers() - Analyzer 'clang-tidy' is enabled but CodeChecker is failed to execute analysis with it: 'Failed to detect analyzer binary!'. Please check your 'PATH' environment variable and the 'config/package_layout.json' file!
CodeChecker version v6.19.1, installed from PyPI
To Reproduce Steps to reproduce the behaviour:
- Create a new Docker image,
apt install python3 python3-pip software-properties-common wget curl
- Install LLVM from PPA:
bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
- Ensure that Clang and Clang-Tidy is installed:
apt install clang-14 clang-tidy-14
(replace with latest non-rolling version number appropriately) -
which clang clang++ clang-tidy
returns "not found" -
which clang-14 clang++-14 clang-tidy-14
returns the binaries under/usr/bin
-
echo $PATH | grep "/usr/bin"
matches -
CC_ANALYZERS_FROM_PATH=yes CodeChecker check -b "clang++-14 -UNDEBUG -std=c++17 main.cpp" -o Reports
- It says analysers are not found.
Expected behaviour Pick up the only installed version of Clang in the current environment and run the analysis with it.
Desktop (please complete the following information)
- OS: Ubuntu 22.04 (in Docker)
Additional context
╰─ cat /usr/local/share/codechecker/config/package_layout.json
{
"runtime": {
"analyzers": {
"clangsa": "clang",
"clang-tidy": "clang-tidy"
},
"clang-apply-replacements": "clang-apply-replacements"
},
"ld_lib_path_extra" : [],
"path_env_extra" : []
}
While certainly if I have the right to install packages I would have the right to just edit this config file (and putting clang-14
and clang-tidy-14
in it makes the issue disappear), it is not always the case, and this just makes the PyPI package unusable in a restricted environment...