cppcheclipse
cppcheclipse copied to clipboard
java.lang.NullPointerException: Could not initialize cppcheck for project lib-ltc
eclipse.buildId=4.13.0.I20190916-1045
java.version=1.8.0_171
java.vendor=Oracle Corporation
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=nl_NL
Framework arguments: -product org.eclipse.epp.package.cpp.product -keyring /Users/arjanvanvught/.eclipse_keyring
Command-line arguments: -os macosx -ws cocoa -arch x86_64 -product org.eclipse.epp.package.cpp.product -keyring /Users/arjanvanvught/.eclipse_keyring
com.googlecode.cppcheclipse.core
Error
Tue Oct 01 21:55:37 CEST 2019
Could not initialize cppcheck for project lib-ltc
java.lang.NullPointerException
at com.googlecode.cppcheclipse.ui.ToolchainSettings.getIncludes(ToolchainSettings.java:181)
at com.googlecode.cppcheclipse.ui.ToolchainSettings.getUserIncludes(ToolchainSettings.java:87)
at com.googlecode.cppcheclipse.core.Checker.<init>(Checker.java:80)
at com.googlecode.cppcheclipse.ui.Builder$ResourceVisitor.initChecker(Builder.java:164)
at com.googlecode.cppcheclipse.ui.Builder$ResourceVisitor.processFile(Builder.java:199)
at com.googlecode.cppcheclipse.ui.Builder$ResourceVisitor.visit(Builder.java:122)
at org.eclipse.core.internal.resources.Resource.lambda$1(Resource.java:117)
at org.eclipse.core.internal.resources.Resource.lambda$0(Resource.java:85)
at org.eclipse.core.internal.watson.ElementTreeIterator.doIteration(ElementTreeIterator.java:85)
at org.eclipse.core.internal.watson.ElementTreeIterator.iterate(ElementTreeIterator.java:135)
at org.eclipse.core.internal.resources.Resource.accept(Resource.java:94)
at org.eclipse.core.internal.resources.Resource.accept(Resource.java:55)
at org.eclipse.core.internal.resources.Resource.accept(Resource.java:117)
at org.eclipse.core.internal.resources.Resource.accept(Resource.java:105)
at com.googlecode.cppcheclipse.ui.Builder.processResource(Builder.java:306)
at com.googlecode.cppcheclipse.ui.commands.RunCodeAnalysis$RunCodeAnalysisJob.runResource(RunCodeAnalysis.java:26)
at com.googlecode.cppcheclipse.ui.commands.ResourceSelectionJob.run(ResourceSelectionJob.java:44)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)</init>
Could you describe what you were doing and how to replicate it?
Using the latest Eclipse 2019-09 with the plug-in from the Marketplace, I get this exception every-time when I run the cppcheck from the source file (pull-down menu). I can reproduce it on Linux Ubuntu as well.
You didn't specify what version of cpccheck. Try to use cppcheck v1.83
Second experiment you can do is install different build of cppcheclipse, what happens when you install this variant of the plugin? com.googlecode.cppcheclipse.repository-1.1.1.v20190927-1540.zip
You didn't specify what version of cpccheck. Try to use cppcheck v1.83
MacOS : Cppcheck 1.89 Linux : Cppcheck 1.82 {latest from apt install}
Second experiment you can do is install different build of cppcheclipse, what happens when you install this variant of the plugin? com.googlecode.cppcheclipse.repository-1.1.1.v20190927-1540.zip
Also an exception.
eclipse.buildId=4.13.0.I20190916-1045
java.version=1.8.0_171
java.vendor=Oracle Corporation
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=nl_NL
org.eclipse.core.runtime.CoreException: Could not initialize cppcheck for project lib-tcnet
at com.googlecode.cppcheclipse.ui.Builder$ResourceVisitor.initChecker(Builder.java:192)
at com.googlecode.cppcheclipse.ui.Builder$ResourceVisitor.processFile(Builder.java:199)
at com.googlecode.cppcheclipse.ui.Builder$ResourceVisitor.visit(Builder.java:122)
at org.eclipse.core.internal.resources.Resource.lambda$1(Resource.java:117)
at org.eclipse.core.internal.resources.Resource.lambda$0(Resource.java:85)
at org.eclipse.core.internal.watson.ElementTreeIterator.doIteration(ElementTreeIterator.java:85)
at org.eclipse.core.internal.watson.ElementTreeIterator.iterate(ElementTreeIterator.java:135)
at org.eclipse.core.internal.resources.Resource.accept(Resource.java:94)
at org.eclipse.core.internal.resources.Resource.accept(Resource.java:55)
at org.eclipse.core.internal.resources.Resource.accept(Resource.java:117)
at org.eclipse.core.internal.resources.Resource.accept(Resource.java:105)
at com.googlecode.cppcheclipse.ui.Builder.processResource(Builder.java:306)
at com.googlecode.cppcheclipse.ui.commands.RunCodeAnalysis$RunCodeAnalysisJob.runResource(RunCodeAnalysis.java:26)
at com.googlecode.cppcheclipse.ui.commands.ResourceSelectionJob.run(ResourceSelectionJob.java:44)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: java.lang.NullPointerException
at com.googlecode.cppcheclipse.ui.ToolchainSettings.getIncludes(ToolchainSettings.java:182)
at com.googlecode.cppcheclipse.ui.ToolchainSettings.getUserIncludes(ToolchainSettings.java:88)
at com.googlecode.cppcheclipse.core.Checker.<init>(Checker.java:81)
at com.googlecode.cppcheclipse.ui.Builder$ResourceVisitor.initChecker(Builder.java:164)
... 14 more
Can you share what source it is (it shouldn't matter), but still. Or can you export a project for me to try to replicate it?
Do you have some CDT plugin on top of Eclipse when you do the C coding? Is the C project configured correctly (building as managed project, not some external makefile)?
Can you share what source it is (it shouldn't matter), but still. Or can you export a project for me to try to replicate it?
https://github.com/vanvught/rpidmx512
Do you have some CDT plugin on top of Eclipse when you do the C coding?
Yes, CDT latest release.
Is the C project configured correctly (building as managed project, not some external makefile)?
All projects are correctly configured with using an external makefile.
So then no, that's just external makefile project, The 'Managed' is CDT's term: https://help.eclipse.org/kepler/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Fconcepts%2Fcdt_c_build_over.htm
And CDT is not optional: https://github.com/kwin/cppcheclipse/wiki/Installation#requirements
If you want to use marketplace version of the plugin then any cppcheck above v1.83 will not work even when you will have the project as a proper CDT project.
If you really want just rogue makefiles then you can just run cppcheck from them, no need for this plugin.
On top of CDT because your project is baremetal (cool project btw), you might want to use GNU MCU Eclipse plugin as well, if you have Olimex jtag then you should be able to do interactive debuging through the GME plugin (it helps orchestrating OpenOCD and configuring the right switches for the toolchain so then it generates correct makefiles for you)
And CDT is not optional: https://github.com/kwin/cppcheclipse/wiki/Installation#requirements
I've got CDT (of course). I just corrected my comment.
If you really want just rogue makefiles then you can just run cppcheck from them, no need for this plugin.
Advantage of a plug-in is that the output is referenced to the source code.
On top of CDT because your project is baremetal (cool project btw),
Thanks!
you might want to use GNU MCU Eclipse plugin as well, if you have Olimex jtag then you should be able to do interactive debuging through the GME plugin (it helps orchestrating OpenOCD and configuring the right switches for the toolchain so then it generates correct makefiles for you)
I am not that eager with auto generated make files. I want to have full control on my own build process.
I imported it into my Eclipse and run check on your lib-tcnet and I didn't got any exceptions, see attachment. cppcheck.txt
I really can't get it to work ;-(
uname -a
Darwin MacBook-Air.local 18.7.0 Darwin Kernel Version 18.7.0: Tue Aug 20 16:57:14 PDT 2019; root:xnu-4903.271.2~2/RELEASE_X86_64 x86_64
cppcheck --version
Cppcheck 1.89
I had the same problem on some eclipse projects. Other projects worked just fine. The difference is, that the error occurs only in projects, where the source code is just linked to the eclipse workspace. Might this be the root cause of the problem? - A solution would be very appreciated!
I have a similar problem. I can run cppcheck fine on 3 out of 4 projects but it throws the following error for a single project:
The main difference between this project and the others is that I have a whole bunch of linked files in this project. Also, there are includes from other projects to avoid code duplication. Not sure which one is causing this null pointer.
If I run cppcheck on a directory of this project does some checks (even though there are linked files in that directory) but complains that it cannot find all the includes (understandable) and the warnings are from the other project where the files are linked here! Not sure if the linked files are directing the cppcheck to the other project and it gets stuck there or not.
@AntonKrug, Figured out it has to do with the 'Is a workspace path' checkmark of the includes. When I enable this with a 'basic' test.cpp file i will get the same kind of error. It seems it is cppcheck unrelated, because it does not even get to the point it executes cppcheck.
@Hanzel44 thank you very much for the update. With eclipse there is so much which can go wrong
@vanvught is yours issue workspace related as well, should we close this issue?
@AntonKrug i mean it is not an issue of cppcheck.exe itself. It is an issue of the cppcheclipse plugin. So i ques it could only be closed if it is fixed.