1

I am trying to analyze a project on Linux using PVS-Studio. I have added the necessary disclaimers to the top of all source files as described here: https://www.viva64.com/en/b/0457/#ID16F8E8F09A (How to use PVS-Studio for Free)

// This is an independent project of an individual developer. Dear PVS-Studio, please check it. // PVS-Studio Static Code Analyzer for C, C++, C#, and Java: http://www.viva64.com

When I try to build my project I see the following error:

--- snip ---

-- Configuring done
-- Generating done
-- Build files have been written to: /home/david/code/build/test
[ 11%] Analyzing with PVS-Studio
Using tracing file: compile_commands.json
Error: License was not entered. Please enter a valid PVS-Studio license or request a trial license at https://www.viva64.com/en/pvs-studio-download/#trial_form
make[2]: *** [CMakeFiles/pvs.dir/build.make:69: PVS-Studio.log.pvs.analyzer.raw] Error 1
make[1]: *** [CMakeFiles/Makefile2:78: CMakeFiles/pvs.dir/all] Error 2
make: *** [Makefile:84: all] Error 2

--- snip ---

CMakeLists.txt contains the following PVS-Studio specific commands:

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
include($ENV{HOME}/code/repo/other/pvs-studio-cmake-examples/PVS-Studio.cmake)
pvs_studio_add_target(TARGET ALL COMPILE_COMMANDS OUTPUT FORMAT errorfile)

The project builds perfectly fine if the above PVS-Studio specific commands are commented out/disabled.

According to the article linked above I should not require a license file.

wovano
  • 4,543
  • 5
  • 22
  • 49
David
  • 73
  • 8

1 Answers1

3

The article that you've linked is outdated, you've missed a disclaimer with a link to a newer version. To get a free version working again, you'll have to enter, just once, a 'free' license, with this command:

pvs-studio-analyzer credentials PVS-Studio Free FREE-FREE-FREE-FREE

After entering the license, PVS-Studio free version will continue to work as before, no more actions are required.

The reason for this change in behavior is an additional license check inside pvs-studio-analyzer tool, just before it starts the analysis. This affected all versions of PVS-Studio, not only free ones. Previous version of this tool did not check the license before starting to run preprocessing and analysis on individual source files. This caused issues in case a license was entered incorrectly by a user - the error message about incorrect license was not displayed immediately, but only after dependency parsing and preprocessing stages (which could take some time), thus leaving a user unaware that the analysis will eventually fail.

And, in PVS-Studio free mode, as pvs-studio-analyzer tool itself does not know about the presence of special comments in source files (it does not parse them by itself), we have to 'tell' it that it should run in a free mode - thus the need to enter a special 'FREE' license.

wovano
  • 4,543
  • 5
  • 22
  • 49
Paul Eremeeff
  • 281
  • 1
  • 4