Definitive solution for Eclipse indexer getting stuck
When I work on CUDA C++ project in Eclipse, the indexer often gets stuck in two situations:
- when it parses a
*.hcu
file; - it hangs with the message “waiting for exclusive index access”.
Before solving the indexer problem, make sure all necessary include paths have been added to Eclipse’s project settings, i.e. Project Properties
→ Paths and Symbols
→ Includes
. Even though some user defined include paths in the project have been correctly setup in CMakeLists.txt
, for example, in my BEM project, I have defined
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
this path cannot be recognized by Eclipse, which should be manually added to the project settings.
For the first issue, I have verified that a successful solution is to separate the source code indexing into two stages: 1. index those pure C++ files, 2. index CUDA files. The detailed procedures are:
- Close Eclipse.
- Remove all CUDA files, i.e.
*.hcu
files or even*.cu
files, from the project. - Go to the folder
$workspace/.metadata/.plugins/org.eclipse.cdt.core/
(where$workspace
is the Eclipse workspace folder), delete the project’spdom
file. This step only ensures that everything starts anew, which is optional. - Restart Eclipse and let the indexer rebuild the index. Because there are no CUDA source code in the project, the indexer should finish in a short time.
- Close Eclipse.
- Move back CUDA
*.hcu
and*.cu
files into the project. - Restart Eclipse.
- Right click on the project name in the Project Explorer, select
Index
→Search for Unresolved Includes
. This will list all those unresolved header files in theSearch
panel. - To let the indexer process these just added
*.hcu
files, selectIndex
→Update with Modified Files
. We can see that Eclipse treats these newly added files as “Modified Files”. N.B. Do not selectIndex
→Re-resolve Unresolved Includes
, which does not work.
For the second situation that the indexer “waiting for exclusive index access”, close all opened editors will release locks on those files and the indexer should continue its work.
If the problem is still unsolved, restart Eclipse may help. If the problem is still unsolved, try these solutions several times with patience.