tycho icon indicating copy to clipboard operation
tycho copied to clipboard

"Could not resolve module: org.eclipse.jdt.launching.macosx" when using MacOS execution environment

Open kriegaex opened this issue 3 years ago • 16 comments

Please try to be kind, I am a Tycho noob, trying to build a project which is not my own. In that legacy project I have:

<plugin>
  <groupId>org.eclipse.tycho</groupId>
  <artifactId>target-platform-configuration</artifactId>
  <version>2.5.0</version>
  <configuration>
    <resolver>p2</resolver>
    <pomDependencies>consider</pomDependencies>
    <ignoreTychoRepositories>true</ignoreTychoRepositories>
    <environments>
      <environment>
        <os>macosx</os>
        <ws>cocoa</ws>
        <arch>x86_64</arch>
      </environment>
      <environment>
        <os>linux</os>
        <ws>gtk</ws>
        <arch>x86_64</arch>
      </environment>
      <environment>
        <os>win32</os>
        <ws>win32</ws>
        <arch>x86_64</arch>
      </environment>
    </environments>
    <executionEnvironment>JavaSE-11</executionEnvironment>
  </configuration>
</plugin>

When running tests, I always see:

!ENTRY org.eclipse.jdt.launching.macosx 4 0 2022-01-20 14:58:04.416
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Could not resolve module: org.eclipse.jdt.launching.macosx [245]
  Unresolved requirement: Require-Capability: eclipse.platform; filter:="(osgi.os=macosx)"

	at org.eclipse.osgi.container.Module.start(Module.java:463)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.lambda$1(ModuleContainer.java:1834)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1829)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1775)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1739)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1661)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:228)
	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:339)

The test on my Windows box succeeds, but this error message is visible in many tests, often multiple times. As soon as I comment out the <environment><os>macosx</os><ws>cocoa</ws><arch>x86_64</arch></environment> section, the error goes away. Is there anything wrong with that configuration? Should it be updated in any way?


Update: The error message is the same in Tycho 2.7.0-SNAPSHOT.

kriegaex avatar Jan 20 '22 08:01 kriegaex

would also be interested to know if there is any way to avoid that

cdietrich avatar Jan 20 '22 08:01 cdietrich

Could you put macox as the last item and windows as the first?

laeubi avatar Jan 20 '22 08:01 laeubi

@laeubi, I had tried that before. The order does not make any difference. If it did, it would be suboptimal, because then on MacOS maybe a similar error message about Windows would appear. But like I said, in any order the MacOS error appears.

kriegaex avatar Jan 20 '22 08:01 kriegaex

There is one place where order matters so this was just a guess, if that really bugs someone it would be best to provide a minimal reproducer for further analysis.

laeubi avatar Jan 20 '22 08:01 laeubi

If you like, you can clone and build this branch: https://git.eclipse.org/c/ajdt/org.eclipse.ajdt.git/log/?h=e421

You can build with

mvn -P e421 -DskipTests=true install

and then e.g. run

mvn -P e421 verify -Dtest=AddAJNatureActionTest -pl org.eclipse.ajdt.ui.tests

Sorry, I have no idea how to create a minimal reproducer, being the OSGi and Tycho noob I really am. BTW, I know the project is horrible, it has not had a proper maintainer for more than 10 years. @aclement was just keeping it compiling, and for the last year or so I helped because he is even more busy than he was before. The last person to really maintain this thing was Andrew Eisenberg, and he retired as a committer a long time ago. So please do not get a heart attack or so, looking at the project.

kriegaex avatar Jan 20 '22 08:01 kriegaex

According to the Tycho Reference Card, the settings seem to be OK.

If you like, you can clone and build this branch: https://git.eclipse.org/c/ajdt/org.eclipse.ajdt.git/log/?h=e421

If you prefer a GitHub repo, just clone or fork my own fork, also branch e421: https://github.com/kriegaex/org.eclipse.ajdt/tree/e421

kriegaex avatar Jan 20 '22 09:01 kriegaex

here is another reproducer

https://github.com/cdietrich/tycho-issue-542-reproducer

am not sure if the targetplatform-config / profile thingy is causing this or the feature dependency to jdt https://github.com/cdietrich/tycho-issue-542-reproducer/blob/ae5e91bd9dfec87234f120f189a9e56a0cd3a446/pom.xml#L92

cdietrich avatar Jan 20 '22 10:01 cdietrich

@cdietrich, does the error message in your reproducer only appear when building with Maven or also when building or executing something from Eclipse? I am curious, but not curious enough to install a PDE in Eclipse and try. I am just asking because I see you committed the Eclipse project config too (and BTW also class files from the target directory).

kriegaex avatar Jan 20 '22 11:01 kriegaex

@kriegaex no its in the .log file of the test workspace. and yes i see it in build only

cdietrich avatar Jan 20 '22 11:01 cdietrich

ps : i was not careful with commiting. the example was freshly created

cdietrich avatar Jan 20 '22 11:01 cdietrich

@cdietrich: FYI, in my fork I have removed all files not necessary to run the Maven build in order to minimise the repo a bit more. For my personal use, I also enabled manual GH workflow runs and reconfigured Tycho Surefire to display the test logs inline on the Maven console. I removed your extra GH workflow steps. Just search for !ENTRY in the GitHub log, e.g. in this one.

