glfs/archive/gcc-ada.xml

580 lines
20 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 "&gnu-http;/gcc/gcc-&gcc-ada-version;/gcc-&gcc-ada-version;.tar.xz">
<!ENTITY gcc-download-ftp "&gnu-ftp;/gcc/gcc-&gcc-ada-version;/gcc-&gcc-ada-version;.tar.xz">
<!ENTITY gcc-md5sum "4ab282f414676496483b3e1793d07862">
<!ENTITY gcc-size "61 MB">
<!ENTITY gcc-ada-buildsize "7.0 GB (add 369 MB for tests, add 1.6 GB if GNAT install dir is not removed)">
<!ENTITY gcc-ada-time "25 SBU (with parallelism=4, add 92 SBU for tests)">
<!-- Keeping these the same because the new GNAT binary for x86_64
Requires Qt4 and a GUI to install. The i686 one is being tested
seperately from this update.-->
<!ENTITY gnat-download-http "https://libre.adacore.com/download/">
<!ENTITY gnat-64-download-http "http://mirrors.cdn.adacore.com/art/591c6d80c7a447af2deed1d7">
<!ENTITY gnat-64-md5sum "226dac83d9e6490fc8542ac0934a1db0">
<!ENTITY gnat-64-size "473 MB">
<!ENTITY gnat-32-download-http "http://mirrors.cdn.adacore.com/art/564b3e9dc8e196b040fbe248">
<!ENTITY gnat-32-md5sum "69423c7ad8d9759377d4fff71a78992d">
<!ENTITY gnat-32-size "222 MB">
]>
<sect1 id="gcc-ada" xreflabel="GCC-Ada-&gcc-ada-version;">
<?dbhtml filename="gcc-ada.html" ?>
<sect1info>
<date>$Date$</date>
</sect1info>
<title>GCC-Ada-&gcc-ada-version;</title>
<indexterm zone="gcc-ada">
<primary sortas="a-gcc-ada">GCC-Ada-&gcc-ada-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, developed 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. You do not need to do that if you already have built
<application>GNAT</application> tools.
</para>
&lfs84_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>
<note>
<para>
If you want to install other compilers in the <application>GCC
</application> collection, simply add them to the
<parameter>--enable-languages</parameter> parameter for <command>
configure</command>. If you rebuild <application>GCC</application>
without enabling ada after running the instructions on this page,
the new compiler will not be able to compile ADA anymore. If you already
have ADA instaled, you do not need to use the instructions on this page,
simply add <parameter>ada</parameter> to the
<parameter>--enable-languages</parameter> parameter using the
instructions from <xref linkend="gcc"/>.
</para>
</note>
<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>
<!-- gnat-2018 uses graphical installer, stick to 2017 -->
<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 2017 (64 bit machines) or
2014 (32 bit machines), 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-ada-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>
<bridgehead renderas="sect4">Optional</bridgehead>
<para role="optional">
<xref linkend="gdb"/> and
<xref linkend="valgrind"/> (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>case $(uname -m) in
x86_64)
sed -e '/m64=/s/lib64/lib/' \
-i.orig gcc/config/i386/t-linux64
;;
esac
mkdir build &amp;&amp;
cd build &amp;&amp;
../configure \
--prefix=/usr \
--disable-multilib \
--disable-libmpx \
--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>../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-ada-version;/include{,-fixed} \
/usr/lib/gcc/*linux-gnu/&gcc-ada-version;/ada{lib,include}</userinput></screen>
<para>
You should now remove the <application>GNAT</application>
installation and perform other cleanups. First, as the <systemitem
class="username">root</systemitem> user:
</para>
<screen role="root"><userinput>rm -rf /opt/gnat</userinput></screen>
<para>
Then, as a normal user:
</para>
<screen><userinput>export PATH=$PATH_HOLD &amp;&amp;
unset PATH_HOLD</userinput></screen>
</sect2>
<sect2 role="commands">
<title>Command Explanations</title>
<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.
<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>
<!-- Unlike standard GCC, removing this could break compatibility
with the GNAT binary for i686 because it uses gcc-4.7.3 in the
binary. Leave it alone until tested. -->
<para>
<option>--with-default-libstdcxx-abi=gcc4-compatible</option>: Use this
switch if you are building <application>GNAT</application> tools using a
<application>GCC</application> version prior to 5.1.0,
and you do not want to recompile all the libraries written in C++.
</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> 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
</seg>
<seg>
libgnarl.{so,a}, libgnat.{so,a} in <filename class="directory">
/usr/lib/gcc/&lt;arch-triplet&gt;/&gcc-ada-version;/adalib</filename>
</seg>
<seg>
/usr/lib/gcc/&lt;arch-triplet&gt;/&gcc-ada-version;/ada{include,lib}
and /usr/lib/gcc/&lt;arch-triplet&gt;/&gcc-ada-version;/plugin/include/ada
</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
compilation, 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>