Bug 542426 - Fail to load of libswt-pi3-gtk does not give indication as to recommended/supported versions
Summary: Fail to load of libswt-pi3-gtk does not give indication as to recommended/sup...
Status: CLOSED DUPLICATE of bug 542101
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.10   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2018-12-05 05:19 EST by Jonah Graham CLA
Modified: 2018-12-19 15:31 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonah Graham CLA 2018-12-05 05:19:29 EST
The checks in Display.java (createDisplay) are not sufficient to warn users about wrong version of GTK. When the library cannot be loaded in OS.java's static initializer it is not even possible to do the version check. 

So for example, instead of a warning about versions, you get this if trying to run Eclipse on too old GTK:

/home/tools/local/java/Linux64/jdk8u172-b11/bin/java: symbol lookup error: /home/hall/eclipse.2018.12/eclipse/configuration/org.eclipse.osgi/456/0/.cp/libswt-pi3-gtk-4922r31.so: undefined symbol: gtk_text_view_accessible_get_type

See also https://www.eclipse.org/lists/platform-swt-dev/msg08562.html which may have some useful background discussion that led to this bug report.
Comment 1 Eric Williams CLA 2018-12-05 11:17:15 EST
Looking at this issue a bit further today: the crash doesn't happen in the load lib call in OS.java, it happens when the macro is actually called in AccessibleObject. If I try to run Eclipse on GTK 3.6.6 with SWT from master as of today (i.e. with the min version bumped to 3.8.0), then the warning triggers properly in Display.

I think the reason you weren't seeing this before is because 3.6.6 > 3.6.0, thus the warnings in Display never ran but the crash happened anyway. This makes sense as the OS.java load lib calls should only fail if the .so files are missing/not available -- the symbol checks (which is the crash you see here) would be done when the function is actually called. The reason you see such a crash when Eclipse is started is because the workspace launcher has a text box in it which creates an AccessibleObject of type text.

If I try to run Snippet1 on GTK3.6, SWT crashes on a symbol lookup error for gtk_container_accessible_get_type() -- another accessibility function which was likely not made public until GTK3.8. I believe this stems from the custom code where we implement the SwtFixedAccessible AtkObject.

Now, on the subject of adding a version check if SWT fails to load the library: I also don't think this is possible. To check the GTK, SWT uses gtk_check_version(). If the libraries haven't loaded or were not able to load, then this call isn't possible -- so there isn't much information we can provide WRT GTK version in this case.

Bottom line: I think the issue you are experiencing is solved by bumping the minimum version to 3.8.0.
Comment 2 Jonah Graham CLA 2018-12-05 11:21:03 EST
Thanks Eric for the thorough diagnosis. I'll retest soon with an I build on the machine and if we get the version warning then we can close this as a duplicate of the bug you changed the min version in.
Comment 3 Alexander Kurtakov CLA 2018-12-19 04:06:16 EST
Jonah, is this fixed now?
Comment 4 Jonah Graham CLA 2018-12-19 15:30:35 EST
I had someone with access to the problematic machine test it. Short answer is that this is much improved with the min version being checked in SWT with the warning message. I also really appreciate the documentation/plan updates that make it clear what the version of GTK required is. Thank you all for that.

---

This is the longer answer I got:

Hi Jonah,

Looks like it worked - here is what was written to stdout/stderr on the run:

 $ ~user/Downloads/eclipse/eclipse 
***WARNING: GTK+ version too old (micro mismatch)
***WARNING: SWT requires GTK 3.8.0
***WARNING: Detected: 3.6.2
/home/tools/local/java/Linux64/jdk8u172-b11/bin/java: symbol lookup error: /home/user/Downloads/eclipse/configuration/org.eclipse.osgi/162/0/.cp/libswt-pi3-gtk-4922r32.so: undefined symbol: gtk_text_view_accessible_get_type

Note that we still see a java abort window first:

JVM terminated. Exit code=127
/home/tools/local/java/Linux64/jdk8u172-b11/bin/java
-Dosgi.requiredJavaVersion=1.8
-Dosgi.dataAreaRequiresExplicitInit=true
-Xms40m
-Xmx512m
-jar /home/user/Downloads/eclipse//plugins/org.eclipse.equinox.launcher_1.5.200.v20180922-1751.jar
-os linux
-ws gtk
-arch x86_64
-showsplash
-launcher /home/user/Downloads/eclipse/eclipse
-name Eclipse
--launcher.library /home/user/Downloads/eclipse//plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.900.v20180922-1751/eclipse_1801.so
-startup /home/user/Downloads/eclipse//plugins/org.eclipse.equinox.launcher_1.5.200.v20180922-1751.jar
--launcher.appendVmargs
-exitdata 330007
-vm /home/tools/local/java/Linux64/jdk8u172-b11/bin/java
-vmargs
-Dosgi.requiredJavaVersion=1.8
-Dosgi.dataAreaRequiresExplicitInit=true
-Xms40m
-Xmx512m
-jar /home/user/Downloads/eclipse//plugins/org.eclipse.equinox.launcher_1.5.200.v20180922-1751.jar
Comment 5 Jonah Graham CLA 2018-12-19 15:31:54 EST

*** This bug has been marked as a duplicate of bug 542101 ***