Bug 537336 - Indexer cannot resolve system include files in CDT 9.5.x
Summary: Indexer cannot resolve system include files in CDT 9.5.x
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-build (show other bugs)
Version: 9.5.2   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: cdt-build-inbox@eclipse.org CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-07-24 08:09 EDT by Andy CLA
Modified: 2020-09-04 15:23 EDT (History)
2 users (show)

See Also:


Attachments
Screenshot of project settings (104.14 KB, image/png)
2018-07-25 08:57 EDT, Andy CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andy CLA 2018-07-24 08:09:21 EDT
I have just upgraded from Oxygen to Photon, but I find now that the system includes are excluded from the indexer.  I have tried upgrading an existing Oxygen installation, and installing everything from scratch, with an upgraded workspace and with a newly created one.  All combinations yield the same result.

The list of "Includes" has all the right paths and navigating into them in the project explorer you can find and open the files that the indexer is not finding.  However, function or macro definitions are not resolved and you can't click-open the system header files from the source files.

An identical setup with Oxygen works perfectly: downloading the latest Oxygen release tar, unzipping it, creating a new workspace, importing my code, running the indexer -- system includes are found and indexed.

Doing the same with the latest Photon release fails.

It may be worth mentioning that the project(s) that I'm importing were created (or branched from an original template) way back in Ganymede.  I have tried to create a new project that has the same form as this original template, but I seem unable to do so.  None of the options offer the "C/C++ Include Paths and Symbols" screen in the project properties window, for example.  It seems that this has moved in the newer projects to something that drags information from the toolchain, but I really need to create projects not linked to a toolchain.

I'm afraid this report is very light on any further details.  I am more than happy to provide anything necessary, but I need to know what and where to find it :o)
Comment 1 Nathan Ridge CLA 2018-07-24 22:39:17 EDT
(In reply to Andy from comment #0)
> It may be worth mentioning that the project(s) that I'm importing were
> created (or branched from an original template) way back in Ganymede.  I
> have tried to create a new project that has the same form as this original
> template, but I seem unable to do so.  None of the options offer the "C/C++
> Include Paths and Symbols" screen in the project properties window, for
> example.  It seems that this has moved in the newer projects to something
> that drags information from the toolchain, but I really need to create
> projects not linked to a toolchain.

The "C/C++ General -> Paths and Symbols" page in the Project Properties dialog is missing? What about "C/C++ General -> Preprocessor Include Paths, Macros, etc."?
Comment 2 Andy CLA 2018-07-25 08:57:15 EDT
Created attachment 275124 [details]
Screenshot of project settings

Here is a screenshot from my project settings, showing the "C/C++ Include Paths and Symbols" page, but missing the "Paths and Symbols" and "Preprocessor Include Paths, Macros etc." pages which I believe only appear if you create a new project for an Eclipse-managed build -- which I don't really want, since managing the builds "separately" leads to fewer other problems.
Comment 3 Nathan Ridge CLA 2018-07-25 21:13:53 EDT
(In reply to Andy from comment #2)
> Here is a screenshot from my project settings, showing the "C/C++ Include
> Paths and Symbols" page, but missing the "Paths and Symbols" and
> "Preprocessor Include Paths, Macros etc." pages which I believe only appear
> if you create a new project for an Eclipse-managed build -- which I don't
> really want, since managing the builds "separately" leads to fewer other
> problems.

I think those pages are usable in a makefile project if it's created by choosing "C++ Managed Build" on the project wizard's first page, and then "Makefile project" on the second page. This should result in a project that's not a managed build project, and has those pages.

In this respect, the naming of the "C++ Managed Build" option on the first page is misleading. I've pointed this out [1], but the discussion did not lead to agreement on a better name.

In fact, re-reading the linked thread, it looks like I ran into the same problem as you, and the solution was to create a makefile project from the wizard's second page as descrbed.

[1] https://dev.eclipse.org/mhonarc/lists/cdt-dev/msg32865.html
Comment 4 Andy CLA 2018-07-26 10:31:46 EDT
(In reply to Nathan Ridge from comment #3)
> I think those pages are usable in a makefile project if it's created by
> choosing "C++ Managed Build" on the project wizard's first page, and then
> "Makefile project" on the second page. This should result in a project
> that's not a managed build project, and has those pages.

I didn't manage to get it via the "C++ Managed Build" project.

However, I have had partial success with Photon this way:

1. Create a new C/C++ Project

2. Select "Makefile Project" from the first page.  It says experimental, but I like fun!

3. Give it a project name, but untick "Generate Source and Makefile" (we're going to be doing it alone!)

4. Copy-and-paste the source files and folder structure from the old project

5. The project properties give the "C/C++ Include Paths and Symbols" page (hooray!) and so this can be populated as desired (copy-and-paste from old project)

6. However, it is not possible to add custom build targets

7. Exit eclipse, and manually edit the ".project" file in the workspace

8. Remove the existing "buildCommand" node which was "org.eclipse.cdt.core.cBuilder" and replace with...

	<buildCommand>
	  <name>org.eclipse.cdt.make.core.makeBuilder</name>
	  <arguments>
	    <dictionary>
	      <key>org.eclipse.cdt.make.core.build.target.auto</key>
	      <value>host</value>
	    </dictionary>
	    <dictionary>
	      <key>org.eclipse.cdt.make.core.build.target.clean</key>
	      <value>clean</value>
	    </dictionary>
	    <dictionary>
	      <key>org.eclipse.cdt.make.core.build.target.inc</key>
	      <value>host</value>
	    </dictionary>
	    <dictionary>
	      <key>org.eclipse.cdt.make.core.enableAutoBuild</key>
	      <value>false</value>
	    </dictionary>
	    <dictionary>
	      <key>org.eclipse.cdt.make.core.enableCleanBuild</key>
	      <value>true</value>
	    </dictionary>
	    <dictionary>
	      <key>org.eclipse.cdt.make.core.enableFullBuild</key>
	      <value>true</value>
	    </dictionary>
	    <dictionary>
	      <key>org.eclipse.cdt.make.core.enabledIncrementalBuild</key>
	      <value>true</value>
	    </dictionary>
	  </arguments>
	</buildCommand>

Note that I (will) have a default build target named "host" which is specified in the "...target.auto" and "...target.inc" sections, and I've disabled the auto-build function.  I haven't yet found any way of doing any of this step without manually editing the .project file.

9. Relaunch eclipse and it is now possible to add build targets (copy-and-paste from old project)

So at this point it is looking pretty good.  Certainly the indexer is working properly again -- hooray!

However, there are two things that aren't right (that I have spotted so far).  Firstly, the CDT Build Console doesn't highlight compile errors or enable me to click to locate them in the source.  Secondly, every time eclipse starts up it creates a bogus build/make.run.linux.x86_64 folder.

Any ideas on how to solve these last two problems?  Thanks :o)
Comment 5 Nathan Ridge CLA 2018-07-27 01:14:07 EDT
Glad to hear you were able to get it to (mostly) work.

Obviously, it shouldn't be this hard.

I'm going to move this bug to the build component, as the underlying issues seem to be related to the new Core Build system.