📄 gcc.html
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content= "application/xhtml+xml; charset=iso-8859-1" /> <title> 10.9. GCC-4.1.0 </title> <link rel="stylesheet" href="../stylesheets/lfs.css" type="text/css" /> <meta name="generator" content="DocBook XSL Stylesheets V1.69.1" /> <link rel="stylesheet" href="../stylesheets/lfs-print.css" type= "text/css" media="print" /> </head> <body id="lfs" class="CLFS-SVN-20060417-MIPS"> <div class="navheader"> <div class="headertitles"> <h4> Cross-Compiled Linux From Scratch - Version CLFS-SVN-20060417-MIPS </h4> <h3> Chapter 10. Installing Basic System Software </h3> </div> <ul class="headerlinks"> <li class="prev"> <a accesskey="p" href="binutils.html" title= "Binutils-2.16.1">Prev</a> <p> Binutils-2.16.1 </p> </li> <li class="next"> <a accesskey="n" href="coreutils.html" title= "Coreutils-5.94">Next</a> <p> Coreutils-5.94 </p> </li> <li class="up"> <a accesskey="u" href="chapter.html" title= "Chapter 10. Installing Basic System Software">Up</a>. </li> <li class="home"> <a accesskey="h" href="../index.html" title= "Cross-Compiled Linux From Scratch - Version CLFS-SVN-20060417-MIPS"> Home</a> </li> </ul> </div> <div class="wrap" lang="en" xml:lang="en"> <div class="titlepage"> <h1 class="sect1"> 10.9. GCC-4.1.0 </h1> </div> <div class="package" lang="en" xml:lang="en"> <p> The GCC package contains the GNU compiler collection, which includes the C and C++ compilers. </p> <div class="segmentedlist"> <div class="seglistitem"> <div class="seg"> <strong><span class="segtitle">Installation depends on:</span></strong> <span class="seg">Bash, Binutils, Coreutils, DejaGNU, Diffutils, Expect, Findutils, Gawk, Gettext, Glibc, Grep, Make, Patch, Perl, Sed, Tcl, and Texinfo</span> </div> </div> </div> </div> <div class="installation" lang="en" xml:lang="en"> <div class="titlepage"> <h2 class="sect2"> 10.9.1. Installation of GCC </h2> </div> <p> The following patch fixes an issue where gcc doesn't generate some code properly. </p> <pre class="userinput"><kbd class="command">patch -Np1 -i ../gcc-4.1.0-fold_const_fix-1.patch</kbd></pre> <p> Apply a <span><strong class="command">sed</strong></span> substitution that will suppress the installation of <tt class= "filename">libiberty.a</tt>. The version of <tt class= "filename">libiberty.a</tt> provided by Binutils will be used instead: </p> <pre class="userinput"><kbd class="command">sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in</kbd></pre> <p> GCC provides a <span><strong class="command">gccbug</strong></span> script which detects at compile time whether mktemp is present, and hardcodes the result in a test. This will cause the script to fall back to using less random names for temporary files. We will be installing mktemp later, so the following sed will simulate its presence. </p> <pre class="userinput"><kbd class="command">sed -i 's/@have_mktemp_command@/yes/' gcc/gccbug.in</kbd></pre> <p> The GCC documentation recommends building GCC outside of the source directory in a dedicated build directory: </p> <pre class="userinput"><kbd class="command">mkdir -v ../gcc-buildcd ../gcc-build</kbd></pre> <p> Prepare GCC for compilation: </p> <pre class="userinput"><kbd class="command">../gcc-4.1.0/configure --prefix=/usr \ --libexecdir=/usr/lib --enable-shared --enable-threads=posix \ --enable-__cxa_atexit --enable-c99 --enable-long-long \ --enable-clocale=gnu --enable-languages=c,c++ \ --disable-multilib --disable-libstdcxx-pch</kbd></pre> <p> Compile the package: </p> <pre class="userinput"><kbd class="command">make bootstrap</kbd></pre> <div class="important"> <div class="admonhead"> <img alt="[Important]" src="../images/important.png" /> <h3 class="admontitle"> Important </h3> </div> <div class="admonbody"> <p> In this section, the test suite for GCC is considered critical. Do not skip it under any circumstance. </p> </div> </div> <p> Test the results, but do not stop at errors: </p> <pre class="userinput"><kbd class="command">make -k check</kbd></pre> <p> The <em class="parameter"><tt>-k</tt></em> flag is used to make the test suite run through to completion and not stop at the first failure. The GCC test suite is very comprehensive and is almost guaranteed to generate a few failures. To receive a summary of the test suite results, run: </p> <pre class="userinput"><kbd class="command">../gcc-4.1.0/contrib/test_summary</kbd></pre> <p> For only the summaries, pipe the output through <strong class= "userinput"><tt>grep -A7 Summ</tt></strong>. </p> <p> A few unexpected failures cannot always be avoided. The GCC developers are usually aware of these issues, but have not resolved them yet. </p> <p> Install the package: </p> <pre class="userinput"><kbd class="command">make install</kbd></pre> <p> Some packages expect the C preprocessor to be installed in the <tt class="filename">/lib</tt> directory. To support those packages, create this symlink: </p> <pre class="userinput"><kbd class="command">ln -sv ../usr/bin/cpp /lib</kbd></pre> <p> Many packages use the name <span><strong class= "command">cc</strong></span> to call the C compiler. To satisfy those packages, create a symlink: </p> <pre class="userinput"><kbd class="command">ln -sv gcc /usr/bin/cc</kbd></pre> </div> <div class="content" lang="en" xml:lang="en"> <div class="titlepage"> <a id="contents-gcc" name="contents-gcc"></a> <h2 class="sect2"> 10.9.2. Contents of GCC </h2> </div> <div class="segmentedlist"> <div class="seglistitem"> <div class="seg"> <strong><span class="segtitle">Installed programs:</span></strong> <span class="seg">c++, cc (link to gcc), cpp, g++, gcc, gccbug, and gcov</span> </div> <div class="seg"> <strong><span class="segtitle">Installed libraries:</span></strong> <span class="seg">libgcc.a, libgcc_eh.a, libgcc_s.so, libmudflap.[a,so], libmudflapth.[a,so], libstdc++.[a,so], and libsupc++.a</span> </div> </div> </div> <div class="variablelist"> <h3> <a id="id3665455" name="id3665455"></a>Short Descriptions </h3> <table border="0"> <col align="left" valign="top" /> <tbody> <tr> <td> <a id="cc" name="cc"></a><span class= "term"><span><strong class= "command">cc</strong></span></span> </td> <td> <p> The C compiler </p> </td> </tr> <tr> <td> <a id="cpp" name="cpp"></a><span class= "term"><span><strong class= "command">cpp</strong></span></span> </td> <td> <p> The C preprocessor; it is used by the compiler to expand the #include, #define, and similar statements in the source files </p> </td> </tr> <tr> <td> <a id="c" name="c"></a><span class= "term"><span><strong class= "command">c++</strong></span></span> </td> <td> <p> The C++ compiler </p> </td> </tr> <tr> <td> <a id="g" name="g"></a><span class= "term"><span><strong class= "command">g++</strong></span></span> </td> <td> <p> The C++ compiler </p> </td> </tr> <tr> <td> <a id="gcc" name="gcc"></a><span class= "term"><span><strong class= "command">gcc</strong></span></span> </td> <td> <p> The C compiler </p> </td> </tr> <tr> <td> <a id="gccbug" name="gccbug"></a><span class= "term"><span><strong class= "command">gccbug</strong></span></span> </td> <td> <p> A shell script used to help create useful bug reports </p> </td> </tr> <tr> <td> <a id="gcov" name="gcov"></a><span class= "term"><span><strong class= "command">gcov</strong></span></span> </td> <td> <p> A coverage testing tool; it is used to analyze programs to determine where optimizations will have the most effect </p> </td> </tr> <tr> <td> <a id="libgcc" name="libgcc"></a><span class= "term"><tt class="filename">libgcc</tt></span> </td> <td> <p> Contains run-time support for <span><strong class= "command">gcc</strong></span> </p> </td> </tr> <tr> <td> <a id="libmudflap" name="libmudflap"></a><span class= "term"><tt class="filename">libmudflap</tt></span> </td> <td> <p> The libmudflap libraries are used by GCC for instrumenting pointer and array dereferencing operations. </p> </td> </tr> <tr> <td> <a id="libstdc" name="libstdc"></a><span class= "term"><tt class="filename">libstdc++</tt></span> </td> <td> <p> The standard C++ library </p> </td> </tr> <tr> <td> <a id="libsupc" name="libsupc"></a><span class= "term"><tt class="filename">libsupc++</tt></span> </td> <td> <p> Provides supporting routines for the C++ programming language </p> </td> </tr> </tbody> </table> </div> </div> </div> <div class="navfooter"> <ul> <li class="prev"> <a accesskey="p" href="binutils.html" title= "Binutils-2.16.1">Prev</a> <p> Binutils-2.16.1 </p> </li> <li class="next"> <a accesskey="n" href="coreutils.html" title= "Coreutils-5.94">Next</a> <p> Coreutils-5.94 </p> </li> <li class="up"> <a accesskey="u" href="chapter.html" title= "Chapter 10. Installing Basic System Software">Up</a>. </li> <li class="home"> <a accesskey="h" href="../index.html" title= "Cross-Compiled Linux From Scratch - Version CLFS-SVN-20060417-MIPS"> Home</a>. </li> </ul> </div> </body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -