eclipse-platform / .github

Common contribution content for eclipse-platform repositories
https://www.eclipse.org/eclipse/
5 stars 10 forks source link

Following the CONTRIBUTING.md does not succeed succesfully #199

Closed tivervac closed 4 months ago

tivervac commented 5 months ago

Let's make sure issue is not already fixed in latest builds first.

Steps to reproduce

From a fresh installation and clean workspace:

I expected: A clean Eclipse to launch

But got: A stacktrace, see below

Here is some relevant log output

From <workspace>/.metadata/.log

WARNING: Using incubator modules: jdk.incubator.vector, jdk.incubator.foreign
SLF4J(W): No SLF4J providers were found.
SLF4J(W): Defaulting to no-operation (NOP) logger implementation
SLF4J(W): See https://www.slf4j.org/codes.html#noProviders for further details.
OpenJDK 64-Bit Server VM warning: You have loaded library /home/t21/platform-sdk/git/eclipse.platform.swt/binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-gtk-4965r6.so which might have disabled stack guard. The VM will try to fix the stack guard now.
It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
!SESSION 2024-04-22 17:23:53.934 -----------------------------------------------
eclipse.buildId=unknown
java.version=17.0.9
java.vendor=Eclipse Adoptium
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Framework arguments:  -product org.eclipse.sdk.ide
Command-line arguments:  -product org.eclipse.sdk.ide -data /home/t21/platform-sdk/ws/../runtime-workspace -dev file:/home/t21/platform-sdk/ws/.metadata/.plugins/org.eclipse.pde.core/Runtime Workspace/dev.properties -os linux -ws gtk -arch x86_64 -consoleLog

!ENTRY org.eclipse.osgi 4 0 2024-04-22 17:23:54.794
!MESSAGE Application error
!STACK 1
java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons: 
    /home/t21/platform-sdk/git/eclipse.platform.swt/binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-gtk-4965r6.so: /home/t21/platform-sdk/git/eclipse.platform.swt/binaries/org.eclipse.swt.gtk.linux.x86_64/libswt-gtk-4965r6.so: invalid ELF header
    no swt-gtk in java.library.path: /usr/lib64/firefox:/usr/lib64/firefox/plugins:/usr/lib64/firefox:/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib
    no swt in java.library.path: /usr/lib64/firefox:/usr/lib64/firefox/plugins:/usr/lib64/firefox:/usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib
    /home/t21/.swt/lib/linux/x86_64/libswt-gtk-4965r6.so: /home/t21/.swt/lib/linux/x86_64/libswt-gtk-4965r6.so: invalid ELF header
    Can't load library: /home/t21/.swt/lib/linux/x86_64/libswt-gtk.so
    Can't load library: /home/t21/.swt/lib/linux/x86_64/libswt.so
    /home/t21/.swt/lib/linux/x86_64/libswt-gtk-4965r6.so: /home/t21/.swt/lib/linux/x86_64/libswt-gtk-4965r6.so: invalid ELF header

    at org.eclipse.swt.internal.Library.loadLibrary(Library.java:345)
    at org.eclipse.swt.internal.Library.loadLibrary(Library.java:254)
    at org.eclipse.swt.internal.C.<clinit>(C.java:19)
    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:170)
    at org.eclipse.ui.internal.Workbench.createDisplay(Workbench.java:721)
    at org.eclipse.ui.PlatformUI.createDisplay(PlatformUI.java:185)
    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.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:208)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:143)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:109)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:439)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:271)
    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:679)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:616)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1492)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1465)
An error has occurred. See the log file
/home/t21/platform-sdk/runtime-workspace/.metadata/.log.

Tested under this environment:

Fix

I figured out through this ticket that one of the libraries wasn't correctly cloned because I didn't have git lfs installed.

A sudo yum install git-lfs and a cd platform-sdk/git/eclipse.platform.swt; rm -rf binaries; git reset --hard origin/master fixed it.

I'm unsure how we best solve this. Ideally this would be done in Oomph, but I suppose Oomph can't just install git-lfs. The second best choice would be for Oomph to fail and tell me that I need to enable git lfs. The least convenient, but easiest to implement solution, would be to just add the git-lfs requirement in the CONTRIBUTING.md.

Community

merks commented 5 months ago

