Search code examples
eclipsecudacmakeeclipse-cdtnsight

cmake+Eclipse/Nsight: Compiler (nvcc) error parsing?


I am using CMake to generate project files for Nsight (=beefed up version of Eclipse CDT) for a CUDA project. The problem is, that Eclipse does parse the compiler errors generated by nvcc.

I enabled the "nvcc error parser" in "project->properties->C/C++ Make Project->Error Parsers" and moved it to the top of the list, to no effect. Error parsing works fine for "native" nsight CUDA projects and for non-CUDA/non-nvcc c++ cmake generated projects.

The CMakeLists.txt is very basic:

cmake_minimum_required (VERSION 2.8)
project(myproject)

find_package(CUDA REQUIRED)
set(CUDA_SOURCES 
    myprojmain.cu
    )

cuda_add_executable( myproject ${CUDA_SOURCES})

Solution

  • 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 to the cmake bug http://public.kitware.com/Bug/view.php?id=15277 Would be nice to see this integrated into CMake some time...