This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: building gcc against eclipse?
Jack Howarth wrote:
On Thu, Nov 12, 2009 at 05:11:57PM +0000, Andrew Haley wrote:
Jack Howarth wrote:
On Tue, Nov 10, 2009 at 10:00:29AM +0000, Andrew Haley wrote:
Jack Howarth wrote:
In fink, we have been building the gcj ecj1 support by
copying the ecj-latest.jar file from ftp://sourceware.org/pub/java
into the top level of the gcc source directory. I would like to try
building gcc on darwin with the eclipse compiler instead. We have
a fink ecj package which provides...
/.
/sw
/sw/bin
/sw/bin/ecj
/sw/share
/sw/share/doc
/sw/share/doc/ecj
/sw/share/doc/ecj/about.html
/sw/share/java
/sw/share/java/ecj
/sw/share/java/ecj/ecj.jar
How exactly does one build the gcj against this ecj compiler? Would
creating a symlink in the toplevel gcc directory to
/sw/share/java/ecj/ecj.jar be sufficient to cause the installed
eclipse compiler to be used for ecj1?
We configure for Fedora with --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
You don't have to copy that jar into the toplev of srcdir.
Would there be any possible differences in the code execution of gcj when built
with the stock ftp://sourceware.org/pub/java/ecj-latest.jar compared to the ecj.jar
from eclipse? My initial attempts at building a usable gcj with eclipse's ecj.jar
failed due to undefined symbols for org.eclipse.jdt.internal.compiler.batch.GCCMain
at runtime for ecj1.
You mean the class org.eclipse.jdt.internal.compiler.batch.GCCMain is missing, I guess?
I noticed that the fedora 12 gcc specfile at...
http://cvs.fedoraproject.org/viewvc/rpms/gcc/F-12/gcc.spec?revision=1.90&view=markup
has a section...
%if %{build_java}
%if !%{bootstrap_java}
# If we don't have gjavah in $PATH, try to build it with the old gij
mkdir java_hacks
cd java_hacks
cp -a ../../libjava/classpath/tools/external external
mkdir -p gnu/classpath/tools
cp -a ../../libjava/classpath/tools/gnu/classpath/tools/{common,javah,getopt} gnu/classpath/tools/
cp -a ../../libjava/classpath/tools/resource/gnu/classpath/tools/common/Messages.properties gnu/classpath/tools/common
cp -a ../../libjava/classpath/tools/resource/gnu/classpath/tools/getopt/Messages.properties gnu/classpath/tools/getopt
cd external/asm; for i in `find . -name \*.java`; do gcj --encoding ISO-8859-1 -C $i -I.; done; cd ../..
for i in `find gnu -name \*.java`; do gcj -C $i -I. -Iexternal/asm/; done
gcj -findirect-dispatch -O2 -fmain=gnu.classpath.tools.javah.Main -I. -Iexternal/asm/ `find . -name \*.class` -o gjavah.r
eal
cat > gjavah <<EOF
#!/bin/sh
export CLASSPATH=`pwd`${CLASSPATH:+:$CLASSPATH}
exec `pwd`/gjavah.real "\$@"
EOF
chmod +x `pwd`/gjavah
cat > ecj1 <<EOF
#!/bin/sh
exec gij -cp /usr/share/java/eclipse-ecj.jar org.eclipse.jdt.internal.compiler.batch.GCCMain "\$@"
EOF
chmod +x `pwd`/ecj1
export PATH=`pwd`${PATH:+:$PATH}
cd ..
%endif
%endif
This would be difficult to implement in fink for darwin since we don't have legacy gij/gcj compiler to
leverage from the system compilers. Is there another way to get around the issue of the undefined
org.eclipse.jdt.internal.compiler.batch.GCCMain symbol in ejc1 when using the ecj.jar from eclipse?
Sure. Just put the file GCCMain.class in someDirectory, and run ecj1 as
#!/bin/sh
exec gij -cp someDirectory:/usr/share/java/eclipse-ecj.jar org.eclipse.jdt.internal.compiler.batch.GCCMain "\$@"
If I want to have gcj automatically run this shell script of ecj1, would I just create a java_hacks
subdirectory in the main build directory and place the ecj1 shell script in there?
There are several things going on here.
The most important difference is that Fedora builds everything fro java source:
it doesn't use the .class files that are in the gcc sources. So, it has a much
more difficult time.
> I am very unclear if
this java_hacks directory usage is specific to Fedora/Redhat or if it is a real feature of the gcc java
build process. If so, is there any documentation on how the java_hacks option works?
It's just some fedora weirdness. Don't worry about it.
ecj1 is first built in libgcj (as ecjx) and then installed in the install dir.
ecjx is renamed to ecj1 with:
if BUILD_ECJ1
## Undo any prepending of the target prefix and transform
## to the actual host's executable suffix.
mv $(DESTDIR)$(libexecsubdir)/`echo ecjx | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'` $(DESTDIR)$(libexecsubdir)/ecj1$(host_exeext)
endif BUILD_ECJ1
If you want to replace ecjx with some shell script that runs eclipse-ecj.jar,
replace this command with something appropriate.
Andrew.