[cfe-dev] Trying to use CLang / CLang Static Analyzer under Windows XP SP3 32-bit

TP wingusr at gmail.com
Fri Apr 9 01:44:20 PDT 2010


I'm trying to get CLang to run so that I can try out the CLang Static Analyzer.

I followed the instructions given in the "Using Visual Studio" section
of http://clang.llvm.org/get_started.html.

The ALL_BUILD Project built fine in Visual Studio 2008.

But when I try the first example I get:

>clang t.c
clang: error: unable to execute command: program not executable
clang: error: assembler command failed due to signal 1 (use -v to see
invocation)

>clang -v t.c
clang version 1.5 (trunk 100852)
Target: i686-pc-win32
Thread model: posix
 "C:/llvm/bin/Debug/clang.exe" -cc1 -triple i686-pc-win32
-S -disable-free -main-file-name t.c -mrelocation-model static
-mdisable-fp-elim -mconstructor-aliases -v -resource-dir
C:/llvm/bin/lib/clang/1.5 -ferror-limit 19 -fmessage-length 80
-fms-extensions -fgnu-runtime -fdiagnostics-show-option
-fcolor-diagnostics -o C:/Temp/cc-000000.s -x c t.c
clang -cc1 version 1.5 based upon llvm 2.7svn hosted on i686-pc-win32
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/usr/include"
#include "..." search starts here:
#include <...> search starts here:
 C:/llvm/bin/lib/clang/1.5/include
 C:\Program Files\Microsoft Visual Studio 9.0\VC\include
 C:\Program Files\Microsoft SDKs\Windows\v6.0A
End of search list.
 "gcc" -v -c -o C:/Temp/cc-000001.o -x assembler C:/Temp/cc-000000.s
clang: error: unable to execute command: program not executable
clang: error: assembler command failed due to signal 1 (use -v to see
invocation)

I don't really want to use gcc (I happen to have cygwin installed, but
gcc is called gcc-3.exe or gcc-4.exe in cygwin\bin.)

I notice that the examples use the -cc1 option so I tried that:

>clang -cc1 t.c
In file included from t.c:1:
In file included from C:\Program Files\Microsoft Visual Studio
9.0\VC\include/stdio.h:22:
C:\Program Files\Microsoft Visual Studio
9.0\VC\include/crtdefs.h:574:9: error: unknown type name '__int64'
typedef __int64 __time64_t;     /* 64-bit time value */
        ^
In file included from t.c:1:
C:\Program Files\Microsoft Visual Studio
9.0\VC\include/stdio.h:268:77: error: unknown type name '__int64'
_Check_return_opt_ _CRTIMP int __cdecl _fseeki64(_Inout_ FILE * _File,
_In_ __int64 _Offset, _In_ int _Origin);
                                                                            ^
C:\Program Files\Microsoft Visual Studio
9.0\VC\include/stdio.h:269:24: error: unknown type name '__int64'
_Check_return_ _CRTIMP __int64 __cdecl _ftelli64(_Inout_ FILE * _File);
                       ^
C:\Program Files\Microsoft Visual Studio
9.0\VC\include/stdio.h:683:84: error: unknown type name '__int64'
_Check_return_opt_ _CRTIMP int __cdecl _fseeki64_nolock(_Inout_ FILE *
_File, _In_ __int64 _Offset, _In_ int _Origin);

   ^
C:\Program Files\Microsoft Visual Studio
9.0\VC\include/stdio.h:684:24: error: unknown type name '__int64'
_Check_return_ _CRTIMP __int64 __cdecl _ftelli64_nolock(_Inout_ FILE * _File);
                       ^
5 errors generated.

__int64 is a builtin VC++ keyword so it's not surprising that CLang
doesn't understand it.

but:

>clang -cc1 -D__int64=int t.c

doesn't produce any output?

>clang -cc1 -D__int64=int -v t.c
clang -cc1 version 1.5 based upon llvm 2.7svn hosted on i686-pc-win32
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/usr/include"
#include "..." search starts here:
#include <...> search starts here:
 C:/llvm/bin/lib/clang/1.5/include
 C:\Program Files\Microsoft Visual Studio 9.0\VC\include
 C:\Program Files\Microsoft SDKs\Windows\v6.0A
End of search list.

No .exe is produced?

Taking a look at C:\llvm\tools\clang\tools\scan-build\scan-build

I gather that it's a perl script. Any chance this is going to work
with cygwin perl (or better yet ActiveState Perl), assuming I figure
out the clang issues?



More information about the cfe-dev mailing list