GCC-Java-5.3.0
Introduction to GCC-Java
See the introduction to the Java language and system at Java-1.8.0.72.
The GNU Compiler Collection (GCC) contains a Java compiler to
native code. Together with the ecj
Java compiler from Eclipse (to bytecode), it provides a way to
build an acceptable JVM from source. However, since the release of
OpenJDK, the development of
GCC-Java has almost stopped, and the built JVM is an old version,
which cannot be used for building OpenJDK-1.8.0.72.
This package is known to build and work properly using an LFS-7.9
platform.
Caution
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 GCC-5.3.0 page.
Package Information
Additional Downloads
GCC Java Dependencies
Required
UnZip-6.0,
Which-2.21, and Zip-3.0
Recommended
DejaGnu-1.5.3, for tests
Optional
GTK+-2.24.29 and Libart for
building the AWT peer
User Notes: http://wiki.linuxfromscratch.org/blfs/wiki/gcc-java
Installation of GCC Java
The instructions below assume that the C and C++ compilers have the
same version as the one you are installing, so that a
“bootstrap” is not
necessary. If you are upgrading the GCC version, then remove the
--disable-bootstrap
from the
./configure options
below.
Install GCC Java by running the
following commands:
sed -i 's/\(install.*:\) install-.*recursive/\1/' libffi/Makefile.in &&
sed -i 's/\(install-data-am:\).*/\1/' libffi/include/Makefile.in &&
cp ../ecj-latest.jar ./ecj.jar &&
mkdir ../gcc-build &&
cd ../gcc-build &&
../gcc-5.3.0/configure \
--prefix=/usr \
--disable-multilib \
--with-system-zlib \
--disable-bootstrap \
--enable-java-home \
--with-jvm-root-dir=/opt/gcj \
--with-antlr-jar=$(pwd)/../antlr-4.5.1-complete.jar \
--enable-languages=java &&
make
If you have installed additional packages such as Valgrind and GDB, the GCC
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:
ulimit -s 32768 &&
make -k check
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:
../gcc-5.3.0/contrib/test_summary
Now, as the root
user:
make install &&
mkdir -pv /usr/share/gdb/auto-load/usr/lib &&
mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib &&
chown -v -R root:root \
/usr/lib/gcc/*linux-gnu/5.3.0/include{,-fixed} &&
gcj -o ecj ../ecj-latest.jar \
--main=org.eclipse.jdt.internal.compiler.batch.Main &&
mv ecj /usr/bin &&
ln -sfv ../../../usr/bin/ecj /opt/gcj/bin/javac
Command Explanations
The two sed commands
prevent the installation of the libffi library bundled with GCC, since it is outdated compared to
libffi-3.2.1.
mkdir ../gcc-build; cd
../gcc-build: The GCC documentation recommends building the
package in a dedicated build directory.
--disable-multilib
: This
parameter ensures that files are created for the specific
architecture of your computer.
--with-system-zlib
: Uses
the system zlib instead of the
bundled one.
--disable-bootstrap
:
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.
--enable-java-home
: Creates
a directory layout similar to that of a JVM.
--with-jvm-root-dir=/opt/gcj
:
Installs the JVM in the specified location.
--with-antlr-jar=...
:
Specifies the location of ANTLR,
which is needed to build gjdoc. Remove if you have not
downloaded antlr.
--enable-languages=java
:
This command identifies which language to build. Note it is
unavoidable that the C and
C++ compilers be built too.
--enable-java-awt=gtk
: Allows to build
the Java AWT GTK+2 peer. Needed to
have a fully functional JVM.
ulimit -s 32768: This
command prevents several tests from running out of stack space.
make -k check: This
command runs the test suite without stopping if any errors are
encountered.
../gcc-5.3.0/contrib/test_summary:
This command will produce a summary of the test suite results. You
can append | grep -A7
Summ 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.
chown -v -R root:root
/usr/lib/gcc/*linux-gnu/...: If the package is
built by a user other than root, the ownership of the installed
include
directory (and its content)
will be incorrect. This commands changes the ownership to the
root
user and group.
gcj -o ecj ...:
compiles the eclipse compiler to native code, which is much faster
than bytecode. This compiler is then used as a javac replacement in the JVM.
Contents
Installed Programs:
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
/opt/gcj/bin
Installed Libraries:
libgcj_bc.so, libgcj.so, libgcj-tools.so,
and libgij.so
Installed Directories:
/usr/include/c++/5.3.0/{gcj,gnu,java,javax,org,sun},
/usr/lib/gcj-5.3.0-16, /usr/lib/jvm-exports, /usr/lib/security,
/opt/gcj, and /usr/share/java
Some programs, libraries, and descriptions are not listed here, but
can be found at ../../../../lfs/view/7.9/chapter06/gcc.html#contents-gcc
as they were initially installed during the building of LFS.
Short Descriptions
aot-compile
|
searches a directory for Java bytecode and uses
gcj to
compile it to native code.
|
ecj
|
is the Eclipse Java compiler.
|
gappletviewer
|
loads and run a Java
applet.
|
gc-analyze
|
analyzes garbage collector (GC) memory dumps from
Java code.
|
gcj
|
is an ahead-of-time compiler for the Java language.
|
gcj-dbtool
|
is a tool for creating and manipulating class file
mapping databases.
|
gcjh
|
generates header files from Java class files.
|
gij
|
is the GNU interpreter for Java bytecode.
|
gjar
|
is an (partial) implementation of the jar utility that comes
with Sun's JDK.
|
gjarsigner
|
is a Java ARchive (JAR) file signing and verification
tool.
|
gjavah
|
generates header files from Java class files.
|
gjdoc
|
is a documentation tool similar to javadoc.
|
gkeytool
|
manages private keys and public certificates in a
Java environment.
|
gnative2ascii
|
is an encoding converter for Java.
|
gorbd
|
is an object request broker daemon.
|
grmic
|
generates stubs for Remote Method Invocation.
|
grmid
|
RMI activation system daemon.
|
grmiregistry
|
starts a remote object registry on the current host.
|
gserialver
|
prints the serialVersionUID of the specified class.
|
gtnameserv
|
starts a naming service.
|
jcf-dump
|
prints information about Java class files.
|
jv-convert
|
converts files from one encoding to another.
|
rebuild-gcj-db
|
Merge the per-solib databases made by aot-compile into one system-wide
database.
|
Last updated on 2016-03-02 04:40:13 -0800