glfs/archive/gcc-java.xml
Pierre Labastie 9562b375be GCC-7.1.0; archive gcc-java, since
it is not anymore in the GCC sources

git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@18694 af4574ff-66df-0310-9fd7-8a98e5e911e0
2017-05-06 19:10:54 +00:00

672 lines
21 KiB
XML

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../../general.ent">
%general-entities;
<!ENTITY gcc-java-download-http "http://ftpmirror.gnu.org/gcc/gcc-&gcc-java-version;/gcc-&gcc-java-version;.tar.bz2">
<!ENTITY gcc-java-download-ftp "ftp://ftp.gnu.org/gnu/gcc/gcc-&gcc-java-version;/gcc-&gcc-java-version;.tar.bz2">
<!ENTITY gcc-java-md5sum "6bf56a2bca9dac9dbbf8e8d1036964a8">
<!ENTITY gcc-java-size "80 MB">
<!ENTITY gcc-java-buildsize "4.5 GB">
<!ENTITY gcc-java-time "34 SBU (with tests and parallelism=4)">
<!-- ecj-latest points to 4.5 while ecj-4.9 is available -->
<!ENTITY ecj-download-ftp "ftp://sourceware.org/pub/java/ecj-4.9.jar">
<!ENTITY antlr-version "4.6">
<!ENTITY antlr-download-http "http://www.antlr.org/download/antlr-&antlr-version;-complete.jar">
]>
<sect1 id="gcc-java" xreflabel="GCC-Java-&gcc-java-version;">
<?dbhtml filename="gcc-java.html" ?>
<sect1info>
<othername>$LastChangedBy$</othername>
<date>$Date$</date>
</sect1info>
<title>GCC-Java-&gcc-java-version;</title>
<indexterm zone="gcc-java">
<primary sortas="a-gcc-java">GCC-Java-&gcc-java-version;</primary>
</indexterm>
<sect2 role="package">
<title>Introduction to GCC-Java</title>
<para>
See the introduction to the Java language and system at
<xref linkend="java"/>. The GNU Compiler Collection (GCC) contains
a Java compiler to native code. Together with the
<application>ecj</application> Java compiler from Eclipse (to bytecode),
it provides a way to build an acceptable JVM from source. However, since
the release of <application>OpenJDK</application>, the development
of GCC-Java has almost stopped, and the built JVM is an old version,
which cannot be used for building <xref linkend="openjdk"/>.
</para>
&lfs80_checked;
<caution>
<para>
Using the instructions on this page will have the effect that
the C and C++ compiler and libraries will be reinstalled, overwriting
the ones on your system. This may lead to some issues. Please read the
note and caution on the <xref linkend="gcc"/> page.
</para>
</caution>
<bridgehead renderas="sect3">Package Information</bridgehead>
<itemizedlist spacing="compact">
<listitem>
<para>
Download (HTTP): <ulink url="&gcc-java-download-http;"/>
</para>
</listitem>
<listitem>
<para>
Download (FTP): <ulink url="&gcc-java-download-ftp;"/>
</para>
</listitem>
<listitem>
<para>
Download MD5 sum: &gcc-java-md5sum;
</para>
</listitem>
<listitem>
<para>
Download size: &gcc-java-size;
</para>
</listitem>
<listitem>
<para>
Estimated disk space required: &gcc-java-buildsize;
</para>
</listitem>
<listitem>
<para>
Estimated build time: &gcc-java-time;
</para>
</listitem>
</itemizedlist>
<bridgehead renderas="sect3">Additional Downloads</bridgehead>
<itemizedlist spacing="compact">
<listitem>
<para>
Eclipse Java compiler: <ulink url="&ecj-download-ftp;"/>
</para>
</listitem>
<listitem>
<para>
ANTLR binary, for building <command>gjdoc</command> (optional):
<ulink url="&antlr-download-http;"/>
</para>
</listitem>
<!-- <listitem>
<para>
Required patch:
<ulink url="&patch-root;/gcc-&gcc-java-version;-upstream_fixes-1.patch"/>
</para>
</listitem>-->
</itemizedlist>
<bridgehead renderas="sect3">GCC Java Dependencies</bridgehead>
<bridgehead renderas="sect4">Required</bridgehead>
<para role="required">
<xref linkend="unzip"/>,
<xref linkend="which"/>, and
<xref linkend="zip"/>
</para>
<bridgehead renderas="sect4">Recommended</bridgehead>
<para role="recommended">
<xref linkend="dejagnu"/>, for tests
</para>
<bridgehead renderas="sect4">Optional</bridgehead>
<para role="optional">
<xref linkend="gtk2"/> and
<ulink url="https://download.gnome.org/sources/libart_lgpl/">
Libart
</ulink> for building the AWT peer
</para>
<para condition="html" role="usernotes">User Notes:
<ulink url="&blfs-wiki;/gcc-java"/></para>
</sect2>
<sect2 role="installation">
<title>Installation of GCC Java</title>
<para>
The instructions below assume that the C and C++ compilers have
the same version as the one you are installing, so that a
<quote>bootstrap</quote> is not necessary. If you are upgrading
the GCC version, then remove the <option>--disable-bootstrap</option> from
the <command>./configure</command> options below.
</para>
<para>
Install <application>GCC Java</application> by running the
following commands:
</para>
<screen><userinput>case $(uname -m) in
x86_64)
sed -e '/m64=/s/lib64/lib/' \
-i.orig gcc/config/i386/t-linux64
;;
esac
sed -i 's/\(install.*:\) install-.*recursive/\1/' libffi/Makefile.in &amp;&amp;
sed -i 's/\(install-data-am:\).*/\1/' libffi/include/Makefile.in &amp;&amp;
sed -i 's/absolute/file normalize/' libjava/testsuite/lib/libjava.exp &amp;&amp;
sed -i 's/major.*1000.*minor/major/' gcc/java/decl.c &amp;&amp;
cp ../ecj-4.9.jar ./ecj.jar &amp;&amp;
mkdir build &amp;&amp;
cd build &amp;&amp;
../configure \
--prefix=/usr \
--disable-multilib \
--with-system-zlib \
--disable-bootstrap \
--enable-java-home \
--with-jvm-root-dir=/opt/gcj \
--with-antlr-jar=$(pwd)/../../antlr-&antlr-version;-complete.jar \
--enable-languages=java &amp;&amp;
make</userinput></screen>
<para>
If you have installed additional packages such as
<application>Valgrind</application> and <application>GDB</application>,
the <application>GCC</application> part of the testsuite will run more
tests than in LFS. Some of those will report FAIL and others XPASS
(pass when expected to FAIL). To run the tests, issue:
</para>
<screen><userinput>ulimit -s 32768 &amp;&amp;
make -k check</userinput></screen>
<!-- The command above may error out, so using && may prevent the summary
to be run. -->
<para>
The tests are very long, and the results may be hard to find in the
logs, specially if you use job control with make. You can get a summary
of the tests with:
</para>
<screen><userinput>../contrib/test_summary</userinput></screen>
<para>
Now, as the <systemitem class="username">root</systemitem> user:
</para>
<screen role="root"><userinput>make install &amp;&amp;
mkdir -pv /usr/share/gdb/auto-load/usr/lib &amp;&amp;
mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib &amp;&amp;
chown -v -R root:root \
/usr/lib/gcc/*linux-gnu/&gcc-java-version;/include{,-fixed} &amp;&amp;
gcj -o ecj ../../ecj-4.9.jar \
--main=org.eclipse.jdt.internal.compiler.batch.Main &amp;&amp;
mv ecj /usr/bin &amp;&amp;
ln -sfv ../../../usr/bin/ecj /opt/gcj/bin/javac</userinput></screen>
</sect2>
<sect2 role="commands">
<title>Command Explanations</title>
<para>
The first two <command>sed</command> commands prevent the
installation of the <application>libffi</application> library bundled
with <application>GCC</application>, since it is outdated compared to
<xref linkend="libffi"/>.
</para>
<para>
The next two <command>sed</command> commands implement upstream fixes
to the <application>GCC Java</application> compiler and tests.
</para>
<para>
<command>mkdir build; cd build</command>: The
<application>GCC</application> documentation recommends
building the package in a dedicated build directory.
</para>
<para>
<parameter>--disable-multilib</parameter>: This parameter ensures
that files are created for the specific architecture of your computer.
</para>
<para>
<parameter>--with-system-zlib</parameter>: Uses the system
<application>zlib</application> instead of the bundled one.
</para>
<para>
<parameter>--disable-bootstrap</parameter>: Prevents the C and C++
compilers to recompile themselves. You should use this switch only
if the installed C and C++ compilers are the same version as the
ones you install.
</para>
<para>
<parameter>--enable-java-home</parameter>: Creates a directory
layout similar to that of a JVM.
</para>
<para>
<parameter>--with-jvm-root-dir=/opt/gcj</parameter>: Installs
the JVM in the specified location.
</para>
<para>
<parameter>--with-antlr-jar=...</parameter>: Specifies the location of
<application>ANTLR</application>, which is needed to build
<command>gjdoc</command>. Remove if you have not downloaded antlr.
</para>
<para>
<parameter>--enable-languages=java</parameter>:
This command identifies which language to build. Note it is unavoidable
that the <application>C</application> and <application>C++</application>
compilers be built too.
</para>
<para>
<option>--enable-java-awt=gtk</option>: Allows to build the Java AWT
<application>GTK+2</application> peer. Needed to have a fully functional
JVM.
</para>
<para>
<command>ulimit -s 32768</command>: This command prevents several
tests from running out of stack space.
</para>
<para>
<command>make -k check</command>: This command runs the test suite
without stopping if any errors are encountered.
</para>
<para>
<command>../contrib/test_summary</command>: This
command will produce a summary of the test suite results. You can append
<command>| grep -A7 Summ</command> to the command to produce an even more
condensed version of the summary. You may also wish to redirect the output
to a file for review and comparison later on.
</para>
<para>
<command>chown -v -R root:root
/usr/lib/gcc/*linux-gnu/...</command>:
If the package is built by a user other than root, the ownership of the
installed <filename class="directory">include</filename> directory (and
its content) will be incorrect. This command changes the ownership to
the <systemitem class="username">root</systemitem> user and group.
</para>
<para>
<command>gcj -o ecj ...</command>: compiles the eclipse compiler to
native code, which is much faster than bytecode. This compiler is
then used as a <command>javac</command> replacement in the JVM.
</para>
</sect2>
<sect2 role="configuration">
<title>Configuring GCC-Java</title>
<sect3>
<title>Configuration Information</title>
<para>
The configuration is the same as <xref linkend="ojdk-conf"/>,
replacing <filename class="directory">/opt/jdk</filename> with
<filename class="directory">/opt/gcj</filename>.
</para>
</sect3>
</sect2>
<sect2 role="content">
<title>Contents</title>
<segmentedlist>
<segtitle>Installed Programs</segtitle>
<segtitle>Installed Libraries</segtitle>
<segtitle>Installed Directories</segtitle>
<seglistitem>
<seg>
aot-compile, ecj, gappletviewer, gc-analyze, gcj, gcj-dbtool,
gcjh, gij, gjar, gjarsigner, gjavah, gjdoc, gkeytool, gnative2ascii,
gorbd, grmic, grmid, grmiregistry, gserialver, gtnameserv, jcf-dump,
jv-convert, rebuild-gcj-db. Symbolic links to these files are located
in <filename class="directory">/opt/gcj/bin</filename>
</seg>
<seg>
libgcj_bc.so, libgcj.so, libgcj-tools.so, and libgij.so
</seg>
<seg>
/usr/include/c++/&gcc-java-version;/{gcj,gnu,java,javax,org,sun},
/usr/lib/gcj-&gcc-java-version;-17, /usr/lib/jvm-exports,
/usr/lib/security, /opt/gcj, and /usr/share/java
</seg>
</seglistitem>
</segmentedlist>
<para>
Some programs, libraries, and descriptions are not listed here,
but can be found at
<ulink url="&lfs-root;/chapter06/gcc.html#contents-gcc"/> as they were
initially installed during the building of LFS.
</para>
<variablelist>
<bridgehead renderas="sect3">Short Descriptions</bridgehead>
<?dbfo list-presentation="list"?>
<?dbhtml list-presentation="table"?>
<varlistentry id="aot-compile">
<term><command>aot-compile</command></term>
<listitem>
<para>
searches a directory for Java bytecode and uses
<command>gcj</command> to compile it to native code.
</para>
<indexterm zone="gcc-java aot-compile">
<primary sortas="b-aot-compile">aot-compile</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="ecj">
<term><command>ecj</command></term>
<listitem>
<para>
is the Eclipse Java compiler.
</para>
<indexterm zone="gcc-java ecj">
<primary sortas="b-ecj">ecj</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="gappletviewer">
<term><command>gappletviewer</command></term>
<listitem>
<para>
loads and run a <application>Java</application> applet.
</para>
<indexterm zone="gcc-java gappletviewer">
<primary sortas="b-gappletviewer">gappletviewer</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="gc-analyze">
<term><command>gc-analyze</command></term>
<listitem>
<para>
analyzes garbage collector (GC) memory dumps from
<application>Java</application> code.
</para>
<indexterm zone="gcc-java gc-analyze">
<primary sortas="b-gc-analyze">gc-analyze</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="gcj">
<term><command>gcj</command></term>
<listitem>
<para>
is an ahead-of-time compiler for the <application>Java</application>
language.
</para>
<indexterm zone="gcc-java gcj">
<primary sortas="b-gcj">gcj</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="gcj-dbtool">
<term><command>gcj-dbtool</command></term>
<listitem>
<para>
is a tool for creating and manipulating class file mapping databases.
</para>
<indexterm zone="gcc-java gcj-dbtool">
<primary sortas="b-gcj-dbtool">gcj-dbtool</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="gcjh">
<term><command>gcjh</command></term>
<listitem>
<para>
generates header files from <application>Java</application> class files.
</para>
<indexterm zone="gcc-java gcjh">
<primary sortas="b-gcjh">gcjh</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="gij">
<term><command>gij</command></term>
<listitem>
<para>
is the GNU interpreter for <application>Java</application> bytecode.
</para>
<indexterm zone="gcc-java gij">
<primary sortas="b-gij">gij</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="gjar">
<term><command>gjar</command></term>
<listitem>
<para>
is an (partial) implementation of the <command>jar</command>
utility that comes with Sun's JDK.
</para>
<indexterm zone="gcc-java gjar">
<primary sortas="b-gjar">gjar</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="gjarsigner">
<term><command>gjarsigner</command></term>
<listitem>
<para>
is a Java ARchive (JAR) file signing and verification tool.
</para>
<indexterm zone="gcc-java gjarsigner">
<primary sortas="b-gjarsigner">gjarsigner</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="gjavah">
<term><command>gjavah</command></term>
<listitem>
<para>
generates header files from Java class files.
</para>
<indexterm zone="gcc-java gjavah">
<primary sortas="b-gjavah">gjavah</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="gjdoc">
<term><command>gjdoc</command></term>
<listitem>
<para>
is a documentation tool similar to <command>javadoc</command>.
</para>
<indexterm zone="gcc-java gjdoc">
<primary sortas="b-gjdoc">gjdoc</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="gkeytool">
<term><command>gkeytool</command></term>
<listitem>
<para>
manages private keys and public certificates in a
<application>Java</application> environment.
</para>
<indexterm zone="gcc-java gkeytool">
<primary sortas="b-gkeytool">gkeytool</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="gnative2ascii">
<term><command>gnative2ascii</command></term>
<listitem>
<para>
is an encoding converter for <application>Java</application>.
</para>
<indexterm zone="gcc-java gnative2ascii">
<primary sortas="b-gnative2ascii">gnative2ascii</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="gorbd">
<term><command>gorbd</command></term>
<listitem>
<para>
is an object request broker daemon.
</para>
<indexterm zone="gcc-java gorbd">
<primary sortas="b-gorbd">gorbd</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grmic-gcc">
<term><command>grmic</command></term>
<listitem>
<para>
generates stubs for Remote Method Invocation.
</para>
<indexterm zone="gcc-java grmic-gcc">
<primary sortas="b-grmic">grmic</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grmid-gcc">
<term><command>grmid</command></term>
<listitem>
<para>
RMI activation system daemon.
</para>
<indexterm zone="gcc-java grmid-gcc">
<primary sortas="b-grmid">grmid</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grmiregistry-gcc">
<term><command>grmiregistry</command></term>
<listitem>
<para>
starts a remote object registry on the current host.
</para>
<indexterm zone="gcc-java grmiregistry-gcc">
<primary sortas="b-grmiregistry">grmiregistry</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="gserialver">
<term><command>gserialver</command></term>
<listitem>
<para>
prints the serialVersionUID of the specified class.
</para>
<indexterm zone="gcc-java gserialver">
<primary sortas="b-gserialver">gserialver</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="gtnameserv">
<term><command>gtnameserv</command></term>
<listitem>
<para>
starts a naming service.
</para>
<indexterm zone="gcc-java gtnameserv">
<primary sortas="b-gtnameserv">gtnameserv</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="jcf-dump">
<term><command>jcf-dump</command></term>
<listitem>
<para>
prints information about <application>Java</application>
class files.
</para>
<indexterm zone="gcc-java jcf-dump">
<primary sortas="b-jcf-dump">jcf-dump</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="jv-convert">
<term><command>jv-convert</command></term>
<listitem>
<para>
converts files from one encoding to another.
</para>
<indexterm zone="gcc-java jv-convert">
<primary sortas="b-jv-convert">jv-convert</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="rebuild-gcj-db">
<term><command>rebuild-gcj-db</command></term>
<listitem>
<para>
Merge the per-solib databases made by
<application>aot-compile</application> into one system-wide
database.
</para>
<indexterm zone="gcc-java rebuild-gcj-db">
<primary sortas="b-rebuild-gcj-db">rebuild-gcj-db</primary>
</indexterm>
</listitem>
</varlistentry>
</variablelist>
</sect2>
</sect1>