[blfs-dev] Openjdk from gcj

Pierre Labastie pierre.labastie at neuf.fr
Fri Mar 15 13:58:06 PDT 2013


Le 15/03/2013 01:25, DJ Lucas a écrit :
> On 03/13/2013 05:02 AM, Pierre Labastie wrote:
>>
>> You can add gcc, tested on both 64 bit and 32 bit.
>>
>> I also built openjdk starting from the gcj jvm, using upstream ant and
>> ecj binaries.
>>
>> If anybody is interested, I can share the instructions.
>> Pierre
> Hmm. I haven't done that in quite a while. I'd be interested to see what
> is required now days. I always just bootstrap from my previous
> incarnation. I guess it shouldn't be necessary to provide anything more
> than CLASSPATH now, but am unsure. Did you do a system install or keep
> it isolated in /opt (like in BLFS)?
>
> -- DJ Lucas
I am not a java specialist (far from it!). What I did is:
-build gtk2 (with recommended deps)
-download ecj.jar and antlr.jar (to /sources)
-copy ecj.jar to the toplevel directory of the gcc build tree
(mkdir gcc-build and change to it)
-configure gcc as in the book adding: --enable-java-home 
--with-antlr-jar=/sources/antlr.jar --enable-java-awt=gtk
-build, test, install

You end up with a java virtual machine in /usr/lib/jvm (could be changed 
with --with-jvm-root-dir), and jar files in
/usr/lib/jvm-exports. What I do next (inspired from Debian):
gcj -o ecj --main=org.eclipse.jdt.internal.compiler.batch.Main ecj.jar
copy ecj to /usr/bin
ln -s ../../../bin/ecj /usr/lib/jvm/bin/javac

So now javac's options are compatible with those of SUN javac.

Then install all openjdk recommended deps (as per the book), except ant.
The reason is that ant does not compile with the above java machine.
So download and extract ant binary (I extracted to /sources/gcc to avoid 
permission problems, but it could be extracted to /opt). Set ANT_HOME 
accordingly. Set PATH to $PATH:/usr/lib/jvm/bin:$ANT_HOME/bin
cd $ANT_HOME and type:
ant -f fetch.xml -Ddest=system
It downloads a few libraries then stops on error, but that's enough.

Then install openjdk as per the book instructions (except I have 'make' 
download the extra packages).

For some reason I lost the test logs. But I got roughly 200 errors.

After installing, I installed JUNIT and run it: got 1 error
Then I installed ant from sources and that completed OK.
-------------------
I cannot tell that all the above steps are required.
Specially I tried to install the maximum of the gcj machine, that's the 
reason
for the enable-java-awt (to build jawt) and with-antlr-jar (which allows 
to build gjdoc).
I hoped that jvm would be compatible, but I got ~250 errors when testing 
junit.
Maybe it is a problem with the links. I know I had to link 
/usr/libs/tools.jar to /usr/lib/jvm-exports/libgcj-tools.jar.
But is it enough?
I am not sure I need the ant -f fetch... step, too. I have to try 
without it.

Since I did not believe I could build openjdk that way, I run the 
commands manually, so
no script yet.

Regards
Pierre



More information about the blfs-dev mailing list