Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 335737 - java.lang.UnsatisfiedLinkError on AIX Motif (ppc32) for for libswt-awt-motif-3650.a.
Summary: java.lang.UnsatisfiedLinkError on AIX Motif (ppc32) for for libswt-awt-motif-...
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.6   Edit
Hardware: Other AIX
: P3 critical (vote)
Target Milestone: ---   Edit
Assignee: Bogdan Gheorghe CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-28 16:43 EST by stuart pond CLA
Modified: 2017-12-06 01:52 EST (History)
4 users (show)

See Also:


Attachments
Libraries linked against Java6 (1.88 MB, application/x-java-archive)
2011-02-07 11:59 EST, Bogdan Gheorghe CLA
no flags Details
Makefile for Java6 to link .so instead of .a (2.82 KB, application/x-zip-compressed)
2011-03-11 14:47 EST, stuart pond CLA
no flags Details
This is the update to the makefile (2.82 KB, application/octet-stream)
2011-03-11 14:52 EST, stuart pond CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description stuart pond CLA 2011-01-28 16:43:42 EST
Build Identifier: Helios 3.6.0

I have a large RCP Application built against Java 6, Eclipse 3.6.0.  This application leverages the AWT_SWT bridge.  I get the following error on AIX.
oslevel -s says: 6100-06-02-1044

ERROR 2011-01-28 15:21:33,459 - org.eclipse.core.runtime - org.eclipse.ui - 0 - Unhandled event loop exception
org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons: 
	/scratch/spond/lala/org.eclipse.osgi/bundles/507/1/.cp/libswt-awt-motif-3650.a (A file or directory in the path name does not exist.)
	swt-awt-motif (Not found in java.library.path)
	/scratch/swtlib-32/libswt-awt-motif-3650.a (A file or directory in the path name does not exist.)
	/scratch/swtlib-32/libswt-awt-motif.a (A file or directory in the path name does not exist.)
)
	at org.eclipse.swt.SWT.error(SWT.java:4083)
	at org.eclipse.swt.SWT.error(SWT.java:3998)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:137)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3200)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2898)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2629)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2427)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:663)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at com.teamcenter.rac.aifrcp.Application.runApplication(Unknown Source)
	at com.teamcenter.rac.aifrcp.Application.start(Unknown Source)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:600)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1407)

When you navigate to that location for libswt-awt-motif-3650.a. The file is in fact there. I wrote a C program which does a dlopen on the file and this is the output:

Error: 	0509-022 Cannot load module ./507/1/.cp/libswt-awt-motif-3650.a.
	0509-150   Dependent module libjawt.a could not be loaded.
	0509-022 Cannot load module libjawt.a.
	0509-026 System error: A file or directory in the path name does not exist.
	0509-022 Cannot load module ./507/1/.cp/libswt-awt-motif-3650.a.
	0509-150   Dependent module ./507/1/.cp/libswt-awt-motif-3650.a could not be loaded.

Reproducible: Always

Steps to Reproduce:
Only happens on our large RCP Application.  Attempts to reproduce with a smaller RCP application were un-successful.
Comment 1 Felipe Heidrich CLA 2011-01-31 11:21:20 EST
Can you try your C program but this time make sure that ($java)/jre/bin  and ($java)/jre/lib/ppc is in the LD_LIBRARY_PATH. 
(not that path above can be different on your library, make sure that dir that contains  libjawt.a is in the LD_LIBRARY_PATH)
Comment 2 stuart pond CLA 2011-01-31 15:00:00 EST
We are running java 1.6. The output of java -version is the following:
java version "1.6.0"
Java(TM) SE Runtime Environment (build pap3260sr8-20100409_01(SR8))
IBM J9 VM (build 2.4, JRE 1.6.0 IBM J9 2.4 AIX ppc-32 jvmap3260sr8-20100401_55940 (JIT enabled, AOT enabled)
J9VM - 20100401_055940
JIT  - r9_20100401_15339
GC   - 20100308_AA)
JCL  - 20100408_01

There is no libjawt.a found anywhere under the JRE6 path. There exists a libjawt.so found in the jre\lib\ppc folder.  The libjawt.a file can also be found under an older version of Java 1.5 that we are not currently using. So it use to be bundled with Java on AIX.

Anyways, I did make sure that jre\lib\ppc folder that containst the libjawt.so  was found in the LD_LIBRARY_PATH and re-ran my C program that attempts to dll open the motif library.

