dev-java/ecj-gcj-3.6 fails to build on my ia64 system: bootstrapping ecj with /usr/ia64-unknown-linux-gnu/gcc-bin/4.6.3/gcj -C --encoding=ISO-8859-1 ... Exception in thread "main" java.lang.ClassFormatError: org.eclipse.jdt.internal.compiler.batch.Main (Premature end of data) at java.lang.VMClassLoader.defineClass(libgcj.so.12) at java.lang.ClassLoader.defineClass(libgcj.so.12) at java.security.SecureClassLoader.defineClass(libgcj.so.12) at java.net.URLClassLoader.findClass(libgcj.so.12) at gnu.gcj.runtime.SystemClassLoader.findClass(libgcj.so.12) at java.lang.ClassLoader.loadClass(libgcj.so.12) at java.lang.ClassLoader.loadClass(libgcj.so.12) at java.lang.VMClassLoader.defineClass(libgcj.so.12) at java.lang.ClassLoader.defineClass(libgcj.so.12) at java.security.SecureClassLoader.defineClass(libgcj.so.12) at java.net.URLClassLoader.findClass(libgcj.so.12) at gnu.gcj.runtime.SystemClassLoader.findClass(libgcj.so.12) at java.lang.ClassLoader.loadClass(libgcj.so.12) at java.lang.ClassLoader.loadClass(libgcj.so.12) at gnu.java.lang.MainThread.run(libgcj.so.12) The same happens with gcj from sys-devel/gcc-4.6.3. emerge --info and build.log attached. Reproducible: Always
Created attachment 325362 [details] build.log and emerge --info
Same results for dev-java/ecj-gcj-3.5.2-r2 and sys-devel/gcc-4.5.3-r2. I had that version compiled on 20101202 (still have a binpkg), so the issue did not exist back then.
lstat("/usr", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 lstat("/usr/libexec", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 lstat("/usr/libexec/gcc", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 lstat("/usr/libexec/gcc/ia64-unknown-linux-gnu", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 lstat("/usr/libexec/gcc/ia64-unknown-linux-gnu/4.5.3", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 lstat("/usr/libexec/gcc/ia64-unknown-linux-gnu/4.5.3/ecj1", {st_mode=S_IFREG|0755, st_size=7656, ...}) = 0 munmap(0x20000000003dc000, 8200) = 0 munmap(0x20000000003e0000, 8200) = 0 access("/usr/libexec/gcc/ia64-unknown-linux-gnu/4.5.3/ecj1", X_OK) = 0 clone(child_stack=0, flags=CLONE_VM|CLONE_VFORK|SIGCHLD) = 31250 wait4(31250, Exception in thread "main" java.lang.ClassFormatError: org.eclipse.jdt.internal.compiler.batch.Main (Premature end of data) Could it be, that gcj tries to use ecj to build, but that does not yet exist, because we are just builting the package?
/usr/libexec/gcc/ia64-unknown-linux-gnu/4.5.3/ecj1 specifies a classpath (seen in the output of strings) pointing to /usr/share/gcc-data/ia64-unknown-linux-gnu/4.5.3/java/ecj.jar. I looked into that file for the class gcj complained about: # ll org/eclipse/jdt/internal/compiler/batch/Main.class -rw-r--r-- 1 root root 60743 Sep 11 2009 org/eclipse/jdt/internal/compiler/batch/Main.class # file org/eclipse/jdt/internal/compiler/batch/Main.class org/eclipse/jdt/internal/compiler/batch/Main.class: compiled Java class data, version 46.0 (Java 1.2) I then tried to execute that class on another (x86) computer, and it worked: $ java org/eclipse/jdt/internal/compiler/batch/Main Eclipse Java Compiler 0.972_R35x, 3.5.1 release Copyright IBM Corp 2000, 2009. All rights reserved. $ java -version java version "1.6.0_24" OpenJDK Runtime Environment (IcedTea6 1.11.4) (6b24-1.11.4-1ubuntu0.12.04.1) OpenJDK Server VM (build 20.0-b12, mixed mode) No idea what that means. Maybe gcj is broken and cannot load classes at all? Or the ecj.jar is broken in some weird way that only becomes visible on my ia64 machine?
ecj-gcj is basically eclipse-ecj minus the bits that wont compile using gcj. The main purpose is having a "javac" ebuild that doesn't depend on a jdk. gcj internally bundles/reuses ecj but that has nothing to do with the ecj-gcj ebuild. From the looks of it gcj is broken on ia64. java.lang.ClassFormatError means either the class files don't adhere to the vm spec or the verifier code is broken/segfaults/whatever. From your comments it seems more likely to be the latter. Please try to compile HelloWorld using gcj -C and report back.
(In reply to comment #5) > Please try to compile HelloWorld using gcj -C and report back. # cat helloworld.java class HelloWorld { public static void main(String []args) { System.out.println("Hello World"); } } # gcj --version | head -n1 gcj (Gentoo Hardened 4.5.3-r2 p1.6, pie-0.4.7) 4.5.3 # gcj -C helloworld.java Exception in thread "main" java.lang.ClassFormatError: org.eclipse.jdt.internal.compiler.batch.Main (Premature end of data) at java.lang.VMClassLoader.defineClass(libgcj.so.12) at java.lang.ClassLoader.defineClass(libgcj.so.12) at java.security.SecureClassLoader.defineClass(libgcj.so.12) at java.net.URLClassLoader.findClass(libgcj.so.12) at gnu.gcj.runtime.SystemClassLoader.findClass(libgcj.so.12) at java.lang.ClassLoader.loadClass(libgcj.so.12) at java.lang.ClassLoader.loadClass(libgcj.so.12) at java.lang.VMClassLoader.defineClass(libgcj.so.12) at java.lang.ClassLoader.defineClass(libgcj.so.12) at java.security.SecureClassLoader.defineClass(libgcj.so.12) at java.net.URLClassLoader.findClass(libgcj.so.12) at gnu.gcj.runtime.SystemClassLoader.findClass(libgcj.so.12) at java.lang.ClassLoader.loadClass(libgcj.so.12) at java.lang.ClassLoader.loadClass(libgcj.so.12) at gnu.java.lang.MainThread.run(libgcj.so.12) # gcj-4.6.3 --version gcj-4.6.3 (Gentoo Hardened 4.6.3 p1.7, pie-0.5.2) 4.6.3 # gcj-4.6.3 -C helloworld.java Exception in thread "main" java.lang.ClassFormatError: org.eclipse.jdt.internal.compiler.batch.Main (Premature end of data) at java.lang.VMClassLoader.defineClass(libgcj.so.12) at java.lang.ClassLoader.defineClass(libgcj.so.12) at java.security.SecureClassLoader.defineClass(libgcj.so.12) at java.net.URLClassLoader.findClass(libgcj.so.12) at gnu.gcj.runtime.SystemClassLoader.findClass(libgcj.so.12) at java.lang.ClassLoader.loadClass(libgcj.so.12) at java.lang.ClassLoader.loadClass(libgcj.so.12) at java.lang.VMClassLoader.defineClass(libgcj.so.12) at java.lang.ClassLoader.defineClass(libgcj.so.12) at java.security.SecureClassLoader.defineClass(libgcj.so.12) at java.net.URLClassLoader.findClass(libgcj.so.12) at gnu.gcj.runtime.SystemClassLoader.findClass(libgcj.so.12) at java.lang.ClassLoader.loadClass(libgcj.so.12) at java.lang.ClassLoader.loadClass(libgcj.so.12) at gnu.java.lang.MainThread.run(libgcj.so.12) On an **x86-64** machine this code compiles and runs cleanly: # gcj --version | head -n1 gcj (Gentoo 4.7.2 p1.0, pie-0.5.3) 4.7.2 # java -version java version "1.7.0_07" OpenJDK Runtime Environment (IcedTea7 2.3.2) (Gentoo build 1.7.0_07-b30) OpenJDK 64-Bit Server VM (build 23.2-b09, mixed mode)
Thanks for the detailed answer. Assigning to toolchain.
bug 389763 is probably related, this time x86 tho. As if something goes wrong with linking on non amd64 platforms.
Out of a sudden this works: # gcj --version gcj (Gentoo Hardened 4.6.3 p1.11, pie-0.5.2) 4.6.3 Copyright (C) 2011 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # gcj -C helloworld.java gcj-jdk (and thus ecj-gcj) compiled without problems.
P.S: If someone else is able to reproduce this (i.e. the fact that it works now), I think we can close it.
Closing this as fixed since Dennis says it works and we just dropped java on ia64 anyway.