This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: building gcc against eclipse?


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 "\$@"
>
> Andrew.

Andrew,
   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? 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?
                   Jack


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]