glfs/general/prog/gcc.xml
Manuel Canales Esparcia 70e3220a47 Tagged gcc.xml
git-svn-id: svn://svn.linuxfromscratch.org/BLFS/trunk/BOOK@3970 af4574ff-66df-0310-9fd7-8a98e5e911e0
2005-05-04 20:49:36 +00:00

643 lines
24 KiB
XML

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../../general.ent">
%general-entities;
<!ENTITY gcc-download-http "http://mirrors.rcn.net/pub/sourceware/gcc/releases/gcc-&gcc-version;/gcc-&gcc-version;.tar.bz2">
<!ENTITY gcc-download-ftp "ftp://mirrors.rcn.net/pub/sourceware/gcc/releases/gcc-&gcc-version;/gcc-&gcc-version;.tar.bz2">
<!ENTITY gcc-md5sum "e744b30c834360fccac41eb7269a3011">
<!ENTITY gcc-size "27.4 MB">
<!ENTITY gcc-buildsize "1.62 GB">
<!ENTITY gcc-time "45.50 SBU (build and install all compilers)">
<!ENTITY gnat-download-http " ">
<!ENTITY gnat-download-ftp "ftp://cs.nyu.edu/pub/gnat/3.15p/gnat-3.15p-i686-pc-redhat71-gnu-bin.tar.gz">
<!ENTITY gnat-md5sum "57c060cd1ccef8b1ae9165b11d98780a">
<!ENTITY gnat-size "13.4 MB">
<!ENTITY gnat-time "0.01 SBU">
<!ENTITY gcc-testsuite-url "http://mirrors.rcn.net/pub/sourceware/gcc/releases/gcc-&gcc-version;/gcc-testsuite-&gcc-version;.tar.bz2">
<!ENTITY gcc-testsuite-md5sum "b4fff6ce0a038021b9e507917abb9a07">
]>
<sect1 id="gcc" xreflabel="GCC-&gcc-version;">
<?dbhtml filename="gcc.html" ?>
<sect1info>
<othername>$LastChangedBy$</othername>
<date>$Date$</date>
</sect1info>
<title>GCC-&gcc-version;</title>
<indexterm zone="gcc">
<primary sortas="a-gcc-3-4">GCC-&gcc-version;</primary>
</indexterm>
<sect2 role="package">
<title>Introduction to GCC</title>
<para>The <application>GCC</application> package contains GNU compilers.
This is useful for compiling programs written in <application>C</application>,
<application>C++</application>, <application>Fortran</application>,
<application>Java</application>, <application>Objective C</application> and
<application>Ada</application>.</para>
<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-buildsize;</para>
</listitem>
<listitem>
<para>Estimated build time: &gcc-time;</para>
</listitem>
</itemizedlist>
<bridgehead renderas="sect3">Additional Downloads</bridgehead>
<itemizedlist spacing='compact'>
<listitem>
<para>Required patch: <ulink
url="&patch-root;/gcc-&gcc-version;-no_fixincludes-1.patch"/></para>
</listitem>
<listitem>
<para>Required patch: <ulink
url="&patch-root;/gcc-&gcc-version;-linkonce-1.patch"/></para>
</listitem>
<listitem>
<para>Test suite: <ulink url="&gcc-testsuite-url;"/></para>
</listitem>
<listitem>
<para>Test suite MD5 sum: &gcc-testsuite-md5sum;</para>
</listitem>
</itemizedlist>
<bridgehead renderas="sect3">GCC Dependencies</bridgehead>
<bridgehead renderas="sect4">Recommended</bridgehead>
<para><xref linkend="dejagnu"/></para>
<note>
<para>If you plan to compile Ada, you will need to install
<application>GNAT</application> temporarily to satisfy the circular
dependency when you recompile <application>GCC</application>
to include Ada.</para>
</note>
<bridgehead renderas="sect3">Package Information</bridgehead>
<itemizedlist spacing="compact">
<listitem>
<para>Download (HTTP): <ulink url="&gnat-download-http;"/></para>
</listitem>
<listitem>
<para>Download (FTP): <ulink url="&gnat-download-ftp;"/></para>
</listitem>
<listitem>
<para>Download MD5 sum: &gnat-md5sum;</para>
</listitem>
<listitem>
<para>Download size: &gnat-size;</para>
</listitem>
<listitem>
<para>Estimated build time: &gnat-time;</para>
</listitem>
</itemizedlist>
<bridgehead renderas="sect3">GNAT Dependencies</bridgehead>
<bridgehead renderas="sect4">Required</bridgehead>
<para><xref linkend="tcsh"/></para>
</sect2>
<sect2 role="installation">
<title>Installation of GNAT</title>
<para>Install <application>GNAT</application> by running
the following commands:</para>
<screen><userinput>./doconfig</userinput></screen>
<para>The above script will ask you how and where you would like to install
<application>GNAT</application>. To avoid conflicts with
the system <command>gcc</command>, the package will be installed in a separate
directory, that can later be removed from the system.</para>
<para>In response to the questions asked by the <command>doconfig</command>
script, enter <userinput>3</userinput> in response to the first question
and <userinput>/opt/gnat</userinput> in response to the second question.</para>
<para>To finish the install, run the following command as the
<systemitem class="username">root</systemitem> user:</para>
<screen role="root"><userinput>./doinstall</userinput></screen>
<para>The <application>GNAT</application> compiler can be
invoked by executing the <command>gcc</command> binary installed
by the above script.</para>
<para>You may now remove the <application>GNAT</application>
source directory:</para>
<screen><userinput>cd .. &amp;&amp;
rm -rf gnat-3.15p-i686-pc-linux-gnu-bin</userinput></screen>
<para>Prepare to compile <application>GCC</application> by placing the
<application>GNAT</application> <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</userinput></screen>
</sect2>
<sect2 role="installation">
<title>Installation of GCC</title>
<para>Install <application>GCC</application> by running the
following commands:</para>
<important>
<para>The installation process may overwrite your existing
<application>GCC</application> compiler and libraries. It
is highly recommended that you have the <application>Tcl</application>,
<application>Expect</application> and <application>DejaGnu</application>
packages installed, as well as unpacking the <application>GCC</application>
testsuite tarball before beginning the build.</para>
<para>Do not continue with the <command>make install</command> command
until you're confident the build was successful. You can compare your test results
with those found at <ulink url="http://gcc.gnu.org/ml/gcc-testresults/"/>. There's
also an i686 platform test result produced by an LFS-SVN-20050316 system at
<ulink url="http://linuxfromscratch.org/~randy/gcc343_test.txt"/>. You may also
want to refer to the information found in the
<application>GCC</application>-Pass 2 section of Chapter 5 in the LFS book
(<ulink url="&lfs-root;/chapter05/gcc-pass2.html"/>).</para>
</important>
<note>
<para>Some of the <application>Java</application> programs installed by
the <application>GCC</application> package conflict (have the same names)
with programs from the <xref linkend="jdk"/> package. If you're installing the
<application>Java</application> language from the
<application>GCC</application> package but you wish to use the programs
from the <application>JDK</application> as the defaults, ensure
<filename class='directory'>$JAVA_HOME/bin</filename> is listed before
<filename class='directory'>/usr/bin</filename> in your <envar>PATH</envar>
variable after the <application>GCC</application> installation is complete.</para>
</note>
<screen><userinput>patch -Np1 -i ../gcc-&gcc-version;-no_fixincludes-1.patch &amp;&amp;
patch -Np1 -i ../gcc-&gcc-version;-linkonce-1.patch &amp;&amp;
sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in &amp;&amp;
mkdir ../gcc-build &amp;&amp;
cd ../gcc-build &amp;&amp;
../gcc-&gcc-version;/configure --prefix=/usr --libexecdir=/usr/lib \
--enable-shared --enable-threads=posix --enable-__cxa_atexit \
--enable-clocale=gnu --enable-languages=c,c++,objc,f77,ada,java &amp;&amp;
make bootstrap &amp;&amp;
make -C gcc gnatlib-shared &amp;&amp;
make -C gcc gnattools &amp;&amp;
make -k check &amp;&amp;
../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;
ln -v -sf ../usr/bin/cpp /lib &amp;&amp;
ln -v -sf gcc /usr/bin/cc &amp;&amp;
ln -v -sf g77 /usr/bin/f77 &amp;&amp;
chown -v -R root:root \
/usr/lib/gcc/i686-pc-linux-gnu/&gcc-version;/include &amp;&amp;
chown -v -R root:root \
/usr/lib/gcc/i686-pc-linux-gnu/&gcc-version;/ada{lib,include}</userinput></screen>
<para>There is a bug in the installation of the
<filename class='libraryfile'>libffi</filename> interface headers. The
architecture specific <filename>ffitarget.h</filename> file is not installed.
If you included Java as one of the installed languages, install the missing
file using the command below. Substitute for the
<replaceable>[arch]</replaceable> in the command with the appropriate
directory path for your system.</para>
<screen role="root"><userinput>install -v -m644 libffi/src/<replaceable>[arch]</replaceable>/ffitarget.h \
/usr/include</userinput></screen>
<para>As the <systemitem class="username">root</systemitem> user, remove the
<application>GNAT</application> installation:</para>
<screen role="root"><userinput>rm -rf /opt/gnat</userinput></screen>
<para>Now, as the unprivileged user, restore your old
<envar>PATH</envar>:</para>
<screen><userinput>export PATH=$PATH_HOLD &amp;&amp;
unset PATH_HOLD</userinput></screen>
</sect2>
<sect2 role="commands">
<title>Command Explanations</title>
<para><command>sed -i 's/install_to_$(INSTALL_DEST) //'
libiberty/Makefile.in</command>: This command suppresses the installation of
<filename class='libraryfile'>libiberty.a</filename> as the version provided
by <application>Binutils</application> is used instead.</para>
<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 commands are required to build
the <application>C++</application> libraries to published standards.</para>
<para><parameter>--enable-clocale=gnu</parameter>: This command is a
failsafe for incomplete locale data.</para>
<para><parameter>--enable-languages=c,c++,objc,f77,ada,java</parameter>:
This command identifies which languages to build. You may modify this command
to remove undesired languages.</para>
<para><command>make -C gcc gnatlib-shared</command>: This command builds the
Ada shared and static libraries. Skip this step if you have not enabled
Ada as one of the languages.</para>
<para><command>make -C gcc gnattools</command>: This command builds the
Ada development tools and binaries. Skip this step if you have not enabled
Ada as one of the languages.</para>
<para><command>make -k check</command>: This command runs the test suite
without stopping should any errors be 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>ln -sf ../usr/bin/cpp /lib</command>: This command creates a
link to the C PreProcessor as some packages expect it to be installed in the
<filename class='directory'>/lib</filename> directory.</para>
<para><command>ln -sf gcc /usr/bin/cc; ln -sf g77 /usr/bin/f77</command>:
These links are created as some packages refer to the C and Fortran compilers
using an alternate name.</para>
<para><command>chown -R root:root /usr/lib/gcc/i686-pc-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
root:root. Omit the command changing the Ada directories if you did not
include Ada as one of the installed languages.</para>
</sect2>
<sect2 role="content">
<title>Contents</title>
<segmentedlist>
<segtitle>Installed Programs</segtitle>
<segtitle>Installed Libraries</segtitle>
<segtitle>Installed Directories</segtitle>
<seglistitem>
<seg>addr2name.awk, cc, c++, cpp, f77, g++, g77, gcc, gccbug, gcj, gcjh, gcov,
gij, gnat, gnatbind, gnatbl, gnatchop, gnatclean, gnatfind, gnatkr, gnatlink,
gnatls, gnatmake, gnatname, gnatprep, gnatxref, gpr2make, gprcmd, grepjar,
jar, jcf-dump, jv-convert, jv-scan, rmic, rmiregistry and architecture
specific names for c++, g++, gcc, gcc-&gcc-version;, gcj, and gcjh</seg>
<seg>lib-org-w3c-dom.[so,a], lib-org-xml-sax.[so,a], libffi-2.00-beta.so,
libffi.[so,a], libfrtbegin.a, libg2c.[so,a], libgcc_s.so, libgcj.[so,a],
libobjc.[so,a], libstdc++.[so.6,a], libsupc++.a, and numerous other run-time
libraries and executables in /usr/lib/gcc</seg>
<seg>/usr/include/c++, /usr/include/gcj, /usr/include/gnu, /usr/include/java,
/usr/include/javax, /usr/lib/gcc, /usr/lib/security, /usr/share/gnat, and
/usr/share/java</seg>
</seglistitem>
</segmentedlist>
<variablelist>
<bridgehead renderas="sect3">Short Descriptions</bridgehead>
<?dbfo list-presentation="list"?>
<?dbhtml list-presentation="table"?>
<para>Some program and library descriptions are not listed here, but can be
found at <ulink url="&lfs-root;/chapter06/gcc.html#contents-gcc"/>.</para>
<varlistentry id="addr2name.awk">
<term><command>addr2name.awk</command></term>
<listitem>
<para> emulates some of the functionality of addr2line.</para>
<indexterm zone="gcc addr2name.awk">
<primary sortas="b-addr2name.awk">addr2name.awk</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="f77">
<term><command>f77</command></term>
<listitem>
<para>is a symlink to <command>g77</command>, created for
compatibility purposes.</para>
<indexterm zone="gcc f77">
<primary sortas="g-f77">f77</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="g77">
<term><command>g77</command></term>
<listitem>
<para>is the <application>Fortran</application> compiler invoked by
<command>gcc</command>.</para>
<indexterm zone="gcc g77">
<primary sortas="b-g77">g77</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 gcj">
<primary sortas="b-gcj">gcj</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 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 gij">
<primary sortas="b-gij">gij</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="gnat">
<term><command>gnat</command></term>
<listitem>
<para>is the <application>Ada</application> compiler invoked by
<command>gcc</command>.</para>
<indexterm zone="gcc 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 gnatbind">
<primary sortas="b-gnatbind">gnatbind</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="gnatbl">
<term><command>gnatbl</command></term>
<listitem>
<para>is the <application>Ada</application> linker.</para>
<indexterm zone="gcc gnatbl">
<primary sortas="b-gnatbl">gnatbl</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 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 gnatclean">
<primary sortas="b-gnatclean">gnatclean</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="gnatfind">
<term><command>gnatfind</command></term>
<listitem>
<para> is the <application>GNAT</application> definition/use finder.</para>
<indexterm zone="gcc 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 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 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 gnatls">
<primary sortas="b-gnatls">gnatls</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="gnatmake">
<term><command>gnatmake</command></term>
<listitem>
<para>is an automatic <command>make</command> facility.</para>
<indexterm zone="gcc 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 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 gnatprep">
<primary sortas="b-gnatprep">gnatprep</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="gnatxref">
<term><command>gnatxref</command></term>
<listitem>
<para>is the <application>GNAT</application> cross-referencer.</para>
<indexterm zone="gcc gnatxref">
<primary sortas="b-gnatxref">gnatxref</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="gpr2make">
<term><command>gpr2make</command></term>
<listitem>
<para>is a tool used to create <filename>Makefile</filename>s that
support compilation by multiple languages.</para>
<indexterm zone="gcc gpr2make">
<primary sortas="b-gpr2make">gpr2make</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="gprcmd">
<term><command>gprcmd</command></term>
<listitem>
<para>is a utility used by <filename>Makefile.generic</filename> to
handle multi-language builds. It provides a set of commands so that the
<filename>Makefile</filename>s do not need to depend on Unix utilities not
available on all targets.</para>
<indexterm zone="gcc gprcmd">
<primary sortas="b-gprcmd">gprcmd</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grepjar">
<term><command>grepjar</command></term>
<listitem>
<para>searches <filename>jar</filename> files for a pattern.</para>
<indexterm zone="gcc grepjar">
<primary sortas="b-grepjar">grepjar</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="jar-gcc">
<term><command>jar</command></term>
<listitem>
<para>is an archive tool for <application>Java</application> archives.</para>
<indexterm zone="gcc jar-gcc">
<primary sortas="b-jar">jar</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 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 jv-convert">
<primary sortas="b-jv-convert">jv-convert</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="jv-scan">
<term><command>jv-scan</command></term>
<listitem>
<para>prints information about <application>Java</application>
source files.</para>
<indexterm zone="gcc jv-scan">
<primary sortas="b-jv-scan">jv-scan</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="rmic-gcc">
<term><command>rmic</command></term>
<listitem>
<para>generates stubs for Remote Method Invocation.</para>
<indexterm zone="gcc rmic-gcc">
<primary sortas="b-rmic">rmic</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="rmiregistry-gcc">
<term><command>rmiregistry</command></term>
<listitem>
<para> starts a remote object registry on the current host.</para>
<indexterm zone="gcc rmiregistry-gcc">
<primary sortas="b-rmiregistry">rmiregistry</primary>
</indexterm>
</listitem>
</varlistentry>
</variablelist>
</sect2>
</sect1>