I wanted to give my feeback regarding building cppcheck and cppcheck-gui from a new user perspective. I finally got the gui to build - hopefully successfully, but it required quite a bit of trial and error to get it right and this was not fully addressed in the github project info page.
My esperiences are a little unorganized and certainly incomplete here, but I wanted to capture and share them while they were fresh. Now that I have things working, I'll probaby just to a git pull and rebuild.
My windows 10 setup comprises:
QT
QT 5.13.1 with a Visual Studio 2017 toolchain (although I am using Visual Studio 2019 which has ABI compatibility).
my QT and Associated Visual Studio toolchain are installed in their default locations:
C:\Qt\5.13.1\
C:\Qt\5.13.1\msvc2017_64
Note I added the charts optional component, as I noticed that it was an optional component listed in the gui/CMakeLists.txt build option for the GUI project. It is not clear why this is required.
I already had the Extensions/Qt VS Tools plugin installed here, as I develop an internal application based on QT. I needed to use this as the qt build instructions above did not create it for me. The QT build instructions listed in the https://github.com/danmar/cppcheck repository page shown below did not work for me and also it is a bit confusing as the cmake instuctions mentioned above the qmake instructions indicate:
cmake
...
If you want to compile the GUI you can use the flag -DBUILD_GUI=ON
For rules support (requires pcre) use the flag -DHAVE_RULES=ON
For release builds it is recommended that you use: -DUSE_MATCHCOMPILER=ON
and then
qmake
You can use the gui/gui.pro file to build the GUI.
cd gui
qmake
make
Microsoft VCPKG package manager
I needed this to make sure that the dependencies for PCRE were successfully satisfied. After following the installation advice from https://github.com/microsoft/vcpkg it was simply a matter of typing vcpkg install pcre:x64-windows to download and build release and debug versoins of the pcre library. One interesting part of this is that these headers are made available system wide if the following vckpg option is run (it will prompt for admin privileges; presumably to install the headers somewhere globally accessible. The site says:
I needed to make sure that commas in the csv file were properly escaped and also the ID field was missing. Sometimes its easier to capture everything and filter the type of error in the CSV file. The ID field was ideal for this and was previously missing. Not sure if I should respect the "show ID" checkbox in the settings, probably not as that is just for the cppcheck GUI output not for the expot.
I just wanted to capture my diff between the current head of the master branch to show you that I needed to add the pcre components and I needed to manually modify the cppcheck.sln file to add in the gui project. Note that the gui x64 settings are not quite correct as the pcre x64 library (imported from vcpkg is pcre.lib and not pcre64.lib - strange but I wanted to make you aware of this discrepancy.
Mi misra experience was not the best but eventually I got it to work. Not sure if there is some issue with the setup but initially I did not have python installed and I was unable to save the misra checkbox or the clang settings until I installed python,
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks for this detailed feedback (and sorry for such a late reply).
For testing / development even on Windows I use Qt with Qt Creator for the GUI. I have never tried to build it with Visual Studio. I do not know how the other developers build the GUI.
Regarding the CSV export:
There seem to be different types of format that are used for CSV.
And there is an RFC: https://tools.ietf.org/html/rfc4180
There is an interesting discussion on stackoverflow: https://stackoverflow.com/questions/769621/dealing-with-commas-in-a-csv-file
I like the answer from Corey Trager who is referencing the RFC4180.
So, fields with a , should be enclosed by ". " in fields must be escaped with another " then.
I guess this would be a good solution.
Maybe you like to implement that and create a Pull Request on GitHub?
Regarding the MISRA addon:
Hmm, yeah it is a bit unlucky if one has to find out that Python is required.
The setup does not install Python and i guess this is not planned. It would make maintaining the Python versions installed on a system even harder.
I think it should maybe be communicated to the user in a better way that Python is required to run the addons. A good place would be the project file configuration window where the addons can be enabled i guess.
I will create a ticket if there is not already one.
Would that be acceptable or can you imagine a better place / way to tell the user about the Python requirements?
Last edit: versat 2019-11-05
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I wanted to give my feeback regarding building cppcheck and cppcheck-gui from a new user perspective. I finally got the gui to build - hopefully successfully, but it required quite a bit of trial and error to get it right and this was not fully addressed in the github project info page.
My esperiences are a little unorganized and certainly incomplete here, but I wanted to capture and share them while they were fresh. Now that I have things working, I'll probaby just to a git pull and rebuild.
My windows 10 setup comprises:
QT
QT 5.13.1 with a Visual Studio 2017 toolchain (although I am using Visual Studio 2019 which has ABI compatibility).
my QT and Associated Visual Studio toolchain are installed in their default locations:
Note I added the charts optional component, as I noticed that it was an optional component listed in the
gui/CMakeLists.txtbuild option for the GUI project. It is not clear why this is required.From the https://github.com/danmar/cppcheck repository page, I tried to build the QT GUI
Visual Studio 2019 Community edition
I already had the Extensions/Qt VS Tools plugin installed here, as I develop an internal application based on QT. I needed to use this as the qt build instructions above did not create it for me. The QT build instructions listed in the https://github.com/danmar/cppcheck repository page shown below did not work for me and also it is a bit confusing as the cmake instuctions mentioned above the qmake instructions indicate:
and then
Microsoft VCPKG package manager
I needed this to make sure that the dependencies for PCRE were successfully satisfied. After following the installation advice from https://github.com/microsoft/vcpkg it was simply a matter of typing vcpkg install pcre:x64-windows to download and build release and debug versoins of the pcre library. One interesting part of this is that these headers are made available system wide if the following vckpg option is run (it will prompt for admin privileges; presumably to install the headers somewhere globally accessible. The site says:
Issues with the code
I needed to make sure that commas in the csv file were properly escaped and also the ID field was missing. Sometimes its easier to capture everything and filter the type of error in the CSV file. The ID field was ideal for this and was previously missing. Not sure if I should respect the "show ID" checkbox in the settings, probably not as that is just for the cppcheck GUI output not for the expot.
I just wanted to capture my diff between the current head of the master branch to show you that I needed to add the pcre components and I needed to manually modify the cppcheck.sln file to add in the gui project. Note that the gui x64 settings are not quite correct as the pcre x64 library (imported from vcpkg is pcre.lib and not pcre64.lib - strange but I wanted to make you aware of this discrepancy.
Misra
Mi misra experience was not the best but eventually I got it to work. Not sure if there is some issue with the setup but initially I did not have python installed and I was unable to save the misra checkbox or the clang settings until I installed python,
Thanks for this detailed feedback (and sorry for such a late reply).
For testing / development even on Windows I use Qt with Qt Creator for the GUI. I have never tried to build it with Visual Studio. I do not know how the other developers build the GUI.
Regarding the CSV export:
There seem to be different types of format that are used for CSV.
And there is an RFC: https://tools.ietf.org/html/rfc4180
There is an interesting discussion on stackoverflow:
https://stackoverflow.com/questions/769621/dealing-with-commas-in-a-csv-file
I like the answer from Corey Trager who is referencing the RFC4180.
So, fields with a
,should be enclosed by"."in fields must be escaped with another"then.I guess this would be a good solution.
Maybe you like to implement that and create a Pull Request on GitHub?
Regarding the MISRA addon:
Hmm, yeah it is a bit unlucky if one has to find out that Python is required.
The setup does not install Python and i guess this is not planned. It would make maintaining the Python versions installed on a system even harder.
I think it should maybe be communicated to the user in a better way that Python is required to run the addons. A good place would be the project file configuration window where the addons can be enabled i guess.
I will create a ticket if there is not already one.
Would that be acceptable or can you imagine a better place / way to tell the user about the Python requirements?
Last edit: versat 2019-11-05
I have created ticket https://trac.cppcheck.net/ticket/9456 suggesting a better communication about the Python requirement for the addons.