Issues Running Scan-build

Greetings,

Been a while since I emailed the list. Oddly enough I have run into an error with my scan-build installation it seems. I previously had it up and running for a project I was doing back in 2014, and that Fall was the last I touched it. I have come back to use it with the same build, nothing has changed on the machine I am using since 2014, and I am getting an error upon launching. Please see the first screenshot. I checked the scan-build perl file and it tells me that the getpwuid on line 35 is set to “Unknown.” Screenshot 2 has the info from the scan-build file. Screenshot 3 has the command I am inputting and the perl command it is switching too for the command line.

Any assistance would be much appreciated and I do apologize if I am mailing the wrong list, it has been a while.

clang_Screenshot 1.PNG

clang_Screenshot 2.PNG

clang_Screenshot 3.PNG

Hello Jonathan,

It seems like you are using an old version of scan-build. This issue should be fixed with commit 4415a4b58bd (https://github.com/llvm-mirror/clang/commit/4415a4b58bd561d85a7dff84f62778b675a98a09). I suggest you to update your scan-build to the newest version and check it again.

You can also try the newest Python version of scan-build (which is located in tools/scan-build-py).

And, BTW, '--user-analyzer' option in your cmdline should be corrected to '--use-analyzer'.

22.01.2016 00:32, Lockhart, Jonathan (lockhaja) via cfe-dev пишет:

Alexey,

Thanks for the input, that seems to have resolved the issue. Thanks for noticing that spelling error as well. Now that you mention it, and checking the change logs, I seem to remember that being an issue before, and I link I moved to a different use environment. In any case, I now get a message about the

C:\Users\lockhaja\build\tools\clang\tools\scan-build>perl -S scan-build -v -v -o “C:\Users\lockhaja_local\Desktop” --use-analyzer=C:\Users\lockhaja\build\bin\Debug\clang.exe gcc C:\main.c

The syntax of the command is incorrect.
scan-build: Using ‘C:/Users/lockhaja/build/bin/Debug/clang.exe’ for static analysis
scan-build: Emitting reports for this run to ‘C:/Users/lockhaja_local/Desktop/2016-01-21-1’.

‘C:/Users/lockhaja/build/tools/clang/tools/scan-build/ccc-analyzer’ is not recognized as an internal or external command, operable program or batch file.

scan-build: No bugs found.

I purposefully added a few bugs into the system, so I know scan-build should be locating those. Any thoughts on the “syntax of the command is incorrect” and “‘C:/Users/lockhaja/build/tools/clang/tools/scan-build/ccc-analyzer’ is not recognized as an internal or external command, operable program or batch file.” messages that have appeared? I did check and the ccc-analyzer file appears to be complete and correct.

Jonathan,

as I see from your command line, you are still using an old version of scan-build. Could you check if this problem is reproducible with the newest one?
AFAIR, you can use new scan-build with your clang so it is not necessary to build clang from repository.

22.01.2016 01:45, Lockhart, Jonathan (lockhaja) пишет:

Alexey,

I actually went and did an svn update on LLVM and clang so I am building them now with Visual Studio. I will let you know of the results.

As for using the new command is there anything different for the input stream to scan-build?

Regards,
Jon Lockhart

Alexey or Others,

So I did a fresh full build with the latest checkout of clang, LLVM, Visual Studio, and CMake. The ALL-BUILD completed successfully but unfortunately no where in the build repository do I see a command of scan-build-py. There is also no repository of build\tools\scan-build-py or build\tools\clang\tools\scan-build-py. I tried running the new version of the batch file for scan-build, located in build\bin, but unfortunately that fails, as the first line of that batch file just says perl -S scan-build, and there is nothing else in the file.

hey Jon,

i can say things a few words about the scan-build-py, because was my commit in the repo. :slight_smile: first of all, it is an initial commit. not yet a complete replacement of the scan-build (the one written in Perl). that’s the reason why it is not installed by any build target… but if you try it out and report your experience that’s helpful. (to “install” you need to put the tools/scan-build-py/bin dir into your PATH environment variable) it comes with a README.md file, which describes the usage.

regards,
Laszlo

Laszlo,

Thanks you for your response. So I noticed I did have to do a fresh build from scratch. Unfortunately there was an issue with my path so it was not picking up through python installation. That has since been corrected and CMake picked up python this time so it is currently building.

Now you say it will be in “tools/scan-build-py/bin”. Will this be in the build folder or the check out repository? In my previous build after updating I saw no usable scan-build file in those repositories in the build folder.

Regards,
Jon Lockhart

hey Jon,

as i mentioned earlier, the scan-build-py is not installed by any target. so, it will stay in your source/checkout repository. (and it will be change in the future when the implementation will be mature enough to release.) at this moment it’s self contained and not depend on anything, so you can copy that subdirectory wherever you like, just put the bin dir into your PATH.

regards,
Laszlo

Laszlo,

Excellent, then I shall utilize it from the checkout repository and add it to my path. Clang is finishing building now, so I will see how it works and how it compares to the Perl version. Still having some issues getting that version to launch as well.

Regards,
Jon Lockhart

Laszlo,

Even though I have built everything and have the proper Python, looks like I will be unable to use scan-build-py. I noticed from your read me that it currently does not work on Windows. Currently I develop in a Windows environment so I will be required to get the Perl version of scan-build running until that hurdle is crossed.