[cfe-dev] ccc-analyzer sees the wiped out environment variables

Byoungyoung Lee blee at gatech.edu
Mon Sep 24 19:25:44 PDT 2012

Hello Clang,

While running scan-build, ccc-analyzer (line 45) sets $Clang from
$ENV{'CLANG_CXX'} and checks its validity by whether its defined or
not. Since $ENV{'CLANG_CXX'} happens to have an empty string on my
machine (ubuntu 12.04, bash shell, perl v5.14), $Clang is not
initialized properly, which eventually causes the scan-build to fail.
Note that $ENV{'CLANG_CXX'} was set from scan-build properly, and I'm
not sure why environment variables are wiped out.

Once I changed the ccc-analyzer as follows, it works fine. I'm
wondering this is the platform dependent errors or I'm using the wrong
options for scan-build (also attached below).

$ svn diff ccc-analyzer
Index: ccc-analyzer
--- ccc-analyzer	(revision 164557)
+++ ccc-analyzer	(working copy)
@@ -43,7 +43,7 @@
   if (!defined $Compiler) { $Compiler = $DefaultCXXCompiler; }

   $Clang = $ENV{'CLANG_CXX'};
-  if (!defined $Clang) { $Clang = 'clang++'; }
+  if (!defined $Clang || $Clang eq "") { $Clang = 'clang++'; }
 else {
   $Compiler = $ENV{'CCC_CC'};

Here's my scripts for running scan-build.


export CC="ccc-analyzer"
export CXX="ccc-analyzer"

VERBOSE="-v -v"

echo "------------------------------------------"
echo "[*] scan-build ../configure"
echo "------------------------------------------"
scan-build $CLANG_PATH ../configure --enable-debug --disable-optimize

echo "------------------------------------------"
echo "[*] scan-build make"
echo "------------------------------------------"
scan-build $VERBOSE $CLANG_PATH make


More information about the cfe-dev mailing list