Error: 	0509-022 Cannot load module ./507/1/.cp/libswt-awt-motif-3650.a.
	0509-150   Dependent module libjawt.a could not be loaded.
	0509-022 Cannot load module libjawt.a.
	0509-026 System error: A file or directory in the path name does not exist.
	0509-022 Cannot load module ./507/1/.cp/libswt-awt-motif-3650.a.
	0509-150   Dependent module ./507/1/.cp/libswt-awt-motif-3650.a could not be loaded.

Any other suggestions?
Comment 3 Felipe Heidrich CLA 2011-01-31 15:18:52 EST
Can you use a VM that has the libjawt.a file. Does that work ?

Can you try to recompile the SWT using your VM (1.6) ?

last hack idea, can you create a symbolic link named libjawt.a that points to libjawt.so. Does that work ?
Comment 4 stuart pond CLA 2011-01-31 16:16:57 EST
By creating symbolic link between the libjawt.so to libjawt.a my dlopen program got further but it failed to find libjava.so

To me the problem looks to be that the AIX SWT libraries were linked against Java 1.5 where the shared objects were *.a files.  In Java 1.6 many of those files are now packaged as .so files and thus will not work.

Is there anyway we could get a version Motif/AIX libraries liknked against Java 1.6?
Comment 5 Bogdan Gheorghe CLA 2011-01-31 17:50:27 EST
Do you get any further if you create an archive file named libjawt.a and stuff libjawt.so in there? ("ar -v -q libjawt.a libjawt.so")
Comment 6 stuart pond CLA 2011-02-01 10:34:12 EST
Creating a new archive libjawt.a with the libjawt.so does not work.  However, I got my C program that does the dlopen the SWT_AWT motif library to successfully load by creating symbolic links for all the java jre .so files to .a and then munging the $LIBPATH environment variable to pick those libraries up first. 

Obviously this work around will not scale to my RCP application but it clearly demonstrates the problem is Eclipse RCP using the Swing bridge will not work correctly on IBM Java6.

