glfs/general/prog/gcc.xml

410 lines
16 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/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-size "27.2 MB">
<!ENTITY gcc-buildsize "1.53 GB">
<!ENTITY gcc-time "48.94 SBU">
<!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-size "13.5 MB">
<!ENTITY gnat-buildsize "48 MB">
<!ENTITY gnat-time "0.01 SBU">
]>
<sect1 id="gcc" xreflabel="GCC-&gcc-version;">
<sect1info>
<othername>$LastChangedBy$</othername>
<date>$Date$</date>
</sect1info>
<?dbhtml filename="gcc.html" ?>
<title>GCC-&gcc-version;</title>
<sect2>
<title>Introduction to <application><acronym>GCC</acronym></application></title>
<para>The <application><acronym>GCC</acronym></application> package contains
<acronym>GNU</acronym> 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>
<sect3><title>Package Information</title>
<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 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>
</sect3>
<sect3><title>Additional Downloads</title>
<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="http://mirrors.rcn.net/pub/sourceware/gcc/releases/gcc-&gcc-version;/gcc-testsuite-&gcc-version;.tar.bz2"/></para>
</listitem>
</itemizedlist></sect3>
<sect3><title><application><acronym>GCC</acronym></application>
Dependencies</title>
<sect4><title>Recommended</title>
<itemizedlist spacing='compact'>
<listitem><para><xref linkend="dejagnu"/></para></listitem>
</itemizedlist>
</sect4></sect3>
</sect2>
<sect2>
<title>Installation of <application><acronym>GCC</acronym></application></title>
<para>If you plan to compile Ada, you will need to install
<application><acronym>GNAT</acronym></application> temporarily to
satisfy the circular dependency when you recompile
<application><acronym>GCC</acronym></application> to include
<application>Ada</application>.</para>
<sect3><title>Package information</title>
<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 size: &gnat-size;</para></listitem>
<listitem><para>Estimated disk space required:
&gnat-buildsize;</para></listitem>
<listitem><para>Estimated build time:
&gnat-time;</para></listitem></itemizedlist>
</sect3>
<sect3><title><application><acronym>GNAT</acronym></application>
dependencies</title>
<sect4><title>Required</title>
<para><xref linkend="tcsh"/></para></sect4>
</sect3>
</sect2>
<sect2>
<title>Installation of <application><acronym>GNAT</acronym></application>
</title>
<para>Install <application><acronym>GNAT</acronym></application> by running the
following commands:</para>
<screen><userinput><command>./doconfig</command></userinput></screen>
<para>The above script will ask you how and where you would like to install
<application><acronym>GNAT</acronym></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:</para>
<screen><userinput><command>./doinstall</command></userinput></screen>
<para>The <application><acronym>GNAT</acronym></application> compiler can be
invoked by executing the <command>gcc</command> binary installed by the above
script.</para>
<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><command>PATH_HOLD=$PATH &amp;&amp;
export PATH=/opt/gnat/bin:$PATH</command></userinput></screen>
</sect2>
<sect2><title>Return to Installation of
<application><acronym>GCC</acronym></application></title>
<para>Install <application><acronym>GCC</acronym></application> by running the
following commands:</para>
<important><para>The installation process may overwrite your existing
<application><acronym>GCC</acronym></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><acronym>GCC</acronym></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 <acronym>LFS</acronym> (6.0-testing-20041003) system
at <ulink url="http://www.linuxfromscratch.org/~randy/gcc341_test.txt"/>. You
may also want to refer to the information found in the
<application><acronym>GCC</acronym></application>-Pass 2 section of Chapter 5
in the <acronym>LFS</acronym> book.</para></important>
<note><para>Some of the <application>Java</application> programs installed by
the <application><acronym>GCC</acronym></application> package conflict (have
the same names) with programs from the <xref linkend="j2sdk"/> package. If
you're installing the <application>Java</application> language from the
<application><acronym>GCC</acronym></application> package but you wish to
use the programs from the <application>JDK</application> as the defaults,
ensure
<filename class='directory'><replaceable>[JDKpath]</replaceable>/bin</filename>
is listed before <filename class='directory'>/usr/bin</filename> in your
<envar>PATH</envar> variable.</para></note>
<screen><userinput><command>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-languages=c,c++,objc,f77,ada,java \
--enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu &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-3.4.1/contrib/test_summary &amp;&amp;
make install &amp;&amp;
ln -sf ../usr/bin/cpp /lib &amp;&amp;
ln -sf gcc /usr/bin/cc &amp;&amp;
ln -sf g77 /usr/bin/f77 &amp;&amp;
chown -R root:root /usr/lib/gcc/i686-pc-linux-gnu/&gcc-version;/include</command></userinput></screen>
<para>You may remove the <application><acronym>GNAT</acronym></application>
installation and restore your old <envar>PATH</envar>:</para>
<screen><userinput><command>rm -rf /opt/gnat &amp;&amp;
export PATH=$PATH_HOLD</command></userinput></screen>
</sect2>
<sect2>
<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><acronym>GCC</acronym></application> documentation recommends
building the package in a dedicated build directory.</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><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><command>make -C gcc gnatlib-shared</command>: This command builds the
Ada shared and static libraries. Skip this step if you have not enabled
<application>Ada</application> 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
<application>Ada</application> 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-3.4.1/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/&gcc-version;/include</command>:
If the package is built by a user other than root, the ownership of the
installed <filename class='directory'>include</filename> directory (and its
contents) will be incorrect. This command changes the ownership to
root:root.</para>
</sect2>
<sect2>
<title>Contents</title>
<para>The <application><acronym>GCC</acronym></application> package contains
<command>addr2name.awk</command>,
<command>c++</command>,
<command>cpp</command>,
<command>g++</command>,
<command>g77</command>,
<command>gcc</command>,
<command>gccbug</command>,
<command>gcj</command>,
<command>gcjh</command>,
<command>gcov</command>,
<command>gij</command>,
<command>gnat</command>,
<command>gnatbind</command>,
<command>gnatbl</command>,
<command>gnatchop</command>,
<command>gnatclean</command>,
<command>gnatfind</command>,
<command>gnatkr</command>,
<command>gnatlink</command>,
<command>gnatls</command>,
<command>gnatmake</command>,
<command>gnatname</command>,
<command>gnatprep</command>,
<command>gnatxref</command>,
<command>grepjar</command>,
<command>jar</command>,
<command>jcf-dump</command>,
<command>jv-convert</command>,
<command>jv-scan</command>,
<command>rmic</command>,
<command>rmiregistry</command> and
<application><acronym>GCC</acronym></application> libraries.</para>
</sect2>
<sect2><title>Description</title>
<para>The programs and libraries whose descriptions are missing here
have been described in the <acronym>LFS</acronym>
<acronym>GCC</acronym>-&gcc-version; page.</para>
<sect3><title>addr2name.awk</title>
<para><command>addr2name.awk</command> emulates some of the functionality
of addr2line.</para></sect3>
<sect3><title>g77</title>
<para><command>g77</command> is the <application>Fortran</application> compiler
invoked by <command>gcc</command>.</para></sect3>
<sect3><title>gcj</title>
<para><command>gcj</command> is an ahead-of-time compiler for the
<application>Java</application> language.</para></sect3>
<sect3><title>gcjh</title>
<para><command>gcjh</command> generates header files from
<application>Java</application> class files.</para></sect3>
<sect3><title>gij</title>
<para><command>gij</command> is the <acronym>GNU</acronym> interpreter for
<application>Java</application> bytecode.</para></sect3>
<sect3><title>gnat</title>
<para><command>gnat</command> is the <application>Ada</application> compiler
invoked by <command>gcc</command>.</para></sect3>
<sect3><title>gnatbind</title>
<para><command>gnatbind</command> is used to bind compiled
objects.</para></sect3>
<sect3><title>gnatbl</title>
<para><command>gnatbl</command> is the <application>Ada</application>
linker.</para></sect3>
<sect3><title>gnatchop</title>
<para><command>gnatchop</command> is useful for renaming files to meet the
standard <application>Ada</application> default file naming
conventions.</para></sect3>
<sect3><title>gnatclean</title>
<para><command>gnatclean</command> is used to remove files associated with a
<application><acronym>GNAT</acronym></application> project.</para></sect3>
<sect3><title>gnatfind</title>
<para><command>gnatfind</command> is the
<application><acronym>GNAT</acronym></application> definition/use
finder.</para></sect3>
<sect3><title>gnatkr</title>
<para><command>gnatkr</command> is used to determine the crunched name for a
given file, when crunched to a specified maximum length.</para></sect3>
<sect3><title>gnatlink</title>
<para><command>gnatlink</command> is used to link programs and build an
executable file.</para></sect3>
<sect3><title>gnatls</title>
<para><command>gnatls</command> is the compiled unit browser.</para></sect3>
<sect3><title>gnatmake</title>
<para><command>gnatmake</command> is an automatic make facility.</para></sect3>
<sect3><title>gnatname</title>
<para><command>gnatname</command> will list the files associated with a
<application><acronym>GNAT</acronym></application> project.</para></sect3>
<sect3><title>gnatmem</title>
<para><command>gnatmem</command> is the
<application><acronym>GNAT</acronym></application> utility that monitors
dynamic allocation and deallocation activity in a program.</para></sect3>
<sect3><title>gnatprep</title>
<para><command>gnatprep</command> is the
<application><acronym>GNAT</acronym></application> external
preprocessor.</para></sect3>
<sect3><title>gnatxref</title>
<para><command>gnatxref</command> is the
<application><acronym>GNAT</acronym></application>
cross-referencer.</para></sect3>
<sect3><title>grepjar</title>
<para><command>grepjar</command> searches <filename>jar</filename> files for a
pattern.</para></sect3>
<sect3><title>jar</title>
<para><command>jar</command> is an archive tool for
<application>Java</application> archives.</para></sect3>
<sect3><title>jcf-dump</title>
<para><command>jcf-dump</command> prints information about
<application>Java</application> class files.</para></sect3>
<sect3><title>jv-convert</title>
<para><command>jv-convert</command> converts files from one encoding to
another.</para></sect3>
<sect3><title>jv-scan</title>
<para><command>jv-scan</command> prints information about
<application>Java</application> source files.</para></sect3>
<sect3><title>rmic</title>
<para><command>rmic</command> generates stubs for Remote Method
Invocation.</para></sect3>
<sect3><title>rmiregistry</title>
<para><command>rmiregistry</command> starts a remote object registry on the
current host.</para></sect3>
</sect2>
</sect1>