Bug 238681

Summary: problem with swt cairo
Product: [Fedora] Fedora Reporter: Christoph Höger <choeger>
Component: eclipseAssignee: Ben Konrath <ben>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: 3.2.2-7.fc6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-09-05 19:56:07 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Christoph Höger 2007-05-02 09:18:30 UTC
Description of problem:
When I tried to fix a bug in eclipse-gmf (which is filed under
https://www.eclipse.org/bugs/show_bug.cgi?id=159840 )
I stumpled upon libcairo-swt.so missing in my system, which should be located
under /usr/lib/eclipse.

Version-Release number of selected component (if applicable):
eclipse-platform-3.2.2-2.fc6

I'm not quite sure if this is actually a bug or a feature (like someone moved
that lib) but it seems that there are eclipse plugins that rely on libcairo-swt.
Please correct me, if I'm wrong, but I think this library is actually missing.

Comment 1 Ben Konrath 2007-05-02 12:12:21 UTC
You're right, it's missing. It's something I need to sort out - actually I'm not
even sure what it does or which plugins use it. Any help would be appreciated.

Comment 2 Christoph Höger 2007-05-02 14:42:02 UTC
Hi,

I just tried and took libcairo-swt.so from the official stable eclipse-swt
release. Using the LD_PRELOAD Directive a could workaround the original bug.
There are still some display bugs, but it works.

The reason libcairo-swt.so is needed is, that some swt applications make use of
fancy features, like anti-aliasing and stuff. To do that swt uses cairo. So
libcairo-swt.so is probably the swt binding for cairo and should be included in
the fedora rpm AFAP (IMHO). 

Next Step would be to look for the bug I mentioned and track it down. This bug
has to do something with library conflicts.
 

Comment 3 Ben Konrath 2007-05-07 06:52:04 UTC
(In reply to comment #2)
> The reason libcairo-swt.so is needed is, that some swt applications make use of
> fancy features, like anti-aliasing and stuff. To do that swt uses cairo. So
> libcairo-swt.so is probably the swt binding for cairo and should be included in
> the fedora rpm AFAP (IMHO). 

I looked into this a little and I don't think that we should be including
libcairo-swt.so. It seems that libcario-swt.so is a fall back version of cairo
in case the system cairo doesn't load or isn't available:

void checkCairo() {
	if (CAIRO_LOADED) return;
	try {
		/* Check if cairo is available on the system */
		byte[] buffer = Converter.wcsToMbcs(null, "libcairo.so.2", true);
		int /*long*/ libcairo = OS.dlopen(buffer, OS.RTLD_LAZY);
		if (libcairo != 0) {
			OS.dlclose(libcairo);
		} else {
			try {
				System.loadLibrary("cairo-swt");
			} catch (UnsatisfiedLinkError e) {
				/* Ignore problems loading the fallback library */
			}
		}
		Class.forName("org.eclipse.swt.internal.cairo.Cairo");
		CAIRO_LOADED = true;
	} catch (Throwable t) {
		SWT.error(SWT.ERROR_NO_GRAPHICS_LIBRARY, t, " [Cairo is required]");
	}
}

from:
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt/Eclipse%20SWT/gtk/org/eclipse/swt/graphics/Device.java?revision=1.57&view=markup&pathrev=v3236b

Perhaps the system cairo is not loading with our packages. Can you provide test
case that demonstrates that cairo isn't loading? - a series of steps or actions
should be fine. Thanks.

Comment 4 Christoph Höger 2007-05-07 11:39:43 UTC
The library is obviously loaded:

java    4502 choeger  mem    REG        8,6   439820 1792087
/usr/lib/libcairo.so.2.9.3

The problem seems to be the use of AA and such things. Perhaps it is some kind
of version problem.

Comment 5 Ben Konrath 2007-05-16 07:46:35 UTC
Can you provide a serise of steps I can do to see the problem?

Comment 6 Christoph Höger 2007-05-22 17:29:30 UTC
Hi,

sorry for the late answer, here are the steps

1. take fresh fedora eclipse
2. install gmf from callisto update site (hence there is no fedora rpm)
3. create (or load a sample) .ecore diagram using emf ecore editor
4. choose "initialice ecore_diagram" in its context menu
5. you won't see anything, were a nice UML diagram should be

this is essentially the bug that is filed in eclipses bugzilla (see above)

if you
1. start eclipse with LD_PRELOAD=libcairo-swt.so
2. open the same diagram in the gmf editor
3. you see (a bit ugly) the UML diagram

Comment 7 Ben Konrath 2007-06-04 05:57:43 UTC
Ok, I think you're hitting this bug:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=150357

I should be able to add a patch to swt to fix this. I'll report back when I have
a set of packages that need testing. Thanks, Ben

Comment 8 Ben Konrath 2007-06-07 05:03:36 UTC
Updated packages have been released to updates-testing. Please test these
packages and report back. You can install the updated packages with:

sudo yum --enablerepo=updates-testing install eclipse-sdk

Thanks, Ben

Comment 9 Christoph Höger 2007-06-07 14:12:30 UTC
Hey,

great! The gfx work perfectly.

thank you!