[Scons-users] FW: how to execute Clang static analyzer perl script instead of gcc.exe on Mingw/MSYS
William Deegan
bill at baddogconsulting.com
Thu Apr 11 21:49:39 EDT 2013
Dennis,
On 04/11/2013 05:06 PM, Dennis Cote wrote:
>
> Hi,
>
> I'm using SCONS to build some C code. So far it seems to be working
> well executing gcc.exe from the /mingw/bin directory in an MSYS shell.
>
> Now I need to have it send the same commands to a perl script,
> ccc-analyzer, used by the Clang static analyzer to interpose itself
> into a build. I tried adding CC='ccc-analyzer' to the construction
> environment and it generates what seems to be the correct command
> lines, with the command beginning with ccc-analyzer instead of gcc,
> but the commands fail with the following error:
>
> 'ccc-analyzer' is not recognized as an internal or external command,
>
> operable program or batch file.
>
> For comparison here are the first command lines generated with and
> without CC='ccc-analyzer'.
>
> ccc-analyzer -o build\DXL\GoAheadWeb\asp.o -c -Wall -include builtin.h
> -I. -DNU_MMU_MODE=0 -DNU_MODULE_SUPPORT=1 -DNU_SUPERV_USER_MODE=1
> -DNU_DEBUG=1 -DXL_DEBUG_ENABLE=1 -DDXLIO_METHOD=DXLIO_TELNET
> -DENDIAN=0 -DNUDEBUG_MEMORY -D_SH4 -DUEMF -DWEBS -DNUCLEUS_NET
> -Ibuild\DXL\GoAheadWeb -Ibuild\ATI -Ibuild\DXL\Intercom\hdr
> -Ibuild\ATI\plus build\DXL\GoAheadWeb\asp.c
>
> gcc -o build\DXL\GoAheadWeb\asp.o -c -Wall -include builtin.h -I.
> -DNU_MMU_MODE=0 -DNU_MODULE_SUPPORT=1 -DNU_SUPERV_USER_MODE=1
> -DNU_DEBUG=1 -DXL_DEBUG_ENABLE=1 -DDXLIO_METHOD=DXLIO_TELNET
> -DENDIAN=0 -DNUDEBUG_MEMORY -D_SH4 -DUEMF -DWEBS -DNUCLEUS_NET
> -Ibuild\DXL\GoAheadWeb -Ibuild\ATI -Ibuild\DXL\Intercom\hdr
> -Ibuild\ATI\plus build\DXL\GoAheadWeb\asp.c
>
> The file ccc-analyzer is a perl script that passes the gcc arguments
> to the clang compiler for static analysis and then on to gcc to build
> the object files. It is found on the path as shown below. These
> command were executed from the same shell used to run scons.
>
> $ which ccc-analyzer
>
> /mingw/bin/ccc-analyzer
>
> $ which gcc
>
> /mingw/bin/gcc.exe
>
> Both command work from the shell command line as shown below.
>
> $ gcc --version
>
> gcc.exe (GCC) 4.7.2
>
> Copyright (C) 2012 Free Software Foundation, Inc.
>
> This is free software; see the source for copying conditions. There is NO
>
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
> PURPOSE.
>
> $ ccc-analyzer --version
>
> gcc.exe (GCC) 4.7.2
>
> Copyright (C) 2012 Free Software Foundation, Inc.
>
> This is free software; see the source for copying conditions. There is NO
>
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
> PURPOSE.
>
> The scons environment path imports the shell path as shown below.
>
> env = Environment(ENV = {'PATH' : os.environ['PATH']},
>
> tools = ['mingw'],
>
> CC='ccc-analyzer',
>
> CFLAGS=flags, CPPDEFINES=defs)
>
> One thing that is different between gcc and ccc-analyzer is that the
> gcc executable has a ".exe" extension which the perl script lacks.
> This can be seen in the which command output above. I suspect scons
> may be passing the commands to an shell that is expecting all commands
> to be implemented by *.exe (or *.com, or *.bat) files, and it can't
> find a ccc-analyzer.exe to run.
>
Bingo! It's likely using the cmd shell.
> Does anyone have any idea why scons can't run the ccc-analyzer script?
> More importantly, does anyone have an idea how to fix it so it can run
> this script?
>
How about:
CC="bash.exe cc-analyzer'
Assuming your mingw has a bash that's in your path?
?
-Bill
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://four.pairlist.net/pipermail/scons-users/attachments/20130411/7249ae05/attachment.htm>
More information about the Scons-users
mailing list