MantisBT - CMake
View Issue Details
0015277CMakeCMakepublic2014-12-03 05:202016-06-10 14:31
Georg Altmann 
Kitware Robot 
normalmajoralways
closedmoved 
CMake 3.0 
 
0015277: Eclipse CDT: CUDA project error parsing broken for Nvidia Nsight
When using cmake -G"Eclipse CDT4 - Unix Makefiles" with the FindCUDA.cmake module for generating Eclipse projects for NVidia Nsight, error parsing does not work in Eclipse. NVidia Nsight is a beefed up version of Elcipse CDT.

Enabling the "nvcc error parser" in "project->properties->C/C++ Make
Project->Error Parsers" and moving it to the top of the list in the project properties has no effect.

Tested cmake versions:
cmake version 2.8.12.2 (Ubuntu 14.04.1 LTS)
cmake version 3.1.0-rc2 (built from source)

CUDA 6.5
Nsight Eclipse Edition 6.5
Eclipse C/C++ Development Tools Version: 8.1.2.nvidia-qualifier
System Requirements: Have GCC/g++, CUDA and Nsight installed.

1. Download cudaproj.tar.gz from this bug.
2. Extract cudaproj.tar.gz
3. mkdir cudaproj-build && cd cudaproj-build
4. cmake -G"Eclipse CDT4 - Unix Makefiles" ../cudaproj
5. Import the project from cudaproj-build into Nsight,
6. Build the project.
7. In the console the compiler error ".../cudaproj/regular.cpp:3:2: error: ā€˜Cā€™ was not declared in this scope" is highlighted, double-clicking on it opens regular.cpp and the cursor is on line 3.
8. In the console the compiler error "cudaproj.cu(4): error: identifier "syntax" is undefined" is _not_ highlighted while it should be.
No tags attached.
gz cudaproj.tar.gz (393) 2014-12-03 05:20
https://public.kitware.com/Bug/file/5308/cudaproj.tar.gz
gz fix-cmake-nsight-err-0.01.tar.gz (1,375) 2014-12-08 11:38
https://public.kitware.com/Bug/file/5321/fix-cmake-nsight-err-0.01.tar.gz
Issue History
2014-12-03 05:20Georg AltmannNew Issue
2014-12-03 05:20Georg AltmannFile Added: cudaproj.tar.gz
2014-12-03 05:22Georg AltmannNote Added: 0037367
2014-12-08 11:38Georg AltmannFile Added: fix-cmake-nsight-err-0.01.tar.gz
2014-12-08 11:38Georg AltmannNote Added: 0037407
2014-12-08 11:48Brad KingSummaryNvidia Nsight (eclipse cdt for CUDA) error parsing broken => Eclipse CDT: CUDA project error parsing broken for Nvidia Nsight
2014-12-08 11:50Brad KingNote Added: 0037409
2014-12-08 12:21Georg AltmannNote Added: 0037412
2014-12-08 14:02Brad KingNote Added: 0037415
2014-12-15 11:55Georg AltmannNote Added: 0037463
2016-06-10 14:29Kitware RobotNote Added: 0042679
2016-06-10 14:29Kitware RobotStatusnew => resolved
2016-06-10 14:29Kitware RobotResolutionopen => moved
2016-06-10 14:29Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0037367)
Georg Altmann   
2014-12-03 05:22   
Error parsing works fine for "native" nsight CUDA projects and for
non-CUDA/non-nvcc c++ sources.
(0037407)
Georg Altmann   
2014-12-08 11:38   
I traced down the root cause of this.
In the .project XML project file, the sub-tree

projectDescription/buildSpec/buildCommand/arguments/dictionary/*

contains key/value pairs.

<key>org.eclipse.cdt.core.errorOutputParser</key>

configures the list of error parsers:

<value>nvcc.errorParser;org.eclipse.cdt.core.VCErrorParser;org.eclipse.cdt.core.GmakeErrorParser;org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.WorkingDirLocator;org.eclipse.cdt.core.GLDErrorParser;</value>

For nvcc error parsing to work, nvcc.errorParse must be in the list. Order matters, so it is probably best to put it in front.

I hacked together a little python script for my personal use which patches Eclipse CDT projects accordingly. It is attached as fix-cmake-nsight-err-0.01.tar.gz
(0037409)
Brad King   
2014-12-08 11:50   
Re 0015277:0037407: The value of org.eclipse.cdt.core.errorOutputParser is populated here:

 http://www.cmake.org/gitweb?p=cmake.git;a=blob;f=Source/cmExtraEclipseCDT4Generator.cxx;hb=v3.0.2#l415 [^]

That could be extended to add other error parsers, either through some kind of configuration value the project or user can set, through detection, or perhaps just a hard-coded value.

I don't personally use any of these tools so I'm not sure which approach would be best.
(0037412)
Georg Altmann   
2014-12-08 12:21   
Looking at the code for compilerId, checking this for nvcc is not enough, since a CUDA project is likely to use nvcc next to other compilers and nvcc is not necessarily set as CMAKE_CXX_COMPILER: FindCUDA does not touch CMAKE_CXX_COMPILER but configures CUDA_NVCC_EXECUTABLE and others separately.

IMHO FindCUDA should trigger a setting which makes cmake add nvcc.errorParser to the list of error parsers. This setting should be user configurable. Rationale: nvcc error parsing could break parsing for some other compiler or FindCUDA is not used.

Maybe we can add a new global property for this?
There already is ECLIPSE_EXTRA_NATURES
ECLIPSE_ERROR_PARSERS
Doc:
List of error parsers to use for the generated Eclipse project file.

This configures the list of error parsers used by Eclipse.
The default is to set the error parser based on the used C or C++ compiler. If this property is defined, it defines the list of error parsers exclusively.
Non-exhaustive list of error parsers:
* org.eclipse.cdt.core.VCErrorParser MS Visual Studio
* org.eclipse.cdt.core.GmakeErrorParser GNU Make
* org.eclipse.cdt.core.MakeErrorParser Make
* org.eclipse.cdt.core.GCCErrorParser GCC
* org.eclipse.cdt.core.GASErrorParser GNU As
* org.eclipse.cdt.core.GLDErrorParser GNU LD
* nvcc.errorParser NVidia nvcc (only defined in NSight)

I can prepare a patch if this is useful.
(0037415)
Brad King   
2014-12-08 14:02   
Re 0015277:0037412: I think a ECLIPSE_ERROR_PARSERS property makes sense, and FindCUDA could set that once the generator offers it.

If you work on a patch please read CONTRIBUTING.rst and send the patch to the list for review.
(0037463)
Georg Altmann   
2014-12-15 11:55   
JFYI: I do not have the resources to implement a patch for ECLIPSE_ERROR_PARSERS right now. I will bear with the hackish solution from fix-cmake-nsight-err-0.01.tar.gz. If anybody else is willing to implent ECLIPSE_ERROR_PARSERS as described above, please go ahead.
(0042679)
Kitware Robot   
2016-06-10 14:29   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.