cmake4eclipse icon indicating copy to clipboard operation
cmake4eclipse copied to clipboard

"Resource '/home' does not exist." when trying to build

Open eyalroz opened this issue 2 years ago • 15 comments

Describe the bug

I'm importing a C++ project on Linux into Eclipse CDT 2022-03, after having just installed the latest cmake4eclipse.

When I try to build the project, or apply the cmake4eclipse settings, I get:

Parsing compilation database of project my_project has encountered a problem: [in a textbox:] Resource '/home' does not exist. Resource '/home' does not exist. [end textbox

Useful Information

  • cmake4eclipse version: 3.0.4
  • Which OS do you use: Devuan GNU/Linux Chimaera
  • Cmake version: 3.23.1

eyalroz avatar Jun 05 '22 17:06 eyalroz

Which language settings provider do you use? Is there something in the error log?

15knots avatar Jun 10 '22 19:06 15knots

Which language settings provider do you use?

I don't know. How do I check?

Is there something in the error log?

Not sure. Here's the log in case you want to have a look.

Untitled.log

eyalroz avatar Jun 10 '22 21:06 eyalroz

Thanks for the log. Indeed it contains the relevant stacktrace (at the end). The reported resource /home is not a file system path, it is the path of the project resource named home relative to the workspace. No idea, how that value gets in there. It is derived from the value of the 'Build output location' in the project properties. Usually, the value is _build/${ConfigName}.

15knots avatar Jun 13 '22 19:06 15knots

@15knots :

  1. I didn't set this location myself, Eclipse did... meaning that cmake4eclipse needs to be able to live with it somehow. Actually, even if I were to set it - the add-on should still be able to live with it somehow...
  2. Looking at the project properties, I see the build location is: ${workspace_loc:/gpu-kernel-runner}/ (and the project name, and project directory name, is gpu-kernel-runner).

eyalroz avatar Jun 13 '22 19:06 eyalroz

I debugged it with a different project and build location ${workspace_loc:/C-in-docker}/. Sth. like ${workspace_loc:/C-in-docker}/ gets expanded as an absolute file system path to /C-in-docker/home/xxx/devel/my/cmake4eclipse-sample-projects/C-in-docker. This value is interpreted as the name of a folder resource below the project resource which causes the error. Looks like CDT-MBS does not support to build in the project root directory.

15knots avatar Jun 16 '22 19:06 15knots

I'm not sure I follow. What is MBS? And - I didn't make any settings myself, so - does CDT not support building using the default settings it makes? Sorry for being clueless here.

eyalroz avatar Jun 16 '22 20:06 eyalroz

Encounter the same problem while trying to add "CMake Compilation DB" provider to an already existing project. It seems that an error happened because I have "Generate Makefiles automatically" unchecked (and in my case, it has to be unchecked), and the build directory was set to ${workspace_loc:my_project}/build/Debug, which looked absolutely fine on the first glance. The only thing that helped is to change the build directory to my_project/build/Debug. It looks like the compilation database parser always treats the build directory path as relative, even if it is set as absolute by eclipse variables.

Pudel-des-Todes avatar Jul 01 '22 14:07 Pudel-des-Todes

I have the exact same issue. I created the default Hello World cmake project in /tmp built it then deleted the project but kept the source. I then imported the same project "Existing Code as Makefile Project" and see the error: Resource '/tmp' does not exist. Resource '/tmp' does not exist.

If I do the same thing with a project located in, "/local/mnt/workspace/eclipse-workspace/hello2" I get a similar error except the resource name is "/local" , this is the error: Resource '/local' does not exist. Resource '/local' does not exist.

SidManning avatar Aug 01 '22 16:08 SidManning

Previously, Manage Configurations would include Release/Debug, if my memory is correct, now it only includes "Default" I don't know if this common or unique to my installation or not. Pudel-des-Todes, thank you for your observation that allows me to work again however I still think there is some problem because I don't remember having to do that before.

SidManning avatar Aug 01 '22 17:08 SidManning

Looks like CDT-MBS does not support to build in the project root directory.

MBS stands for Managed Build System (as opposed to Core Build and Make Build)

15knots avatar Aug 03 '22 19:08 15knots

Encounter the same problem while trying to add "CMake Compilation DB" provider to an already existing project. It seems that an error happened because I have "Generate Makefiles automatically" unchecked (and in my case, it has to be unchecked), and the

If you uncheck it, you effectively disable cmake4eclipse.

15knots avatar Aug 03 '22 19:08 15knots

Exact same problem here. "Resource '/home' does not exist." two times, not much else. @15knots: Have you been able to find out where exactly in your code this gets interpreted?

cmake4eclipse version: 3.0.5 cmake version 3.24.1 Eclipse IDE for C/C++ Developers (includes Incubating components) Version: 2022-06 (4.24.0) Build id: 20220609-1112 OS: Linux, v.5.19.5-arch1-1, x86_64 / gtk 3.24.34 Java vendor: Eclipse Adoptium Java runtime version: 17.0.3+7 Java version: 17.0.3

havoc-dlt avatar Aug 31 '22 10:08 havoc-dlt

Previously, Manage Configurations would include Release/Debug, if my memory is correct, now it only includes "Default" I don't know if this common or unique to my installation or not. Pudel-des-Todes, thank you for your observation that allows me to work again however I still think there is some problem because I don't remember having to do that before.

Can confirm this as well.

havoc-dlt avatar Aug 31 '22 10:08 havoc-dlt

If you uncheck it, you effectively disable cmake4eclipse.

I'm fully aware of that. Unfortunately, I have to work on projects with MCU vendor-specific nature (STM32 MCU projects, to be specific) that replace the standard Tool Chain Editor with their own, which makes cmake4eclipse almost unusable anyway. However, I'm still able to use "CMake Compilation DB" provider (the thing that parses "compile_commands.json" and provides include paths and defines to the Indexer).

Pudel-des-Todes avatar Aug 31 '22 12:08 Pudel-des-Todes

@Pudel-des-Todes

It looks like the compilation database parser always treats the build directory path as relative, even if it is set as absolute by eclipse variables.

Yes, it does. Just as the label on the input field states.

If you do not want to have the build output below the project root directory, create a linked resource in the workbench properties, then click the 'Create...' button in the project properties page, click 'Advanced' in the 'New Folder' dialog, check 'Link to folder...' and insert the variable that references your linked resource.

15knots avatar Aug 31 '22 19:08 15knots

Looks like sometimes our buildscript generator is not kicked in and a non-absolute path is generated. MBS``s Builder.getDefaultBuildPath() does then generate a garbled variable expression {workspace_loc:/my-project-name}/buildroot. After variable-expansion this is /home/user/my-project-name/buildroot which denotes a file system path, but not a eclipse workbench resource. Hence the "Resource '/home' does not exist." error.

15knots avatar Oct 22 '22 19:10 15knots