glfs/general/prog/gcc-ada.xml

466 lines
17 KiB
XML
Raw Normal View History

<?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-download-http "http://ftp.gnu.org/gnu/gcc/gcc-&gcc-version;/gcc-&gcc-version;.tar.bz2">
<!ENTITY gcc-download-ftp "ftp://ftp.gnu.org/gnu/gcc/gcc-&gcc-version;/gcc-&gcc-version;.tar.bz2">
<!ENTITY gcc-md5sum "9709b49ae0e904cbb0a6a1b62853b556">
<!ENTITY gcc-size "86 MB">
<!ENTITY gcc-ada-buildsize "5 GB (0.7 GB added if GNAT install dir is not removed)">
<!ENTITY gcc-ada-time "39 SBU (and 75 SBU for tests)">
<!ENTITY gnat-download-http "https://libre.adacore.com/download/">
<!ENTITY gnat-64-download-http "http://mirrors.cdn.adacore.com/art/7427735035ecc98968ebfcee17494161b0de28ef">
<!ENTITY gnat-64-md5sum "c0863ed75109b5aa737becfd5a6ec038">
<!ENTITY gnat-64-size "225 MB">
<!ENTITY gnat-32-download-http "http://mirrors.cdn.adacore.com/art/3fc05fc61cbc7ab4f291ed19ea4cb269fffd17bd">
<!ENTITY gnat-32-md5sum "69423c7ad8d9759377d4fff71a78992d">
<!ENTITY gnat-32-size "222 MB">
]>
<sect1 id="gcc-ada" xreflabel="GCC-Ada-&gcc-version;">
<?dbhtml filename="gcc-ada.html" ?>
<sect1info>
<othername>$LastChangedBy: fernando $</othername>
<date>$Date: 2014-05-10 22:28:15 +0200 (sam. 10 mai 2014) $</date>
</sect1info>
<title>GCC-Ada-&gcc-version;</title>
<indexterm zone="gcc-ada">
<primary sortas="a-gcc-4-0">GCC-Ada&gcc-version;</primary>
</indexterm>
<sect2 role="package">
<title>Introduction to the GCC Ada compiler</title>
<para>Ada is a modern programming language designed for large, long-lived
applications &mdash; and embedded systems in particular &mdash; 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.</para>
<para>The compiler and associated tools on this page are known as the
<application>GNAT</application> technology, developped by the Adacore
company, using the <application>GCC</application> 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.</para>
<!-- &lfs75_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
notes 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-download-http;"/></para>
</listitem>
<listitem>
<para>Download (FTP): <ulink url="&gcc-download-ftp;"/></para>
</listitem>
<listitem>
<para>Download MD5 sum: &gcc-md5sum;</para>
</listitem>
<listitem>
<para>Download size: &gcc-size;</para>
</listitem>
<listitem>
<para>Estimated disk space required: &gcc-ada-buildsize;</para>
</listitem>
<listitem>
<para>Estimated build time: &gcc-ada-time;</para>
</listitem>
</itemizedlist>
<bridgehead renderas="sect3">Additional Downloads</bridgehead>
<note>
<para>You will need to install <application>GNAT</application>
temporarily to satisfy the circular dependency. You may point your
browser to the <ulink url="&gnat-download-http;">AdaCore download
page</ulink>, 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.</para>
</note>
<itemizedlist spacing="compact">
<listitem>
<para>
GNAT 64 bit binary: <ulink url="&gnat-64-download-http;"/>
</para>
</listitem>
<listitem>
<para>
GNAT 64 bit MD5 sum: &gnat-64-md5sum;
</para>
</listitem>
<listitem>
<para>
GNAT 64 bit size: &gnat-64-size;
</para>
</listitem>
<listitem>
<para>
GNAT 32 bit binary: <ulink url="&gnat-32-download-http;"/>
</para>
</listitem>
<listitem>
<para>
GNAT 32 bit MD5 sum: &gnat-32-md5sum;
</para>
</listitem>
<listitem>
<para>
GNAT 32 bit size: &gnat-32-size;
</para>
</listitem>
<listitem>
<para>
Required patch:
<ulink url="&patch-root;/gcc-&gcc-version;-upstream_fixes-1.patch"/>
</para>
</listitem>
</itemizedlist>
<bridgehead renderas="sect3">GCC Ada Dependencies</bridgehead>
<bridgehead renderas="sect4">Recommended</bridgehead>
<para role="recommended">
<xref linkend="dejagnu"/>, for tests
</para>
<para condition="html" role="usernotes">User Notes:
<ulink url="&blfs-wiki;/gcc-ada"/></para>
</sect2>
<sect2 role="installation">
<title>Installation of the GNAT binary</title>
<para>Before unpacking and changing into the GCC source directory, first
unpack the <application>GNAT</application> tarball, and change to the
GNAT directory. Then, install the <application>GNAT</application> binary
by running the following command as the
<systemitem class="username">root</systemitem> user:</para>
<screen role="root"><userinput>make ins-all prefix=/opt/gnat</userinput></screen>
<para>The <application>GNAT</application> compiler can be invoked by
executing the <command>gcc</command> binary installed in <filename
class="directory">/opt/gnat/bin</filename>.</para>
<para>You may now remove the <application>GNAT</application>
source directory if desired.</para>
<para>Prepare to compile <application>GCC</application> by placing the
<application>GNAT</application> version of <command>gcc</command> at the
beginning of the <envar>PATH</envar> variable by using the following
commands:</para>
<screen><userinput>PATH_HOLD=$PATH &amp;&amp;
export PATH=/opt/gnat/bin:$PATH_HOLD</userinput></screen>
<para>Doing so has the drawback that the <application>GCC</application>
and <application>Binutils</application> executables are taken
from the just installed <application>GNAT</application> package, but the
versions of those executables are outdated compared to those installed in
LFS. This is not important for the <application>GCC</application> compilers,
since they recompile themselves during the bootstrap process. On the other
hand, the outdated <command>ld</command> and <command>as</command> tools
are used all along. In order to use the LFS tools, issue as the
<systemitem class="username">root</systemitem> user:</para>
<screen role="root"><userinput>find /opt/gnat -name ld -exec mv -v {} {}.old \;
find /opt/gnat -name as -exec mv -v {} {}.old \;</userinput></screen>
</sect2>
<sect2 role="installation">
<title>Installation of GCC Ada</title>
<para>Install <application>GCC Ada</application> by running the
following commands:</para>
<screen><userinput>patch -Np1 -i ../gcc-&gcc-version;-upstream_fixes-1.patch &amp;&amp;
mkdir ../gcc-build &amp;&amp;
cd ../gcc-build &amp;&amp;
../gcc-&gcc-version;/configure \
--prefix=/usr \
--libdir=/usr/lib \
--enable-shared \
--enable-threads=posix \
--enable-__cxa_atexit \
--enable-clocale=gnu \
--disable-multilib \
--with-system-zlib \
--enable-languages=ada &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 parallel jobs with make. You can get a summary
of the tests with:</para>
<screen><userinput>../gcc-&gcc-version;/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-version;/include{,-fixed} \
/usr/lib/gcc/*linux-gnu/&gcc-version;/ada{lib,include}</userinput></screen>
<para>You should now remove the <application>GNAT</application>
installation and perform other cleanups:</para>
<screen><userinput>rm -rf /opt/gnat &amp;&amp;
export PATH=$PATH_HOLD &amp;&amp;
unset PATH_HOLD</userinput></screen>
</sect2>
<sect2 role="commands">
<title>Command Explanations</title>
<para><command>mkdir ../gcc-build; cd ../gcc-build</command>: The
<application>GCC</application> documentation recommends
building the package in a dedicated build directory.</para>
<para><parameter>--enable-shared --enable-threads=posix
--enable-__cxa_atexit</parameter>: These parameters are required to build
the <application>C++</application> libraries to published standards.</para>
<para><parameter>--enable-clocale=gnu</parameter>: This parameter is a
failsafe for incomplete locale data.</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.
<application>zlib</application> is used for compressing
and uncompressing <application>GCC</application>'s intermediate
language in LTO (Link Time Optimization) object files.
</para>
<para>
<parameter>--enable-languages=ada</parameter>: Instructs the build system
to build the Ada tools and compiler. It is unavoidable that the
<application>C</application> and <application>C++</application>
compilers be built too.
</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>../gcc-&gcc-version;/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> and
<filename class="directory">adalib</filename> directories (and their
contents) will be incorrect. These commands change the ownership to the
<systemitem class="username">root</systemitem> user and group.</para>
</sect2>
<sect2 role="content">
<title>Contents</title>
<segmentedlist>
<segtitle>Installed Programs</segtitle>
<segtitle>Installed Libraries</segtitle>
<segtitle>Installed Directories</segtitle>
<seglistitem>
<seg>
gnat, gnatbind, gnatchop, gnatclean, gnatfind, gnatkr,
gnatlink, gnatls, gnatmake, gnatname, gnatprep, gnatxref,
and a run-time executable, gnat1, in <filename class="directory">
/usr/libexec/&lt;arch-triplet&gt;/&gcc-version;</filename>
</seg>
<seg>
libgnat.{so,a}, libgnarl.{so,a} in <filename class="directory">
/usr/lib/gcc/&lt;arch-triplet&gt;/&gcc-version;/adalib</filename>
</seg>
<seg>
/usr/lib/gcc/&lt;arch-triplet&gt;/&gcc-version;/ada{include,lib}
</seg>
</seglistitem>
</segmentedlist>
<para>Only the Ada specific files are listed here. Others 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="gnat">
<term><command>gnat</command></term>
<listitem>
<para>is a wrapper that accepts a number of commands and calls
the corresponding tool from the list below.</para>
<indexterm zone="gcc-ada gnat">
<primary sortas="b-gnat">gnat</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="gnatbind">
<term><command>gnatbind</command></term>
<listitem>
<para>is used to bind compiled objects.</para>
<indexterm zone="gcc-ada gnatbind">
<primary sortas="b-gnatbind">gnatbind</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="gnatchop">
<term><command>gnatchop</command></term>
<listitem>
<para>is useful for renaming files to meet the standard
<application>Ada</application> default file naming conventions.</para>
<indexterm zone="gcc-ada gnatchop">
<primary sortas="b-gnatchop">gnatchop</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="gnatclean">
<term><command>gnatclean</command></term>
<listitem>
<para>is used to remove files associated with a
<application>GNAT</application> project.</para>
<indexterm zone="gcc-ada gnatclean">
<primary sortas="b-gnatclean">gnatclean</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="gnatfind">
<term><command>gnatfind</command></term>
<listitem>
<para> is intended for locating definition and/or references to
specified entities in a <application>GNAT</application> project.</para>
<indexterm zone="gcc-ada gnatfind">
<primary sortas="b-gnatfind">gnatfind</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="gnatkr">
<term><command>gnatkr</command></term>
<listitem>
<para>is used to determine the crunched name for a given file, when
crunched to a specified maximum length.</para>
<indexterm zone="gcc-ada gnatkr">
<primary sortas="b-gnatkr">gnatkr</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="gnatlink">
<term><command>gnatlink</command></term>
<listitem>
<para>is used to link programs and build an executable file.</para>
<indexterm zone="gcc-ada gnatlink">
<primary sortas="b-gnatlink">gnatlink</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="gnatls">
<term><command>gnatls</command></term>
<listitem>
<para>is the compiled unit browser.</para>
<indexterm zone="gcc-ada gnatls">
<primary sortas="b-gnatls">gnatls</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="gnatmake">
<term><command>gnatmake</command></term>
<listitem>
<para>is the <application>Ada</application> compiler, which performs
compilaton, binding and linking.</para>
<indexterm zone="gcc-ada gnatmake">
<primary sortas="b-gnatmake">gnatmake</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="gnatname">
<term><command>gnatname</command></term>
<listitem>
<para>will list the files associated with a
<application>GNAT</application> project.</para>
<indexterm zone="gcc-ada gnatname">
<primary sortas="b-gnatname">gnatname</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="gnatprep">
<term><command>gnatprep</command></term>
<listitem>
<para>is the <application>GNAT</application> external
preprocessor.</para>
<indexterm zone="gcc-ada gnatprep">
<primary sortas="b-gnatprep">gnatprep</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="gnatxref">
<term><command>gnatxref</command></term>
<listitem>
<para>is similar to <command>gnatfind</command>, but generates
a full report of all cross-references.</para>
<indexterm zone="gcc-ada gnatxref">
<primary sortas="b-gnatxref">gnatxref</primary>
</indexterm>
</listitem>
</varlistentry>
</variablelist>
</sect2>
</sect1>