scan-build: error: Cannot find an executable 'clang' relative to scan-build. Consider using --use-analyzer to pick a version of 'clang' to use for static analysis.

I’m a beginner of clang-analyzer. I got a problem when I execute command “scan-build make”:
scan-build: error: Cannot find an executable ‘clang’ relative to scan-build. Consider using --use-analyzer to pick a version of ‘clang’ to use for static analysis.

PS:I have compiled llvm+clang(with source code llvm 3.3). And I have added the two PATH:/home/zq/LLVM/llvm-3.3.src/tools/clang/tools/scan-view/:/home/zq/LLVM/llvm-3.3.src/tools/clang/tools/scan-build/:/home/zq/LLVM/build/Release+Asserts/bin/

Can anybody help me?

Hi! You can do this:

  1. export LLVM_BIN=/home/zq/LLVM/build/Release+Asserts/bin/
  2. scan-build --use-analyzer $LLVM_BIN/clang [other options to clang go here]

You may even want to put the 1st command in your ~/.bashrc file so that you don’t have to export LLVM_BIN each time you want to use it.

Regards,
Saheel.