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

Byoungyoung Lee blee at gatech.edu
Mon Sep 24 22:36:46 PDT 2012


Hi Gordon,

Thanks for your suggestion! I've tried it with #!/bin/bash, but the
problem is still the same unfortunately.

Thanks,
Byoungyoung


On Mon, Sep 24, 2012 at 10:41 PM, Gordon Keiser <gkeiser at arxan.com> wrote:
> Hi (although I'm not Clang ;) ),
>
> The issue probably has to do with /bin/sh on Ubuntu not being Bash, but Dash instead.   Because of this, it doesn't support some extensions and can do weird things with the environment.   Try changing the shebang line in the script to #!/bin/bash and see if it helps.
>
> See this page for more details on why this is:
> https://wiki.ubuntu.com/DashAsBinSh
>
> Cheers,
> Gordon Keiser
> Software Development Engineer
> Arxan Technologies
>
>
>> -----Original Message-----
>> From: cfe-dev-bounces at cs.uiuc.edu [mailto:cfe-dev-bounces at cs.uiuc.edu]
>> On Behalf Of Byoungyoung Lee
>> Sent: Monday, September 24, 2012 10:26 PM
>> To: cfe-dev at cs.uiuc.edu Developers
>> Subject: [cfe-dev] ccc-analyzer sees the wiped out environment variables
>>
>> 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.
>>
>> ----
>> #!/bin/sh
>>
>> export CC="ccc-analyzer"
>> export CXX="ccc-analyzer"
>>
>> CLANG_PATH="--use-analyzer=/usr/local/bin/clang++"
>> 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
>>
>> Thanks,
>> Byoungyoung
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list