[cfe-dev] Trouble Using scan-build in Windows 7

Anna Zaks ganna at apple.com
Fri Jun 28 10:28:16 PDT 2013


+<p>By default scan-build searches for clang executables in ./ or ./bin paths relative to itself.
+Use --use-analyzer=[path to clang] option to explicitly provide path to your clang executables for scan-build:</p>
+
+<pre class="code_example">
+ scan-build <span class="code_highlight">--use-analyzer=</span>F:/llvm/Release+Asserts/bin/clang.exe make
+</pre>

This is applicable to all users, not only Windows. Is there a reason why Windows users would need this option more?

If not, I'd recommend documenting it with other generic options. Usually, we do prefer users to use clang that comes with the installation. If this is mainly for users who modify the analyzer, maybe we should include it in the developer manual section.

Cheers,
Anna.

On Jun 28, 2013, at 9:44 AM, Anton Yartsev <anton.yartsev at gmail.com> wrote:

>> Anton, 
>> 
>> Maybe we should add a page describing what it takes to run scan-build on Windows to the static analyzer website?
> Added "For Windows Users" section to scan-build.html, will become actual after '[PATCH][analyzer][review request] scan-build port for windows' patch gets in.
> Could you please give a feedback on it? Mainly worry about syntax.
>> 
>> Cheers,
>> Anna.
>> On Jun 17, 2013, at 9:34 PM, Anton Yartsev <anton.yartsev at gmail.com> wrote:
>> 
>>> On 18.06.2013 7:39, Lockhart, Jonathan (lockhaja) wrote:
>>>> Anton,
>>>> 
>>>> Well earlier today I uninstalled ActiveState perl for Strawberry perl and oddly enough I ran into the same error, "getpwuid function is unimplemented", which means that apparently it isn't just ActiveState perl that causes the problem.
>>>> 
>>>> Now I am surprised to hear you are using MinGW and that all I need is the MinGW installation with MSYS. I have that already installed, as I needed it for Eclipse with the C project I am working on, and it is already in my path. I also have the latest version of both llvm and clang from the trunk. I also added scan-build to my path. With all that I am still hitting the error I emailed back today.
>>>> 
>>>> Now I have not tried the example you provided so I will give that a shot and be sure to provide it the build folder for clang.exe and see if that takes care of the problem. Only other thing I can figure is that scan-build can't find MinGW on my path though it is there.
>>>> 
>>>> I have also checked the MinGW\msys folder, and there is no perl in the bin folder.
>>> Tried to install MinGW from the latest installer mingw-get-inst-20120426.exe (http://sourceforge.net/projects/mingw/files/)
>>> Found out that "MinGW Developer Toolkit" component should be selected during installation to have perl installed at \MinGW\msys\1.0\bin\
>>> 
>>>> 
>>>> Looks like I still got a bunch of problems left to figure out.
>>>> 
>>>> Regards,
>>>> Jon
>>>> 
>>>> From: Anton Yartsev [anton.yartsev at gmail.com]
>>>> Sent: Monday, June 17, 2013 11:09 PM
>>>> To: Lockhart, Jonathan (lockhaja)
>>>> Cc: Jordan Rose; cfe-dev Developers
>>>> Subject: Re: Trouble Using scan-build in Windows 7
>>>> 
>>>> On 16.06.2013 20:36, Lockhart, Jonathan (lockhaja) wrote:
>>>>> Anton and Jordon,
>>>>> 
>>>>> So I got scan-build to fire off, and when I do it does another command with perl -S in front of it. Now I did not have perl originally install on my machine but since have gone and grabbed a copy of perl and installed it. Now when I run the scan-build command I get this error:
>>>>> 
>>>>> C:\Users\lockhaja\llvm\tools\clang\tools\scan-build>perl -S scan-build
>>>>> The getpwuid function is unimplemented at scan-build line 35.
>>>>> 
>>>>> Now Patrik on the LLVM list point out this article to me: 
>>>>> http://lists.cs.uiuc.edu/pipermail/cfe-dev/2010-April/008659.html
>>>>> 
>>>>> I read through it and believe I may be using the ActiveState perl which appears not to work with scan-build. This would mean I would have to go grab another version. I am curious to know if I would have to perform all this changes that were described further in the digest, as I am on 7 not XP, and I would feel that the Static Analyzer has progressed since 2010 and its building on Windows.
>>>>> 
>>>>> I would be very interested in knowing your set up Anton.
>>>> Now I see that it was a good idea to try MinGW first :)
>>>> I got the same error "getpwuid function is unimplemented" when tried to launch scan-build with ActiveState perl. Then I switched to perl from my MinGW+MSYS installation, and after little changes in scripts scan-build worked for me. I never tried to launch scan-build with Cygwin. 
>>>> Clang repository (http://llvm.org/svn/llvm-project/cfe/trunk) holds the changes, allowing to use scan-build with MinGW+MSYS, since the revision 180905.
>>>> 
>>>> Theoretically all you should do to get scan-build work is:
>>>> 1) install MinGW+MSYS, get scan-build from http://llvm.org/svn/llvm-project/cfe/trunk
>>>> 2) add the path to scan-build to your PATH environment variable
>>>> 3) provide --use-analyzer=[Xcode|path to clang] option to scan-build
>>>> 
>>>> Here is a random example of how I use scan-build:
>>>> for configuring:
>>>> scan-build -v -v -v -o "./" --use-analyzer=F:/llvm_COMMON/-Eclipse_build-/Release+Asserts/bin/clang.exe ../configure DISABLE_ASSERTIONS=1
>>>> 
>>>> for making:
>>>> scan-build -v -v -v -o "./" --use-analyzer=F:/llvm_COMMON/-Eclipse_build-/Release+Asserts/bin/clang.exe make DISABLE_ASSERTIONS=1
>>>> 
>>>> -o "./" forces scan-build to put reports to the current folder
>>>> DISABLE_ASSERTIONS=1 is a command passed to the configure/make, not scan-build
>>>> 
>>>> Hope that helps.
>>>> 
>>>>> Regards,
>>>>> Jon
>>>>> 
>>>>> From: Anton Yartsev [anton.yartsev at gmail.com]
>>>>> Sent: Thursday, June 06, 2013 9:29 PM
>>>>> To: Lockhart, Jonathan (lockhaja)
>>>>> Cc: Jordan Rose; cfe-dev Developers
>>>>> Subject: Re: Trouble Using scan-build in Windows 7
>>>>> 
>>>>> On 07.06.2013 5:24, Anton Yartsev wrote:
>>>>>> Hi  Jonathan,
>>>>>> 
>>>>>> To use the scan-build you should get the contents of clang\tools\scan-build from Clang sources as Jordan pointed out.
>>>>>> Currently the scan-build script expects the clang executables (clang.exe and clang++.exe) to live in ./clang or ./bin/clang
>>>>> mistake, ./ or ./bin
>>>>>> directory relative to directory with the scan-build stuff but you can use the --use-analyzer=[Xcode|path to clang] scan-build option to tell scan-build where your clang executables live.
>>>>>> The last thing you should do is to add the path to scan-build to your PATH and then you should be able to use scan-build as it described in http://clang-analyzer.llvm.org/scan-build.html.
>>>>>> Hope I've not missed something.
>>>>>> Feel free to ask and point to problems.
>>>>>> 
>>>>>>> No, cfe-dev is the appropriate list for questions. (Or cfe-users, but to be honest we analyzer folks don't follow that list much and you probably wouldn't have gotten an answer there!)
>>>>>>> 
>>>>>>> scan-build is not installed with Clang or LLVM; I believe when the analyzer project first began it wasn't clear if everyone would want it as a part of their default install. You can find the executables in tools\scan-build under your Clang source directory (probably llvm\tools\clang.)
>>>>>>> 
>>>>>>> I've CC'd Anton Yartsev, who I know has been running scan-build on Windows for some time. (Not sure which version, though.)
>>>>>>> Jordan
>>>>>>> 
>>>>>>> 
>>>>>>> On Jun 3, 2013, at 14:13 , "Lockhart, Jonathan (lockhaja)" <lockhaja at mail.uc.edu> wrote:
>>>>>>> 
>>>>>>>> Hello Clang Users and Developers,
>>>>>>>> 
>>>>>>>> I apologize in advance if this is going to the wrong email list, but I thought it would be inappropriate to send it to the dev list. 
>>>>>>>> 
>>>>>>>> I am currently working on using Clang and LLVM in some research I am doing. More specifically at this time I am trying to use the Clang Static Analysis Tool. I have been able to follow the instructions on the Static Analysis Tool site as well as the LLVM page for compiling the code with Cmake for use with Visual Studio, and I have successfully built the system using "ALL_BUILD" as well as have testing successfully clang by build "clang-test" in visual studio. 
>>>>>>>> 
>>>>>>>> With that said I seem to be able to find the bin file from which all the material from the system was installed. Following the directions, I would believe it to be located in the \bin directory under build but it is not there. I have also search my llvm and build directories with no mention of scan-build being found via inspection or search. 
>>>>>>>> 
>>>>>>>> I was wondering if the instructions online were outdated and a newer process for running the Clang Static Analyzer was now used? Is the project even still active and worth me using in the development of my C programs? Is there now a way to use the tool from an IDE on the code you have written, such as through Eclipse or Visual Studio?
>>>>>>>> 
>>>>>>>> These are the questions I currently have as I am stuck after building and testing via the instructions found here:http://clang.llvm.org/get_started.html#build. Any assistance would be most appreciative.
>>>>>>>> 
>>>>>>>> Regards,
>>>>>>>> Jon Lockhart
>>>>>>>> PhD Candidate - EE Systems
>>>>>>>> IEEE Vice President 13/14
>>>>>>>> University of Cincinnati
>>>>>>>> lockhaja at mail.uc.edu
>>>>>>>> _______________________________________________
>>>>>>>> cfe-commits mailing list
>>>>>>>> cfe-commits at cs.uiuc.edu
>>>>>>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> -- 
>>>>>> Anton
>>>>> 
>>>>> 
>>>>> -- 
>>>>> Anton
>>>> 
>>>> 
>>>> -- 
>>>> Anton
>>> 
>>> 
>>> -- 
>>> Anton
>>> _______________________________________________
>>> cfe-dev mailing list
>>> cfe-dev at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>> 
> 
> 
> -- 
> Anton
> <scan-build-win-users-html_v1.patch>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20130628/4302fcda/attachment.html>


More information about the cfe-dev mailing list