Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 220779 - GCC 4.3 builds non-working gcj
Summary: GCC 4.3 builds non-working gcj
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All All
: High major with 1 vote (vote)
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
: 225605 236398 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-05-07 16:08 UTC by vorfeed.canal
Modified: 2008-10-04 21:14 UTC (History)
15 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description vorfeed.canal 2008-05-07 16:08:49 UTC
Upstream explanation is here: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32712

Basically you need to either put ftp://sourceware.org/pub/java/ecj-latest.jar as ecg.jar in /var/tmp/portage/sys-devel/gcc-4.3.0/work/gcc-4.3.0 before calling GCC 4.3's configure or use --with-ecj-jar=filename option...

In this case GCC 4.3 will create useful /usr/libexec/gcc/i686-pc-linux-gnu/4.3.0/ecj1 and GCJ will work. If ecj.jar is not found at compilation time then it's up to user to provide ecj1 in $PATH...
Comment 1 Nils Larsson 2008-05-28 19:18:51 UTC
(In reply to comment #0)
> Upstream explanation is here: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32712
> 
> Basically you need to either put ftp://sourceware.org/pub/java/ecj-latest.jar
> as ecg.jar in /var/tmp/portage/sys-devel/gcc-4.3.0/work/gcc-4.3.0 before
> calling GCC 4.3's configure or use --with-ecj-jar=filename option...
> 
> In this case GCC 4.3 will create useful
> /usr/libexec/gcc/i686-pc-linux-gnu/4.3.0/ecj1 and GCJ will work. If ecj.jar is
> not found at compilation time then it's up to user to provide ecj1 in $PATH...
> 

Adding
cd ${WORKDIR}/${P}/contrib && ./download_ecj
last in src_unpack() and adding net-ftp/ftp as a dep. to gcj fixes this( I think, still compiling... ). I imagine there's a better way then the download_ecj and the ftp dep. it requires, but it's the GCC way of doing it.
Maybe, 
wget ftp://sourceware.org/pub/java/ecj-latest.jar -O ${WORKDIR}/${P}/contrib/ecj.jar
is nicer. I'm new to all this :)

Comment 2 Nils Larsson 2008-05-28 19:27:52 UTC
Oops, ecj.jar should go in top-dir. So, (with ftp)
cd ${WORKDIR}/${P} && ./contrib/download_ecj
or
wget ftp://sourceware.org/pub/java/ecj-latest.jar -O ${WORKDIR}/${P}/ecj.jar
Comment 3 vorfeed.canal 2008-05-29 22:33:19 UTC
Yes, this hack will work (I did something similar), but it's not a good long-term solution. What happens if later ftp://sourceware.org/pub/java/ecj-latest.jar will be changed and will only work with gcc 4.10 or something like this? It's create a mess. To fix it properly this file should be mirrored somewhere (probably on Gentoo mirrors) under sane name (something like ecj-20070727.jar), then it should be downloaded as normal file and put in proper place at src_unpack stage.

Comment 4 SpanKY gentoo-dev 2008-06-22 15:05:50 UTC
*** Bug 225605 has been marked as a duplicate of this bug. ***
Comment 5 SpanKY gentoo-dev 2008-06-22 15:21:19 UTC
maintaining any java stuff in gcc is undesirable

java team: can you update dev-java/eclipse-ecj so as to provide an `ecj1` symlink ?
Comment 6 Ceki Gulcu 2008-06-28 12:02:42 UTC
I stumbled upon this report while tyring to build "pdftk".

Following the suggestions found here, I have installed
dev-java/eclipse-ecj and created a symlink from /usr/bin/ecj1 to
/usr/bin/ecj-3.3. However, I have not rebuilt gcc because it takes
"forever".

Building the" pdftk" fails with

>>> Compiling source in /var/tmp/portage/app-text/pdftk-1.41/work/pdftk-1.41/pdftk ...
make -C ../java_libs
make[1]: Entering directory `/var/tmp/portage/app-text/pdftk-1.41/work/pdftk-1.41/java_libs'
make -C "/var/tmp/portage/app-text/pdftk-1.41/work/pdftk-1.41/java_libs/gnu_local/java/security";
make[2]: Entering directory `/var/tmp/portage/app-text/pdftk-1.41/work/pdftk-1.41/java_libs/gnu_local/java/security'
gcj -march=k8 -O2 -pipe --encoding=UTF-8 --classpath="/var/tmp/portage/app-text/pdftk-1.41/work/pdftk-1.41/java_libs" -c Engine.java -o E
ngine.o
/usr/lib64/portage/pym/portage_dep.py:39: DeprecationWarning: DEPRECATION NOTICE: The portage_dep module was replaced by portage.dep
Unrecognized option : -fbootclasspath=/var/tmp/portage/app-text/pdftk-1.41/work/pdftk-1.41/java_libs/:/usr/share/gcc-data/x86_64-pc-linux
-gnu/4.3.1/java/libgcj-4.3.1.jar

Should I rebuild gcc?
Comment 7 Ceki Gulcu 2008-06-28 15:18:26 UTC
Given my time constraints, and the fact that the problem has been
introduced with gcc version 4.3, I circumvented this problem by
reverting to the earlier version of gcc installed on my system, namely
version 3.4.4.

Unfortunately, this version of gcc was hard masked so I could not
emerge gcc version 3.4.4.. The solution was to find an unmasked
version earlier than version 4.3 but later than version 3.4.4.

Here is how I did it:

> emerge -pv '<sys-devel/gcc-4'
[ebuild   R   ] sys-devel/gcc-3.4.6-r2  USE="fortran gcj nls (-altivec) -bootstrap -boundschecking -build -d -doc -gtk (-hardened) -ip28 -ip32r10k -libffi (-multilib) -multislot (-n32) (-n64) -nocxx -nopie -nossp -objc -test -vanilla" 0 kB

> USE="gcj" emerge '=sys-devel/gcc-3.4.6-r2'

I also followed the directions for upgrading GCC [1].

HTH,

[1] http://www.gentoo.org/doc/en/gcc-upgrading.xml

Comment 8 Andrej Gelenberg 2008-06-30 15:51:13 UTC
I have maked it work.

1. emerge eclips-ecj
2. sudo vim /usr/bin/ecj1
 and where change
gjl_main="org.eclipse.jdt.internal.compiler.batch.Main"
to
gjl_main="org.eclipse.jdt.internal.compiler.batch.GCCMain"
Comment 9 Andrej Gelenberg 2008-06-30 15:58:46 UTC
Know someone from where ecj1 come from?
Comment 10 Andrew John Hughes 2008-07-01 19:12:18 UTC
contrib/download_ecj is the acknowledged way of fulfilling this dependency by upstream.  Hence others will depend on it so the jar file is hardly going to move.  But if you think it's a problem, then you should discuss it with them rather than complaining here.

As to 'maintaining any java stuff in gcc is undesirable', it's part of gcc so get over it.
Comment 11 Andrew John Hughes 2008-07-01 19:14:57 UTC
Having an ecj1 symlink won't cut it completely, the build also needs to be supplied with a copy of ecj.jar.  By far the easiest way to do this is to patch gcc-4.3.1 to download ecj as upstream specifies.
Comment 12 Andrew John Hughes 2008-07-01 19:28:25 UTC
I've put the patched version in the java-overlay for now but this isn't a permanent solution.  Please fix gcc.
Comment 13 Andrew John Hughes 2008-07-01 19:51:27 UTC
Tom Tromey has kindly made the ecj-latest.jar into a symlink which currently
points to ecj-4.3.jar.

ftp://sourceware.org/pub/java/

So now the Gentoo ebuild can rely on this version for 4.3
Comment 14 James Le Cuirot gentoo-dev 2008-07-08 17:01:32 UTC
I've made the ebuild in java-overlay slightly less evil. No one likes using wget during src_unpack.
Comment 15 Andreas Klauer 2008-07-20 14:54:13 UTC
I couldn't get this to work, not manually and not with the ebuilds from the java overlay. So I resorted to emerging gcc 4.2 in a separate slot (gcc-4.2 with gcj useflag, gcc-4.3 without), and symlinked gcj and gcjh to the 4.2 version. With this I can emerge "pdftk" again. Not sure if mixing gcc-4.2 and 4.3 like this is a good idea in general. Would love to see a proper fix for gcc-4.3.
Comment 16 James Le Cuirot gentoo-dev 2008-07-20 14:58:58 UTC
What was the problem though?
Comment 17 Andrew John Hughes 2008-07-25 18:47:31 UTC
The problem is the current build of gcj is unusable -- it can't compile anything.
Comment 18 James Le Cuirot gentoo-dev 2008-07-25 19:01:58 UTC
No, I meant what was the problem that Andreas had with the ebuilds from the overlay?
Comment 19 Nikolay Orlyuk 2008-08-02 19:53:57 UTC
I'm completely lost with this ecj1...

I have no /usr/bin/ecj1 and I'm getting (dev-java/eclipse-ecj-3.4-r2):
>>> Unpacking ecjsrc-3.4.zip to /var/tmp/portage/portage/dev-java/eclipse-ecj-3.4-r2/work
 * bootstrapping ecj with /usr/x86_64-pc-linux-gnu/gcc-bin/4.3.1/gcj -C ...
gcj: error trying to exec 'ecj1': execvp: Permission denied

for hello.java:
gcj: error trying to exec 'ecj1': execvp: No such file or directory

I have /usr/bin/ecj with "...batch.Main", so when I create symlink for ecj1:
 * bootstrapping ecj with /usr/x86_64-pc-linux-gnu/gcc-bin/4.3.1/gcj -C ...
Unrecognized option : /var/tmp/portage/portage/dev-java/eclipse-ecj-3.4-r2/temp//ccnGH4Tajx

for hello.java:
invalid debug option: -g1

When I change gjl_main to "...batch.GCCMain":
 * bootstrapping ecj with /usr/x86_64-pc-linux-gnu/gcc-bin/4.3.1/gcj -C ...
java.lang.ArrayIndexOutOfBoundsException: -1
        at org.eclipse.jdt.internal.compiler.parser.Parser.consumeFieldAccess(Parser.java:3492)
        at org.eclipse.jdt.internal.compiler.parser.Parser.consumeRule(Parser.java:5688)
        at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:9007)
        at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:9238)
        at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:9195)
        at org.eclipse.jdt.internal.compiler.parser.Parser.dietParse(Parser.java:7851)
        at org.eclipse.jdt.internal.compiler.Compiler.internalBeginToCompile(Compiler.java:587)
        at org.eclipse.jdt.internal.compiler.Compiler.beginToCompile(Compiler.java:357)
        at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:371)
        at org.eclipse.jdt.internal.compiler.batch.Main.performCompilation(Main.java:3410)
        at org.eclipse.jdt.internal.compiler.batch.Main.compile(Main.java:1607)
        at org.eclipse.jdt.internal.compiler.batch.GCCMain.compile(GCCMain.java:475)
        at org.eclipse.jdt.internal.compiler.batch.GCCMain.main(GCCMain.java:492)

