Apache OpenOffice (AOO) Bugzilla – Issue 63390
Running SDK examples with gcj
Last modified: 2007-02-10 09:04:52 UTC
Some SDK examples have been tested on GNU/Linux Sparc m159 with gcc4.1 The SDK has hardcoded java, javac and jar commands. Sometimes it is desired to use gcj, gij and fastjar instead. Some sdk examples can be built and run with gcj, others get errors. The task is to modify the configuration files to understand gcj, so the following is only a "proof of concept". For an example have a look at examples/DevelopersGuide/ProfUNO/InterprocessConn/ConnectionAwareClient.java. Refer to Developer's Guide 3.3.1 UNO Interprocess Connections for more explanation of this example. Follow the usual steps to configure the SDK environment, but the Java will not be configured (in a nutshell, simply run ./setsdkenv_unix). Edit examples/DevelopersGuide/ProfUNO/InterprocessConn/Makefile as follows near line 62 using your path/to/gcj: SDK_JAVAC=/usr/local/4.1/bin/gcj -C SDK_JAVA=/usr/local/4.1/bin/gij # Targets Then: make This provides some instructions to start the soffice listening. Next export LD_LIBRARY_PATH=/usr/local/4.1/lib:$LD_LIBRARY_PATH to prevent this error: Exception in thread "main" java.awt.AWTError: Cannot load AWT toolkit: gnu.java.awt.peer.gtk.GtkToolkit Then make ConnectionAwareClient.run This makes a connection and provides a small window with buttons that launch new writer or calc docs. But the examples in FirstSteps will die silently without making a connection. The same results are seen with debian java-gcj-compat (gcj4.0 with java/javac commands) on GNU/Linux sparc and intel.
set target
The examples in First Steps and others rely on method bootstrap() in the class com.sun.star.comp.helper.Bootstrap. This method dies silently when executed with gij as may be seen by running the very simple test program in examples/DevelopersGuide/FirstSteps/FirstUnoContact.java Some tracing in Bootstrap.java (module javaunohelper) revealed that this statement would never return: XUnoUrlResolver xUrlResolver = UnoUrlResolver.create( xLocalContext ); So I searched for a different means to get the xUrlResolver and found it in bean/com/sun/star/beans/LocalOfficeConnection.java The attached patch allows examples to succeed with gcj/gij on GNU/Linux Sparc in FirstSteps, ProfUNO and OfficeDev, in each case a connection is made and examples perform as expected. I will need test all examples and report.
Created attachment 35085 [details] Fix Bootstrap.bootstrap() with gcj/gij
UnoUrlResolver.create is Java code generated directly in codemaker/source/javamaker/javatype.cxx (it directly emits Java classfiles, not Java source code). If gcj has problems executing that method, there probably is something fundamentally wrong with either the generated bytecode or gcj, and the problem will probably occur for the constructors (i.e., create methods) of other new-style UNO services, too. Thus, the proposed patch would only heal this one place; we should instead find out what the real problem is that causes gcj problems executing such generated methods.
When bootstrap exits the verbose output from gij ends with: [Loaded (bytecode) com.sun.star.bridge.UnoUrlResolver from (file:/home/jim/o161/program/classes/ridl.jar.1.1 <no certificates>)] [Loaded (pre-compiled) java.lang.VerifyError from <no code source>] And I learned this much: public class VerifyError extends LinkageError Thrown when the "verifier" detects that a class file, though well formed, contains some sort of internal inconsistency or security problem.
Created separate issue 63812 for the gij VerifyError problem.
The SDK examples generally will run properly when OOo is compiled using the Eclispe java compiler (ecj). Debian/unstable provides ecj as part of the java-gcj-compat packge and eclipse will be in GCC4.3. It appears gcj < 4.3 will probably never be suitable so I will close this issue as wontfix and make some new issue later for testing sdk with ecj.
Close