Issue 63390 - Running SDK examples with gcj
Summary: Running SDK examples with gcj
Status: CLOSED WONT_FIX
Alias: None
Product: porting
Classification: Code
Component: code (show other issues)
Version: OOo 2.0.2
Hardware: All Linux, all
: P3 Trivial (vote)
Target Milestone: DevTools
Assignee: sparcmoz
QA Contact: issues@porting
URL:
Keywords:
Depends on: 63812
Blocks:
  Show dependency tree
 
Reported: 2006-03-20 10:19 UTC by sparcmoz
Modified: 2007-02-10 09:04 UTC (History)
3 users (show)

See Also:
Issue Type: TASK
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
Fix Bootstrap.bootstrap() with gcj/gij (1.33 KB, patch)
2006-03-21 09:17 UTC, sparcmoz
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description sparcmoz 2006-03-20 10:19:36 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.
Comment 1 sparcmoz 2006-03-20 10:19:57 UTC
set target
Comment 2 sparcmoz 2006-03-21 09:15:52 UTC
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.

Comment 3 sparcmoz 2006-03-21 09:17:53 UTC
Created attachment 35085 [details]
Fix Bootstrap.bootstrap() with gcj/gij
Comment 4 Stephan Bergmann 2006-03-21 11:08:51 UTC
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.
Comment 5 sparcmoz 2006-03-30 11:30:44 UTC
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. 
Comment 6 Stephan Bergmann 2006-03-30 12:30:49 UTC
Created separate issue 63812 for the gij VerifyError problem.
Comment 7 sparcmoz 2007-02-10 09:04:07 UTC
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.
Comment 8 sparcmoz 2007-02-10 09:04:52 UTC
Close