for hello.java - nothing, and no hello executable or anything else.

Java VM: sun-jdk-1.6
ecj: ecj-3.3
gcc: 4.3.1-r1
COMPILERS="javac ecj-3.3 jikes"
Comment 20 James Le Cuirot gentoo-dev 2008-08-02 21:19:11 UTC
My ecj1 is at /usr/libexec/gcc/x86_64-pc-linux-gnu/4.3.1/ecj1, which is where it should be. You definitely used gcc from the overlay, right?
Comment 21 Mark Loeser (RETIRED) gentoo-dev 2008-08-03 01:43:43 UTC
This has been fixed in the tree.  Thanks all.
Comment 22 Andrew John Hughes 2008-08-03 10:51:17 UTC
Thanks for doing this.  Just for the record, ecj.jar was not removed, it's a new external dependency from gcc 4.3 onwards.
Comment 23 Helmut Jarausch 2008-09-02 12:35:47 UTC
(In reply to comment #21)
> This has been fixed in the tree.  Thanks all.
> 

When or where is the new ebuild available? (not yet in the standard
emerge 2008/09/02)
Comment 24 Vlastimil Babka (Caster) (RETIRED) gentoo-dev 2008-09-15 12:06:11 UTC
Please consider revbumping as we still get bug reports about this from people who didn't recompile gcc after the fix.
Comment 25 Vlastimil Babka (Caster) (RETIRED) gentoo-dev 2008-09-15 12:06:36 UTC
*** Bug 236398 has been marked as a duplicate of this bug. ***
Comment 26 Patrizio Bassi 2008-09-21 11:18:07 UTC
my gcc is still failing, needs a revdump? seems i'm running the latest one
Comment 27 Patrizio Bassi 2008-10-01 17:07:16 UTC
after re-emerging it works.
looks fixed in the portage tree
Comment 28 Mark Loeser (RETIRED) gentoo-dev 2008-10-04 21:14:48 UTC
gcc 4.3.2 is now in the tree, so everyone will be getting that version now anyway.