How can I a version of AIX32 Motif SWT Jars that are linked against Java6 and not Java5?
Comment 7 Felipe Heidrich CLA 2011-02-01 10:49:44 EST
(In reply to comment #6)
> How can I a version of AIX32 Motif SWT Jars that are linked against Java6 and
> not Java5?

I don't think we can put this change into 3.6.2 build as it will invalidate all the testing that has already being done for the product.

Bogdan ?
Comment 8 stuart pond CLA 2011-02-01 10:55:38 EST
Can you provide a test only version of the SWT plugins that are linked against Java6 so I can validate one way or another the problem goes away in our RCP application
Comment 9 Felipe Heidrich CLA 2011-02-01 11:02:42 EST
We can not change the code in the repository for 3.6.2:
http://www.eclipse.org/projects/project-plan.php?planurl=http://www.eclipse.org/eclipse/development/plans/eclipse_project_plan_3_6.xml#target_environments

IBM AIX 5.3 Power 32-bit IBM Java 5 SR11 Motif 2.1

We will try to build the plugin for you.
Comment 10 stuart pond CLA 2011-02-01 11:05:27 EST
Great, but remember I need it for Java 1.6 not Java 1.5
Comment 11 Bogdan Gheorghe CLA 2011-02-01 11:07:16 EST
Felipe is right - can't change anything for 3.6.2 which is almost out. I'll try to get the libraries compiled against 6 for you to test.
Comment 12 stuart pond CLA 2011-02-07 09:12:00 EST
Any luck with getting test version of the libraries compiled against Java 6?
Comment 13 Bogdan Gheorghe CLA 2011-02-07 11:55:45 EST
Here are the steps I took to build this (in case you need to recompile it on your own):

1. Check out swt and the AIX fragment from the 3_6_maintenance branches

2. Copy .classpath_motif to classpath and change the PI/motif classpath entry attribute to 

	<attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="org.eclipse.swt.motif.aix.ppc"/>

3. In org.eclipse.swt tasks folder, edit the build.xml file. Update the build_motif_aix task by changing the JAVA_HOME env var and the AWT_HOME env var to point to the proper Java6 directories. For me this was:

JAVA_HOME - [JRE install dir]/sdk/
AWT_HOME - [JRE install dir]/sdk/jre/lib/ppc

4. Since some of the header files got moved around in Java6, you need to add an include in Eclipse SWT PI/motif/make_aix.mak:

Add the following line to the CFLAGS section:

-I$(JAVA_HOME)/include/aix \

5. Seems like the AWT_LIBS var needed changing in order to find libjawt.so. Replace the existing AWT_LIBS with:

AWT_LIBS = $(AWT_HOME)/libjawt.so -lX11 -bnoentry -bexpall -lc
Comment 14 Bogdan Gheorghe CLA 2011-02-07 11:59:50 EST
Created attachment 188455 [details]
Libraries linked against Java6

Here is the jar with the libraries.
Comment 15 stuart pond CLA 2011-02-18 13:46:48 EST
Thank you for building and providing a patch.  However, I am still seeing the same problem.  I ran my C program that does a dlopen on the libswt-awt-motif-3659.a file with the right path setup and got the following error.

Error: 	0509-022 Cannot load module /u/spond/Teamcenter/RAC/9000.0.0/111117112024/org.eclipse.osgi/bundles/483/1/.cp/libswt-awt-motif-3659.a.
	0509-150   Dependent module /bluebird/teamswt/swt-builddir/JDKs/AIX/PPC32/sdk/jre/lib/ppc/libjawt.so could not be loaded.
	0509-022 Cannot load module /bluebird/teamswt/swt-builddir/JDKs/AIX/PPC32/sdk/jre/lib/ppc/libjawt.so.
	0509-026 System error: A file or directory in the path name does not exist.
	0509-022 Cannot load module /u/spond/Teamcenter/RAC/9000.0.0/111117112024/org.eclipse.osgi/bundles/483/1/.cp/libswt-awt-motif-3659.a.
	0509-150   Dependent module /u/spond/Teamcenter/RAC/9000.0.0/111117112024/org.eclipse.osgi/bundles/483/1/.cp/libswt-awt-motif-3659.a could not be loaded.

Note the /bluebird/teamswt/swt-builddir/JDKs/AIX/...  I assume that is the hard path to your Java SDK.  Is it possible you are building with the wrong parameters to not make it variable?  Why is /bluebird/... even in the error output?

What would be the best next step from here?
Comment 16 stuart pond CLA 2011-02-21 14:16:29 EST
Guys, one of our local AIX guru's looked at it and noticed the following:

The link line above will never load properly:

AWT_LIBS = $(AWT_HOME)/libjawt.so -lX11 -bnoentry -bexpall -lc

1.	Have to use -L -l combination to find shared libraries not full path to binary or the runtime loader will not search LIBPATH
2.	Need -brtl flag to link to real shared libraries created with .so extension.  I imagine that the full path was added to get it link.
3.	It is preferred but not required to include -bnolibpath flag so that only shared objects are listed and not their location at build time.

AWT_LIBS = -brtl -bnolibpath -bnoentry -bexpall-L$(AWT_HOME) -ljawt.so -lX11

Is it possible for us to get another test patch with trying the above modification to build path?
Comment 17 Bogdan Gheorghe CLA 2011-02-22 10:02:10 EST
Sure, I can try again with the new settings. Stand by...
Comment 18 stuart pond CLA 2011-02-22 11:09:55 EST
Just saw a typo in email.  I left the .so on for libjawt.so should be -ljawt  :(

AWT_LIBS should be the following

AWT_LIBS = -brtl -bnolibpath -bnoentry -bexpall -L$(AWT_HOME) -ljawt -lX11

Note: it is -ljawt not -ljawt.so
Comment 19 stuart pond CLA 2011-02-28 18:17:24 EST
Just checking any progress on getting another patch built with the specified parameters?
Comment 20 stuart pond CLA 2011-03-11 14:47:47 EST
Created attachment 191022 [details]
Makefile for Java6 to link .so instead of .a

Makefile for Java6 to link .so instead of .a
Comment 21 stuart pond CLA 2011-03-11 14:52:17 EST
Created attachment 191025 [details]
This is the update to the makefile
Comment 22 stuart pond CLA 2011-03-11 14:59:14 EST
We have been successful in building against Java6 using the attached makefile.  I do not see how it is possible to dilver a solution that will work with both Java 6 and Java 5 properly given the difference between .so and .a
Comment 23 Bogdan Gheorghe CLA 2012-06-20 15:07:49 EDT
Even though we don't build Motif anymore, this could still be a problem on GTK.
Comment 24 Alexander Kurtakov CLA 2017-12-06 01:52:09 EST
SWT no longer provides AIX builds.