Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

de.marw.cmake4eclipse.mbs.settings::buildDir is set to "" #196

Open
ceggers-arri opened this issue Dec 5, 2023 · 5 comments
Open

de.marw.cmake4eclipse.mbs.settings::buildDir is set to "" #196

ceggers-arri opened this issue Dec 5, 2023 · 5 comments

Comments

@ceggers-arri
Copy link

Describe the bug
Build does not start, caused by an invalid (empty) build directory (see 1st screenshot below).

It is not clear for me, whether a (Cmake4eclipse) build directory has to be specified explicitly,
as a useful build directory is chosen automatically by default (e.g. _build/Default). But after
setting CMake cache entries, an empty buildDir value is written to .cproject (see below).
After restarting the Eclipse IDE (the wrong buildDir setting does not take effect immediately),
the project cannot be built anymore.

To Reproduce
Steps to reproduce the behavior:

  1. File --> New --> Project...
  2. C/C++ --> C++ Project
  3. Fill out the form
    3.1 Project name: test
    3.2 Project type: Cmake4eclipse --> Empty Project
  4. Finish
  5. Right click on the newly created project.
  6. Go to 'C/C++ Build' --> Cmake4eclipse --> CMake cache entries
  7. Add at least one variable (e.g. CMAKE_CXX_COMPILER_LAUNCHER, STRING, ccache)
  8. Build the project (will fail due to missing CMakeLists.txt, but doesn't matter)
  9. Restart Eclipse IDE
  10. Try to build the project again --> fails with the error in the screenshot below

Expected behavior
Project can be build even after restarting the Eclipse IDE.

Screenshots
Error message after starting a build
grafik
Wrong build directory (configuration where a CMake cache variable has been set)
grafik
Empty build directory (configuration where a CMake cache variable has been set)
grafik
Correct build directory (configuration where NO CMake cache variable has been set)
grafik
Empty build directory (configuration where NO CMake cache variable has been set)
grafik

Useful Information

  • cmake4eclipse version: 4.0.3
  • Which OS do you use: openSUSE Leap 15.4
  • Cmake version: 3.223

What is in Eclipse's Error Log?

Sanitized stack traces:

!ENTRY org.eclipse.core.resources 4 75 2023-12-05 13:12:23.150
!MESSAGE Errors occurred during the build.
!SUBENTRY 1 org.eclipse.cdt.managedbuilder.core 4 75 2023-12-05 13:12:23.150
!MESSAGE Errors running builder 'CDT Builder' on project 'test1'.
!STACK 0
java.lang.IllegalArgumentException: Path must include project and resource name: /test1
        at org.eclipse.core.runtime.Assert.isLegal(Assert.java:66)
        at org.eclipse.core.internal.resources.Workspace.newResource(Workspace.java:2228)
        at org.eclipse.core.internal.resources.Container.getFolder(Container.java:205)
        at de.marw.cmake4eclipse.mbs.internal.CMakeBuildRunner.invokeBuild(CMakeBuildRunner.java:123)
        at org.eclipse.cdt.managedbuilder.internal.core.CommonBuilder.performExternalClean(CommonBuilder.java:1170)
        at org.eclipse.cdt.managedbuilder.internal.core.CommonBuilder.clean(CommonBuilder.java:1111)
        at org.eclipse.cdt.managedbuilder.internal.core.CommonBuilder.performCleanning(CommonBuilder.java:955)
        at org.eclipse.cdt.managedbuilder.internal.core.CommonBuilder.performPrebuildGeneration(CommonBuilder.java:881)
        at org.eclipse.cdt.managedbuilder.internal.core.CommonBuilder.build(CommonBuilder.java:767)
        at org.eclipse.cdt.managedbuilder.internal.core.CommonBuilder.build(CommonBuilder.java:521)
        at org.eclipse.cdt.managedbuilder.internal.core.CommonBuilder.build(CommonBuilder.java:466)
        at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:1079)
        at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
        at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:296)
        at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:352)
        at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:441)
        at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
        at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:444)
        at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:555)
        at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:503)
        at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:585)
        at org.eclipse.core.internal.resources.Workspace.buildInternal(Workspace.java:594)
        at org.eclipse.core.internal.resources.Workspace.build(Workspace.java:490)
        at org.eclipse.ui.actions.BuildAction$1.runInWorkspace(BuildAction.java:291)
        at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:43)
        at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

Additional context
.cproject snipset of the build configuration, where a CMake cache variable has been set

			<storageModule buildDir="" dirtyTs="1701777417805" moduleId="de.marw.cmake4eclipse.mbs.settings">
				<options/>
				<defs>
					<def name="CMAKE_CXX_COMPILER_LAUNCHER" type="STRING" val="ccache"/>
				</defs>
			</storageModule>

.cproject snipset of the build configuration, where NO CMake cache variable has been set

<storageModule moduleId="de.marw.cmake4eclipse.mbs.settings"/>
@15knots
Copy link
Owner

15knots commented Dec 10, 2023

Your .cproject has been created with cmake4eclipse prior to 4.x.
Re-creating it as a Cmake4eclipse Managed Build project using the New C/C++-Project wizard should fix the issue.
As a side effect, you will also get rid of all the confusing project property pages that have no effect when using cmake.

@ceggers01
Copy link

Your .cproject has been created with cmake4eclipse prior to 4.x.

Not really. Yes, the I am working on an existing code base, but the Eclipse projects have been re-created from scratch (as described above). I deleted all .project, .cproject and .setting/* files in advance. But I think I didn't use the C/C++-Project wizard.

@ceggers-arri
Copy link
Author

While setting buildDir=_build/Debug manually in .cproject, everything seemed to work ... until I updated Eclipse from 2023-09 to 2023-12. Now I get some other error message when starting a build. In the Builder Settings tab I can see that the build directory is now "/project/Debug" instead of "/project/_builds/Debug". Changes in the Build output location are now ignored.

In order to continue my actual work, I downgraded back to Eclipse 2023-09.

@ceggers-arri
Copy link
Author

Re-creating it as a Cmake4eclipse Managed Build project using the New C/C++-Project wizard should fix the issue. As a side effect, you will also get rid of all the confusing project property pages that have no effect when using cmake.

It looks like the problem is also present here. I only needed to add another build configuration, set my CMake variables and restart Eclipse. Again I have an empty buildDir.

@15knots
Copy link
Owner

15knots commented Dec 21, 2023

While setting buildDir=_build/Debug manually in .cproject, everything seemed to work ... until I updated Eclipse from 2023-09 to 2023-12. Now I get some other error message when starting a build. In the Builder Settings tab I can see that the build directory is now "/project/Debug" instead of "/project/_builds/Debug". Changes in the Build output location are now ignored.

If it is now "/project/Debug" instead of "/project/_builds/Debug" then the plain old managed build kicked in.
This may be caused because cmake4eclipse is not compatible with CDT 11.4: See #198

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants