Bug 143881 - Gcj will not execute javacc from JPackage
Gcj will not execute javacc from JPackage
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: java-1.4.2-gcj-compat (Show other bugs)
rawhide
powerpc Linux
medium Severity medium
: ---
: ---
Assigned To: Thomas Fitzsimmons
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-12-31 10:07 EST by W. Michael Petullo
Modified: 2007-11-30 17:10 EST (History)
1 user (show)

See Also:
Fixed In Version: jpackage-utils-1.6.2-1jpp_2rh
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-01-19 16:31:24 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description W. Michael Petullo 2004-12-31 10:07:02 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux ppc; en-US; rv:1.7.5)
Gecko/20041220 Epiphany/1.4.7

Description of problem:


Version-Release number of selected component (if applicable):
java-1.4.2-gcj-compat-1.4.2.0-21jpp with gcc-java-3.4.3-11

How reproducible:
Always

Steps to Reproduce:
Try to execute javacc-3.2-2jpp from the JPackage project.  It will
fail with:

[mike@imp ~]$ javacc
Exception in thread "main" java.lang.NoClassDefFoundError: error:
   at gnu.gcj.runtime.FirstThread.run() (/usr/lib/libgcj.so.5.0.0)
   at _Jv_ThreadRun(java.lang.Thread) (/usr/lib/libgcj.so.5.0.0)
   at _Jv_RunMain(java.lang.Class, byte const, int, byte const,
boolean) (/usr/lib/libgcj.so.5.0.0)

Additional info:
Comment 1 Thomas Fitzsimmons 2004-12-31 13:58:58 EST
I can't reproduce this on x86.  What does "which gcj" print?
Comment 2 W. Michael Petullo 2005-01-01 19:12:10 EST
[mike@imp ~]$ which gcj
/usr/bin/gcj

[mike@imp ~]$ which gij
/usr/bin/gij

[mike@imp ~]$ which java
/usr/bin/java
[mike@imp ~]$ ls -l /usr/bin/java
lrwxr-xr-x  1 root root 22 Jul 29 13:21 /usr/bin/java ->
/etc/alternatives/java
[mike@imp ~]$ ls -l /etc/alternatives/java
lrwxrwxrwx  1 root root 35 Dec 12 13:35 /etc/alternatives/java ->
/usr/lib/jvm/jre-1.4.2-gcj/bin/java
Comment 3 Thomas Fitzsimmons 2005-01-01 21:53:18 EST
I suspect this is a gcj/gij bug on powerpc.  Try running javacc with
gij directly:

export
CLASSPATH=/usr/share/java/javcc.jar:/usr/share/java/libgcj-3.4.3.jar
/usr/bin/gij -Djava.version=1.4.2
-Djava.home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre "javacc"
Comment 4 W. Michael Petullo 2005-01-02 12:50:17 EST
Yes, you seem to be correct.  Ant no longer works either.  I'm not
sure when this broke -- I track Raw Hide pretty closely -- but it did
work before.  I haven't been using Java for the last month or so.
Comment 7 Thomas Fitzsimmons 2005-01-05 14:47:49 EST
I can't reproduce this on my ppc machine.  Can you post the relevant
lines in your yum.conf file so that I'm sure I've got the right
package set?
Comment 8 W. Michael Petullo 2005-01-05 15:03:22 EST
I should be tracking Raw Hide only.  I installed the javacc RPM from
JPackage by hand.

I just tried reinstalling Raw Hide's gcc-java-3.4.3-11.ppc.rpm and
java-1.4.2-gcj-compat-1.4.2.0-21jpp.noarch.rpm by hand but that did
not help.

name=Fedora Core $releasever - Development Tree
#baseurl=ftp://download.fedora.redhat.com/pub/fedora/linux/core/development/$basearch/
mirrorlist=http://fedora.redhat.com/download/mirrors/fedora-core-rawhide
enabled=1
Comment 9 Thomas Fitzsimmons 2005-01-05 17:12:15 EST
Nope, still can't reproduce this.  I'm on a ppc64 machine; what does
uname -a report for you?
Comment 10 W. Michael Petullo 2005-01-05 18:54:11 EST
[mike@imp ~]$ uname -a
Linux imp.flyn.org 2.6.9-1.1021_FC4 #1 Wed Dec 8 18:45:11 EST 2004 ppc
ppc ppc GNU/Linux

My machine is a G4 iBook.
Comment 11 W. Michael Petullo 2005-01-05 19:09:45 EST
It looks like installing
java-1.4.2-gcj-compat-devel-1.4.2.0-21jpp.noarch.rpm from Raw Hide
fixes this.  I didn't have this RPM installed when I reported this bug
but I just installed it (I DID have ava-1.4.2-gcj-compat installed,
though).  Now javacc and ant work.

Should java-1.4.2-gcj-compat-devel be required to execute Java
bytecode?  If so, why does the ant RPM not require it the package?

Both java-1.4.2-gcj-compat and -devel install an identical program
named java:

[mike@imp src]$ rpm -ql java-1.4.2-gcj-compat | grep java$
/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre/bin/java

[mike@imp src]$ rpm -ql java-1.4.2-gcj-compat-devel | grep java$
/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/bin/java

[mike@imp src]$ diff /usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre/bin/java
/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/bin/java
<no difference>

Ant seems to execute using the one installed by the -devel package:

[mike@imp src]$ ant
exec "/usr/lib/jvm/java/bin/java" -classpath
"/usr/share/java/ant.jar:/usr/share/java/ant-launcher.jar:/usr/share/java/jaxp_parser_impl.jar:/usr/share/java/xml-commons-apis.jar:/usr/share/java/junit.jar:/usr/share/java/ant/ant-junit.jar:/usr/lib/jvm/java/lib/tools.jar:/usr/share/java/ecj.jar"
-Dant.home="/usr/share/ant" -Dant.library.dir="/usr/share/ant/lib"
org.apache.tools.ant.launch.Launcher -lib ""
[...]

Comment 12 Thomas Fitzsimmons 2005-01-05 19:19:19 EST
Ah, OK.  The -devel package contains the javac compiler.  Ant
BuildRequires java-devel, but doesn't Require it.  It should though. 
Can you file a separate bug for this?

And yes, two java files are installed, one by the base package and one
by the -devel package.  This is how proprietary SDKs are laid out, so
we're just following them.

Closing this report.
Comment 13 W. Michael Petullo 2005-01-05 19:54:33 EST
This still does not seem right.  Granted, ant is probably going to
need the -devel package to build programs.  But it shouldn't need it
to simply execute, right?  I'm I wrong to think that only a JRE (aka
java-1.4.2-gcj-compat) is needed for this?

After I did some experimentation, I found that simply creating the
empty directory /usr/lib/jvm-exports/java (which is actually a link
installed by the -devel package) allows ant to execute without the
-devel package installed.  So I think that java-1.4.2-gcj-compat
should install this directory instead of -devel.  See this error:

[mike@imp java-1.4.2-gcj-1.4.2.0]$ ant
exec "/usr/bin/java" -classpath "/usr/bin/build-classpath: error:
JVM_LIBDIR /usr/lib/jvm-exports/java does not exist or is not a
directory:/usr/bin/build-classpath: error: JVM_LIBDIR
/usr/lib/jvm-exports/java does not exist or is not a
directory:/usr/share/java/ecj.jar" -Dant.home="/usr/share/ant"
-Dant.library.dir="/usr/share/ant/lib"
org.apache.tools.ant.launch.Launcher -lib ""
Exception in thread "main" java.lang.NoClassDefFoundError:
org.apache.tools.ant.launch.Launcher

Javacc behaves the same.

The wierd thing is that this link does not contain anything when it is
installed by -devel:

[mike@imp ~]$ ls -l /usr/lib/jvm-exports/java
lrwxrwxrwx  1 root root 34 Jan  5 18:45 /usr/lib/jvm-exports/java ->
/etc/alternatives/java_sdk_exports
[mike@imp ~]$ ls -l /etc/alternatives/java_sdk_exports
lrwxrwxrwx  1 root root 35 Jan  5 18:45
/etc/alternatives/java_sdk_exports -> /usr/lib/jvm-exports/java-1.4.2-gcj
[mike@imp ~]$ ls -l /usr/lib/jvm-exports/java-1.4.2-gcj
lrwxrwxrwx  1 root root 22 Jan  5 18:44
/usr/lib/jvm-exports/java-1.4.2-gcj -> java-1.4.2-gcj-1.4.2.0
[mike@imp ~]$ ls -l /usr/lib/jvm-exports/java-1.4.2-gcj-1.4.2.0
total 0


On a semi-related note, why is ecj used by
java-1.4.2-gcj-compat-devel?  Is ecj more complete than gcj?
Comment 14 Thomas Fitzsimmons 2005-01-05 20:11:47 EST
Ant appears to require the -devel package to be installed, since it
includes ecj.jar on the classpath.  Where does this ecj.jar include
come from?

How is build-classpath being run?  Maybe there's a bug there in that
it assumes a JVM -devel package is installed.  Instead of a set of
jars, the classpath string contains build-classpath's error messages.

We use ecj for javac because it is superior to gcj -C.  It is faster,
more correct and most importantly for this application, more
command-line compatible with Sun's javac.
Comment 15 Andrew Haley 2005-01-06 06:33:22 EST
Not a gcj bug, AFAICS.
Comment 16 Thomas Fitzsimmons 2005-01-11 18:19:24 EST
This is a bug in jpackage-utils; it assumes that JAVA_HOME is
/usr/lib/jvm/java.  But that symlink is installed by the -devel
package.  I'm working on a fix.
Comment 17 Thomas Fitzsimmons 2005-01-18 11:13:22 EST
The problem was that jpackage-utils wouldn't fall back to look for
$JVM_ROOT/jre when $JVM_ROOT/java didn't exist.  Nicolas Mailhot wrote
this patch, which fixes the issue:

--- java-functions.orig 2005-01-14 23:12:24.000000000 +0100
+++ java-functions      2005-01-14 23:17:10.000000000 +0100
@@ -20,8 +20,14 @@
   exit 1
 fi

+# Read user configuration file if it exists
+[ -f ~/.java/java.conf ] && . ~/.java/java.conf
+
 [ ! -z "$_JAVA_HOME" -a -d "$_JAVA_HOME" ] && JAVA_HOME="$_JAVA_HOME"

+[ -z "$JAVA_HOME" -a -d "$JVM_ROOT/jre" ] && JAVA_HOME="$JVM_ROOT/jre"
+[ -z "$JAVA_HOME" -a -d "$JVM_ROOT/java" ] && JAVA_HOME="$JVM_ROOT/java"
+
 # Set the java virtual machine
 set_jvm() {
   # use $JAVA_HOME if defined

This patch is included in jpackage-utils-1.6.2-1jpp_2rh which should
hit rawhide soon.  Can you retest and close this bug if it works?
Comment 18 W. Michael Petullo 2005-01-19 16:31:24 EST
Okay.  Javacc will now execute without java-1.4.2-gcj-compat-devel
installed.  Thanks.

Note You need to log in before you can comment on or make changes to this bug.