Re: Trouble with JAR resources
Marco Trudel <[email protected]>
| Newsgroups | gmane.comp.gcc.java.devel |
|---|---|
| Message-ID | <[email protected]> |
Andrew Haley wrote: > Thomas Christensen wrote: > >> I have compiled SWT/JFACE jars to object files without any issues, but I >> have a little trouble linking them with my app. >> >> It seems I have compiled some resources from the jars into the objects, >> and they conflict, since they are present in multiple jars. >> >> The jars in question are: >> >> org.eclipse.core.commands_3.4.0.I20080509-2000.jar >> org.eclipse.equinox.common_3.4.0.v20080421-2006.jar >> org.eclipse.jface_3.4.1.M20080827-2000.jar >> org.eclipse.osgi_3.4.2.R34x_v20080826-1230.jar >> org.eclipse.swt.gtk.linux.x86_3.4.1.v3449c.jar >> >> from Eclipse Classic 3.4.1. >> >> I issue the command: >> >> $ gcj --main=Foo org.eclipse.core.commands_3.4.0.I20080509-2000.o org.eclipse.equinox.common_3.4.0.v20080421-2006.o org.eclipse.jface_3.4.1.M20080827-2000.o org.eclipse.osgi_3.4.2.R34x_v20080826-1230.o org.eclipse.swt.gtk.linux.x86_3.4.1.v3449c.o Foo.o -o foo >> >> and get multiple link errors like these: >> >> org.eclipse.equinox.common_3.4.0.v20080421-2006.o:(.rodata+0x0): multiple definition of `java resource META__U2d_INF/ECLIPSE.SF' >> /usr/bin/ld: Warning: size of symbol `java resource META__U2d_INF/ECLIPSE.SF' changed from 9564 in org.eclipse.core.commands_3.4.0.I20080509-2000.o to 6528 in org.eclipse.equinox.common_3.4.0.v20080421-2006.o >> >> Can I avoid adding these resources when compiling the jars? Or maybe >> strip them from the object files? > > Not easily. I'd either strip them from the jars before compiling or > compile with -findirect-dispatch. An easy temporary solution might also be -Wl,--allow-multiple-definition. Marco > Andrew.