GCC-Ada-4.9.2
Introduction to the GCC Ada compiler
Ada is a modern programming language designed for large, long-lived
applications — and embedded systems in particular —
where reliability and efficiency are essential. It has a set of
unique technical features that make it highly effective for use in
large, complex and safety-critical projects.
The compiler and associated tools on this page are known as the
GNAT technology, developed by the
Adacore company, using the GCC
backend. Since parts of the Ada compiler are written in Ada, there
is a circular dependency on an Ada compiler. The instructions below
first install a binary compiler.
This package is known to build and work properly using an LFS-7.7
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 notes and caution on the GCC-4.9.2 page.
Package Information
Additional Downloads
Note
You will need to install GNAT
temporarily to satisfy the circular dependency. You may point
your browser to the AdaCore download page,
choose your platform and 2014, then select the file to download.
Alternatively, direct links to the 64 bit and 32 bit linux
versions are given below.
GCC Ada Dependencies
Recommended
DejaGnu-1.5.2, for tests
User Notes: http://wiki.linuxfromscratch.org/blfs/wiki/gcc-ada
Installation of the GNAT binary
Before unpacking and changing into the GCC source directory, first
unpack the GNAT tarball, and
change to the GNAT directory. Then, install the GNAT binary by running the following command
as the root
user:
make ins-all prefix=/opt/gnat
The GNAT compiler can be invoked
by executing the gcc
binary installed in /opt/gnat/bin
.
You may now remove the GNAT source
directory if desired.
Prepare to compile GCC by placing
the GNAT version of gcc at the beginning of the
PATH
variable by using the following
commands:
PATH_HOLD=$PATH &&
export PATH=/opt/gnat/bin:$PATH_HOLD
Doing so has the drawback that the GCC and Binutils executables are taken from the just
installed GNAT package, but the
versions of those executables are outdated compared to those
installed in LFS. This is not important for the GCC compilers, since they recompile themselves
during the bootstrap process. On the other hand, the outdated
ld and as tools are used all along. In
order to use the LFS tools, issue as the root
user:
find /opt/gnat -name ld -exec mv -v {} {}.old \;
find /opt/gnat -name as -exec mv -v {} {}.old \;
Installation of GCC Ada
Install GCC Ada by running the
following commands:
sed -i -e 's@/libx32/ld-linux-x32.so.2@/tools/libx32/ld-linux-x32.so.2@g' gcc/config/i386/linux64.h
sed -i -e 's@/lib/ld-linux.so.2@/lib32/ld-linux.so.2@g' gcc/config/i386/linux64.h
sed -i -e '/MULTILIB_OSDIRNAMES/d' gcc/config/i386/t-linux64
echo "MULTILIB_OSDIRNAMES = m64=../lib m32=../lib32 mx32=../libx32" >> gcc/config/i386/t-linux64
mkdir ../gcc-build &&
cd ../gcc-build &&
../gcc-4.9.2/configure \
--prefix=/usr \
--libdir=/usr/lib \
--enable-shared \
--enable-threads=posix \
--enable-__cxa_atexit \
--with-multilib-list=m32,m64,mx32 \
--enable-clocale=gnu \
--with-system-zlib \
--enable-cloog-backend=isl \
--enable-languages=ada &&
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 parallel jobs with make. You can get a
summary of the tests with:
../gcc-4.9.2/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/4.9.2/include{,-fixed} \
/usr/lib/gcc/*linux-gnu/4.9.2/ada{lib,include}
You should now remove the GNAT
installation and perform other cleanups:
rm -rf /opt/gnat &&
export PATH=$PATH_HOLD &&
unset PATH_HOLD
Command Explanations
mkdir ../gcc-build; cd
../gcc-build: The GCC documentation recommends building the
package in a dedicated build directory.
--enable-shared --enable-threads=posix
--enable-__cxa_atexit
: These parameters are required to
build the C++ libraries to
published standards.
--enable-clocale=gnu
: This
parameter is a failsafe for incomplete locale data.
--with-multilib-list=m32,m64,mx32
:
This parameter adds support for multilib compilation in 32-bit,
64-bit, and x32 ABI formats.
--with-system-zlib
: Uses
the system zlib instead of the
bundled one. zlib is used for
compressing and uncompressing GCC's intermediate language in LTO (Link Time
Optimization) object files.
--enable-cloog-backend=isl
:
This parameter enables the CLooG-ISL backend for Graphite Loop
Optimizations.
--enable-languages=ada
:
Instructs the build system to build the Ada tools and compiler. It
is unavoidable that the C and
C++ compilers be built too.
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-4.9.2/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
and adalib
directories (and their contents) will be
incorrect. These commands change the ownership to the root
user and group.
Contents
Installed Programs:
gnat, gnatbind, gnatchop, gnatclean,
gnatfind, gnatkr, gnatlink, gnatls, gnatmake, gnatname,
gnatprep, gnatxref, and a run-time executable, gnat1, in
/usr/libexec/<arch-triplet>/4.9.2
Installed Libraries:
libgnat.{so,a}, libgnarl.{so,a} in
/usr/lib/gcc/<arch-triplet>/4.9.2/adalib
Installed Directories:
/usr/lib/gcc/<arch-triplet>/4.9.2/ada{include,lib}
Only the Ada specific files are listed here. Others can be found at
../../../../lfs-multilib/chapter06/gcc.html#contents-gcc
as they were initially installed during the building of LFS.
Short Descriptions
gnat
|
is a wrapper that accepts a number of commands and calls
the corresponding tool from the list below.
|
gnatbind
|
is used to bind compiled objects.
|
gnatchop
|
is useful for renaming files to meet the standard
Ada default file naming
conventions.
|
gnatclean
|
is used to remove files associated with a GNAT project.
|
gnatfind
|
is intended for locating definition and/or references to
specified entities in a GNAT project.
|
gnatkr
|
is used to determine the crunched name for a given file,
when crunched to a specified maximum length.
|
gnatlink
|
is used to link programs and build an executable file.
|
gnatls
|
is the compiled unit browser.
|
gnatmake
|
is the Ada compiler,
which performs compilaton, binding and linking.
|
gnatname
|
will list the files associated with a GNAT project.
|
gnatprep
|
is the GNAT external
preprocessor.
|
gnatxref
|
is similar to gnatfind, but generates
a full report of all cross-references.
|
Last updated on 2015-02-23 16:51:12 -0500