This sounds familiar but also like something @HannesWell has already addressed in oomph by ensuring that egit/jgit lfs support is installed and the appropriate preferences are set.

merks commented 5 months ago

This commit history suggests the changes to support this should already be in place

https://github.com/eclipse-platform/eclipse.platform.swt/commits/master/bundles/org.eclipse.swt.tools/Oomph/platformSwt.setup

I can try it myself tomorrow.

tivervac commented 5 months ago

Hmm I didn't have the Enable LFS support globally option in Eclipse enabled, but I also didn't have git-lfs installed at all

merks commented 5 months ago

It's really strange because that preference is set and the bundle is installed here by the parent project of SWT's setup:

image

And in the performer I can see those tasks:

image

merks commented 5 months ago

If I create an IDE just for SWT, then I see LFS is installed:

image

I think the preference is set:

image

And I can create a runtime workbench that is definitely using the SWT from the workspace:

image

I don't have a good theory for why you would see something different...

tivervac commented 5 months ago

I'm on a different computer today, and I tried the same. Same environment (no LFS installed), same error messages, same fix

HeikoKlare commented 5 months ago

A sudo yum install git-lfs and a cd platform-sdk/git/eclipse.platform.swt; rm -rf binaries; git reset --hard origin/master fixed it.

Is it expectable that installing git-lfs solves the problem? From my understanding, JGit, as used by the Oomph installer, should be independent from any git package installed on the system, shouldn't it?

I tried to reproduce the problem (on Ubuntu 22.04.4) with no git-lfs installed (a git clone on the SWT repo via system shell fails as expected). The Oomph setup still runs fine, including a successful LFS checkout via JGit .

merks commented 5 months ago

Indeed, I would expect installing org.eclipse.jgit.lfs would allow the clone task in the IDE to do anything related to LFS support even with no native git installed.

@tivervac

If you do Help -> Perform Setup Tasks and select the p2 director, is org.eclipse.jgit.lfs in the list?

image

I assume it must be present...

I wonder if it's possible that some global git configuration is causing some unintended/unexpected interaction?

tivervac commented 5 months ago

@merks Seems to be present indeed

image

My global .gitconfig looks like below. I don't see any issues with that. The git hook shouldn't be in the way either.

[color]
  ui = true
[core]
  editor = vim
  hooksPath = ~/.config/git/hooks/
[diff]
  tool = vscode
[alias]
  unstage = reset HEAD --
  pushf = push --force-with-lease
  mergeff = merge --ff-only
  l   = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
  c   = commit
  p   = push
  rekt = status
  s   = status
  d   = diff
  a   = add -A
  ch  = checkout
  b   = branch
  rpr = remote prune origin
  f   = fetch --all
  rom = rebase origin/master
  lom = l origin/master
  cp  = cherry-pick
[credential]
  helper = cache --timeout=3600
[push]
  default = current
[gui]
    spellingdictionary = none
    commitmsgwidth = 72
[protocol]
    version = 2
[gpg]
    program = gpg2
[pull]
    rebase = true
merks commented 5 months ago

@tivervac

If JGit LFS is installed then this preference page should have the button enabled:

image

And the setup should have set the following preference to be check marked.

image

With those in place, clones should just use LFS support.

@tomaswolf

Is there something in @tivervac settings that might cause the IDE to use natively installed git "things" such that JGit's LFS support is not being used as expected?

tivervac commented 5 months ago

The button is visible and the checkmark is enabled

merks commented 5 months ago

So everything appears to be installed and configured appropriately which leave the mystery of why cloning does materialize the LFS content. Even a manually created new clone should "just work" in this installation, but I assume that if you manually create another clone of SWT, that also doesn't work properly...

tomaswolf commented 5 months ago

I don't know what might be the problem. But the built-in LFS support in JGit has issues. Possibly one of these causes trouble in tivervac's setup.

tivervac commented 5 months ago

Recloning SWT via egit works, however, by now I've already pressed the Enable LFS support globally button...

merks commented 5 months ago

I wonder what that button does. I've never pushed it...

Can you see something (some change) in one of the Git configuration settings? Oomph does support setting the configuration automatically e.g,.

image

So if there is something we could set directly, that would be good to know and do...

merks commented 5 months ago

I'm not sure these is actionable left here? 😢

tivervac commented 4 months ago

Sadly, I don't think so either. I tried reoomphing a final time and now it simply works.