What happens when you open this project (test1.cppcheck) and analyze it? Do you see the warning? This file should be created: test1-cppcheck-build-dir/test1.a1 does that contain the warning?
Last edit: Daniel Marjamäki 2020-09-12
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Looks like I'm having the same problem. Every time I try to select the path for the addons (exe or rules) it defaults to the C drive, as if it can't see my current addon folder location. Could the installation location be an issue? I tried it with quotes around the paths, but that doidn't help either.
The Summary for that one error is:
Id: internalError
Bailing out from checking test1.c since there was an internal error: Failed to execute addon (command: '"F:\Program Files\Python38\python.exe" "F:\Program Files\Cppcheck\addons\misra.py" --cli --rule-texts=F:/Program Files/Cppcheck/addons/misra-c-2012.txt F:\\test1-cppcheck-build-dir\test1.a1.dump')
I notice that the last path uses a double-backslash: F:\\. Is this intentional? It doesn't show in the final post so I changed it from 2 to 4 for emphasis. It only appears when pasting and editing.
Last edit: Bassam Abdul-Baki 2020-09-12
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I placed my rules in a path with no spaces, it works fine. It is the space that is causing the problem. Unfortunately, the default location on Windows is "Program Files" and I tend to keep the rules in the addon folder under it.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It seems that you set incorrect path to Python interpreter. You should set path to executable (probably Python.exe), not to the directory with interpreter.
I'have an error similar than Bassan's, after linking the python.exe in the CppCheck addons mask, and following the Daniel's suggest I receive this log error:
Bailing out from checking test1.c since there was an internal error: Failed to execute addon (command: '"C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\python.exe" "C:\Program Files\Cppcheck\addons\misra.py" --cli D:\WORK\COMES\TestPyton\CppCheckTest\test1-cppcheck-build-dir\test1.a1.dump')
I installed the CppCheck for windows (2.1 version) using the installer file (cppcheck-2.1-x64-Setup.msi) then I downloaded the zip file from the repository in order to obtain the addons.
After the installation of the CppCheck (with the installer) I had to copy the addons folder from zip file in the folder where CppCheck is installed (C:\Program Files\Cppcheck\addons).
Is it the right procedure to install CppChec with its addons in windows?
Is it the right procedure to install CppChec with its addons in windows?
The proper procedure to install the addons is to use the installer. In one of the first steps a list is shown where you select what features to install, and in that list "addons" is not selected by default as far as I remember you have to click that.
when we added the checkbox the addons feature was more a "exotic" feature.
I believe this is changed in cppcheck-2.2.. addons are installed by default.
EDIT: No addons is not installed by default. I will try to fix that before cppcheck-2.2 release.
Last edit: Daniel Marjamäki 2020-09-13
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I confirm you that with your last release the addon work fine!
I tried to uninstall the CppChek 2.1 and reinstall it checking the addons during the installation, but this didn't work. I have to add that at the installation finish with the same version I didn't receive the message for restart the pc, so I don't know if the installation was correcttly.
However with the installing your new last version 2.2, at moment the misra addon seems work. I report here the warning that I receive with your previously simple test (test1.c):
misraviolation(use--rule-texts=<file> to get proper output)
My next step will be test the misra check with a misra.txt rules file.
Thank you so much!
Claudio
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm using the "Cppcheck-2.4.1" version on Windows 10 and I got the following error when runing Misra checking.
Bailing out from checking src\Debug.c since there was an internal error: Failed to execute addon (command: 'python.exe "C:\Program Files\Cppcheck\addons\misra.py" --cli --rule-texts=C:/Program Files/Cppcheck/addons/misra_rules.txt E:\cppcheck\misra_check-cppcheck-build-dir\Debug.a1.dump')
I tried to run the command (displayed in the error message) on CLI and got the error as below:
E:\cppcheck\src>python.exe "C:\Program Files\Cppcheck\addons\misra.py" --cli --rule-texts=C:/Program Files/Cppcheck/addons/misra_rules.txt E:\cppcheck\misra_check-cppcheck-build-dir\Debug.a1.dump
Fatal error: file is not found: C:\Program
After checking the error message I suppose there is error in the command created by the GUI tool which is related to the path of Misra rule text file.
So I tried to modify it and successfully got the information of Misra rules on CLI as shown below.
E:\cppcheck\src>python.exe "C:\Program Files\Cppcheck\addons\misra.py" --cli --rule-texts="C:\Program Files\Cppcheck\addons\misra_rules.txt" E:\cppcheck\misra_check-cppcheck-build-dir\Debug.a1.dump
{"column": 0, "severity": "style", "file": "src/base_types.h", "extra": "Required", "linenr": 41, "message": "Expressions resulting from the expansion of macro parameters shall be enclosed in parentheses", "errorId": "c2012-20.7", "addon": "misra"}
{"column": 0, "severity": "style", "file": "src/base_types.h", "extra": "Required", "linenr": 42, "message": "Expressions resulting from the expansion of macro parameters shall be enclosed in parentheses", "errorId": "c2012-20.7", "addon": "misra"}
{"column": 0, "severity": "style", "file": "src/base_types.h", "extra": "Required", "linenr": 12, "message": "#define and #undef shall not be used on a reserved identifier or reserved macro name", "errorId": "c2012-21.1", "addon": "misra"}
Duong, I had the same problem. If you add a Python path and a Misra file without spaces in the path, it should work. For the life of me, I can't get it to work with spaces, even if I use quotes or double-quotes around the file paths.
Last edit: Bassam Abdul-Baki 2021-05-15
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Bassam, thank you very much. The GUI works well when I change the path of Misra file without spaces. But it will be more convenient if the GUI can be fixed to deal with this issue in the upcoming version.
Thanks guys for the great tool.
BTW, I'm trying to install the cppcheclipse on Eclipse but always get the error of "No repository found at https://dl.bintray.com/cppcheclipse/p2/updates/"
Which thread can I post this issue?
Thanks.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Duong, I stand corrected. I have a huge program that I let run over night last night. It would seem that out of 730 files, 377 of them had misra-c2012 warnings and 255 of them had the internalError warning with no overlap. 98 files had neither which I find unusual. I know of at least one file that should have a misra-c2012 warning, but ended up with the internalError. Running that file by itself works. So there is still an issue with Misra for the GUI.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I ran it in command-line and it looks promising. I wasn't able to run it on *.dump in Windows. It was looking for an actual filename. I added a batch file for all of them and piped them to a file. I'll check them out tomorrow.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It failed from the command line as well. What I did notice is that for the file that I'm interested in, the dump file created just for that file in its own project was way smaller (22219 lines) than the dump file created just for that file when included with the entire project (560963 lines). Yet somehow, the smaller dump file is capturing the necessary info.
Unfortunately, I cannot share the code or the dump files.
Commands used: For the Project
cppcheck --dump *.c (fails to capture anything for some files) For the Individual File
cppcheck --dump filename.c (captures errors and misra warnings when file above fails in project)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm using cppcheck 2.4.1 version. I have installed the addon and also set the preferences in the path. Yet I'm unable to generate the misra warnings in the GUI. I have attached the path that I have set in preference.
I'm able to get misra warnings only in command line by generating the dump and then running the python script manually for each file.
Thanks for the support
Without the Misra rules, you won't be able to see ANY of the Misra errors. You need to purchase the Misra rules for this to work.
That is not true.. without that you should see something like this:
I don't know. You configuration looks ok. Could we try with something simple..
put this code in a file called test1.c:
put this in test1.cppcheck in the same folder:
What happens when you open this project (test1.cppcheck) and analyze it? Do you see the warning? This file should be created:
test1-cppcheck-build-dir/test1.a1
does that contain the warning?Last edit: Daniel Marjamäki 2020-09-12
Looks like I'm having the same problem. Every time I try to select the path for the addons (exe or rules) it defaults to the C drive, as if it can't see my current addon folder location. Could the installation location be an issue? I tried it with quotes around the paths, but that doidn't help either.
The Summary for that one error is:
Id: internalError
Bailing out from checking test1.c since there was an internal error: Failed to execute addon (command: '"F:\Program Files\Python38\python.exe" "F:\Program Files\Cppcheck\addons\misra.py" --cli --rule-texts=F:/Program Files/Cppcheck/addons/misra-c-2012.txt F:\\test1-cppcheck-build-dir\test1.a1.dump')
I notice that the last path uses a double-backslash: F:\\. Is this intentional? It doesn't show in the final post so I changed it from 2 to 4 for emphasis. It only appears when pasting and editing.
Last edit: Bassam Abdul-Baki 2020-09-12
I made some fixes a few weeks ago.
https://github.com/danmar/cppcheck/commit/d23fd26ce0fb5e25cc1f1c13c7c87cf92511f564
https://github.com/danmar/cppcheck/commit/dc6f0740c11c30a6549f8b3f0d23787277418144
Would it be possible for you to install the nightly build and see if that works? Otherwise.. we will release cppcheck-2.2 in ~ 2-4 weeks.
EDIT: nightly build where a installer can be downloaded: https://github.com/danmar/cppcheck/actions?query=workflow%3Arelease-windows
Last edit: Daniel Marjamäki 2020-09-13
Without the Misra rules, I get the Misra warnings. With the Misra rules, I get the exact error with the double-backslash.
I think the nightly build solves the problem.
I placed my rules in a path with no spaces, it works fine. It is the space that is causing the problem. Unfortunately, the default location on Windows is "Program Files" and I tend to keep the rules in the addon folder under it.
I'm curious, does CPPCheck check the Misra rules after the analysis is completed or while it's being done?
Hello,
It seems that you set incorrect path to Python interpreter. You should set path to executable (probably Python.exe), not to the directory with interpreter.
See also my previous post.
Last edit: Georgiy Komarov 2020-09-12
Thank you everybody for your help!
Following the Daniel's suggest, I tryed to analyse the test1.c so as indicated. but my CppCheck dosen't report any warning.
In the file "test1.a" generated there is just this code:
Previously I tryed to edit the Python addon path complete with the Python.exe but I didin't obtain any different result.
Do you have any other suggest about my issue?
Thank you so much for your kindly support!
Just for an updating...
I'have an error similar than Bassan's, after linking the python.exe in the CppCheck addons mask, and following the Daniel's suggest I receive this log error:
Bailing out from checking test1.c since there was an internal error: Failed to execute addon (command: '"C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\python.exe" "C:\Program Files\Cppcheck\addons\misra.py" --cli D:\WORK\COMES\TestPyton\CppCheckTest\test1-cppcheck-build-dir\test1.a1.dump')
I installed the CppCheck for windows (2.1 version) using the installer file (cppcheck-2.1-x64-Setup.msi) then I downloaded the zip file from the repository in order to obtain the addons.
After the installation of the CppCheck (with the installer) I had to copy the addons folder from zip file in the folder where CppCheck is installed (C:\Program Files\Cppcheck\addons).
Is it the right procedure to install CppChec with its addons in windows?
Thank you again for your help,
Claudio
Last edit: Bindi Claudio 2020-09-12
The proper procedure to install the addons is to use the installer. In one of the first steps a list is shown where you select what features to install, and in that list "addons" is not selected by default as far as I remember you have to click that.
when we added the checkbox the addons feature was more a "exotic" feature.
I believe this is changed in cppcheck-2.2.. addons are installed by default.
EDIT: No addons is not installed by default. I will try to fix that before cppcheck-2.2 release.
Last edit: Daniel Marjamäki 2020-09-13
Would it be possible for you to install the nightly build and see if that works?
https://github.com/danmar/cppcheck/actions?query=workflow%3Arelease-windows
Thank you so much Daniel!
I confirm you that with your last release the addon work fine!
I tried to uninstall the CppChek 2.1 and reinstall it checking the addons during the installation, but this didn't work. I have to add that at the installation finish with the same version I didn't receive the message for restart the pc, so I don't know if the installation was correcttly.
However with the installing your new last version 2.2, at moment the misra addon seems work. I report here the warning that I receive with your previously simple test (test1.c):
My next step will be test the misra check with a misra.txt rules file.
Thank you so much!
Claudio
Hello guys
I'm using the "Cppcheck-2.4.1" version on Windows 10 and I got the following error when runing Misra checking.
Bailing out from checking src\Debug.c since there was an internal error: Failed to execute addon (command: 'python.exe "C:\Program Files\Cppcheck\addons\misra.py" --cli --rule-texts=C:/Program Files/Cppcheck/addons/misra_rules.txt E:\cppcheck\misra_check-cppcheck-build-dir\Debug.a1.dump')
I tried to run the command (displayed in the error message) on CLI and got the error as below:
E:\cppcheck\src>python.exe "C:\Program Files\Cppcheck\addons\misra.py" --cli --rule-texts=C:/Program Files/Cppcheck/addons/misra_rules.txt E:\cppcheck\misra_check-cppcheck-build-dir\Debug.a1.dump
Fatal error: file is not found: C:\Program
After checking the error message I suppose there is error in the command created by the GUI tool which is related to the path of Misra rule text file.
So I tried to modify it and successfully got the information of Misra rules on CLI as shown below.
E:\cppcheck\src>python.exe "C:\Program Files\Cppcheck\addons\misra.py" --cli --rule-texts="C:\Program Files\Cppcheck\addons\misra_rules.txt" E:\cppcheck\misra_check-cppcheck-build-dir\Debug.a1.dump
{"column": 0, "severity": "style", "file": "src/base_types.h", "extra": "Required", "linenr": 41, "message": "Expressions resulting from the expansion of macro parameters shall be enclosed in parentheses", "errorId": "c2012-20.7", "addon": "misra"}
{"column": 0, "severity": "style", "file": "src/base_types.h", "extra": "Required", "linenr": 42, "message": "Expressions resulting from the expansion of macro parameters shall be enclosed in parentheses", "errorId": "c2012-20.7", "addon": "misra"}
{"column": 0, "severity": "style", "file": "src/base_types.h", "extra": "Required", "linenr": 12, "message": "#define and #undef shall not be used on a reserved identifier or reserved macro name", "errorId": "c2012-21.1", "addon": "misra"}
Can anyone please confirm it?
Many thanks!
Last edit: Duong Nhat Minh 2021-05-14
Duong, I had the same problem. If you add a Python path and a Misra file without spaces in the path, it should work. For the life of me, I can't get it to work with spaces, even if I use quotes or double-quotes around the file paths.
Last edit: Bassam Abdul-Baki 2021-05-15
Bassam, thank you very much. The GUI works well when I change the path of Misra file without spaces. But it will be more convenient if the GUI can be fixed to deal with this issue in the upcoming version.
Thanks guys for the great tool.
BTW, I'm trying to install the cppcheclipse on Eclipse but always get the error of "No repository found at https://dl.bintray.com/cppcheclipse/p2/updates/"
Which thread can I post this issue?
Thanks.
Duong, I stand corrected. I have a huge program that I let run over night last night. It would seem that out of 730 files, 377 of them had misra-c2012 warnings and 255 of them had the internalError warning with no overlap. 98 files had neither which I find unusual. I know of at least one file that should have a misra-c2012 warning, but ended up with the internalError. Running that file by itself works. So there is still an issue with Misra for the GUI.
do you see a particular problem from the GUI only? So if you run the same analysis on the command line then it works?
I've never run it from the command line, at least not the entire project.
I ran it in command-line and it looks promising. I wasn't able to run it on *.dump in Windows. It was looking for an actual filename. I added a batch file for all of them and piped them to a file. I'll check them out tomorrow.
It failed from the command line as well. What I did notice is that for the file that I'm interested in, the dump file created just for that file in its own project was way smaller (22219 lines) than the dump file created just for that file when included with the entire project (560963 lines). Yet somehow, the smaller dump file is capturing the necessary info.
Unfortunately, I cannot share the code or the dump files.
Commands used:
For the Project
cppcheck --dump *.c (fails to capture anything for some files)
For the Individual File
cppcheck --dump filename.c (captures errors and misra warnings when file above fails in project)
hmm strange!
Hi ,
I'm using cppcheck 2.4.1 version. I have installed the addon and also set the preferences in the path. Yet I'm unable to generate the misra warnings in the GUI. I have attached the path that I have set in preference.
I'm able to get misra warnings only in command line by generating the dump and then running the python script manually for each file.
Thanks for the support
Last edit: Shobana Devi Sampath 2021-06-02