https://github.com/kriegaex/tycho-issue-542-reproducer

Let me know if you want a PR.

kriegaex avatar Jan 20 '22 12:01 kriegaex

hah i did not know the <showEclipseLog>true</showEclipseLog>

cdietrich avatar Jan 20 '22 12:01 cdietrich

i guess no pr is needed. one of the two version can be used to reproduce

cdietrich avatar Jan 20 '22 12:01 cdietrich

hah i did not know the <showEclipseLog>true</showEclipseLog>

Neither did I. Like I said, I am a Tycho noob. I was just wondering why in my project I saw it in the Maven log and quickly checked the plugin settings. It was easy enough to find. I have to thank my predecessor.

kriegaex avatar Jan 20 '22 12:01 kriegaex

I saw it in the Maven log and quickly checked the plugin settings. It was easy enough to find. I have to thank my predecessor.

I can only recommend to take a look at the documentation, it is not that bad.

You might find other options also interesting to see whats going on:

laeubi avatar Jan 22 '22 17:01 laeubi

Back to the original plugin. I just looked at an Eclipse Jenkins build running on Linux, and there is complains about Windows stuff it cannot find, just like on Windows it complains about missing MacOS stuff. But this time, the build does not continue but fails:

!ENTRY org.eclipse.compare.win32 4 0 2022-01-25 01:45:45.967
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Could not resolve module: org.eclipse.compare.win32 [272]
  Unresolved requirement: Require-Capability: eclipse.platform; filter:="(osgi.os=win32)"

	at org.eclipse.osgi.container.Module.start(Module.java:463)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.lambda$1(ModuleContainer.java:1834)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1829)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1775)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1739)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1661)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:228)
	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:339)

!ENTRY org.eclipse.ecf.provider.filetransfer.httpclient45.win32 4 0 2022-01-25 01:45:45.969
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Could not resolve module: org.eclipse.ecf.provider.filetransfer.httpclient45.win32 [279]
  Unresolved requirement: Require-Capability: eclipse.platform; filter:="(osgi.os=win32)"
  Unresolved requirement: Import-Package: org.apache.http.impl.auth.win; version="[4.5.0,5.0.0)"
    -> Export-Package: org.apache.http.impl.auth.win; bundle-symbolic-name="org.apache.httpcomponents.httpclient.win"; bundle-version="4.5.13.v20210128-2225"; version="4.5.13"; x-internal:="true"; uses:="org.apache.http,org.apache.http.auth,org.apache.http.client,org.apache.http.impl.auth,org.apache.http.protocol,org.apache.http.util"
       org.apache.httpcomponents.httpclient.win [271]
         Unresolved requirement: Require-Capability: eclipse.platform; filter:="(osgi.os=win32)"

	at org.eclipse.osgi.container.Module.start(Module.java:463)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.lambda$1(ModuleContainer.java:1834)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1829)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1775)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1739)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1661)
	at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:228)
	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:339)

!ENTRY org.eclipse.osgi 4 0 2022-01-25 01:45:46.160
!MESSAGE Application error
!STACK 1
java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons: 
	no swt-pi4-gtk-4946r21 in java.library.path: /usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib
	no swt-pi4-gtk in java.library.path: /usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib
	no swt-pi4 in java.library.path: /usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib
	Can't load library: /home/jenkins/.swt/lib/linux/x86_64/libswt-pi4-gtk-4946r21.so
	Can't load library: /home/jenkins/.swt/lib/linux/x86_64/libswt-pi4-gtk.so
	Can't load library: /home/jenkins/.swt/lib/linux/x86_64/libswt-pi4.so

	at org.eclipse.swt.internal.Library.loadLibrary(Library.java:348)
	at org.eclipse.swt.internal.Library.loadLibrary(Library.java:257)
	at org.eclipse.swt.internal.gtk.OS.<clinit>(OS.java:95)
	at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:209)
	at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:155)
	at org.eclipse.swt.widgets.Display.<clinit>(Display.java:165)
	at org.eclipse.ui.internal.Workbench.createDisplay(Workbench.java:730)
	at org.eclipse.ui.PlatformUI.createDisplay(PlatformUI.java:168)
	at org.eclipse.ui.internal.ide.application.IDEApplication.createDisplay(IDEApplication.java:182)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:125)
	at org.eclipse.tycho.surefire.osgibooter.UITestApplication.runApplication(UITestApplication.java:29)
	at org.eclipse.tycho.surefire.osgibooter.AbstractUITestApplication.run(AbstractUITestApplication.java:122)
	at org.eclipse.tycho.surefire.osgibooter.UITestApplication.start(UITestApplication.java:35)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:136)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1467)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1440)

I am not sure if the callstack on the bottom is related. It might simply be caused by SWT or GTK missing on the library path or on the whole system. Anyway, the first two errors still remain.

kriegaex avatar Jan 25 '22 02:01 kriegaex

This should now be fixed please try out the current tycho snapshot build.

laeubi avatar Dec 24 '22 08:12 laeubi