📄 gcc-static.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> 5.6. Cross GCC-4.1.0 - Static </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 5. Constructing Cross-Compile Tools </h3> </div> <ul class="headerlinks"> <li class="prev"> <a accesskey="p" href="binutils.html" title= "Cross Binutils-2.16.1">Prev</a> <p> Cross Binutils-2.16.1 </p> </li> <li class="next"> <a accesskey="n" href="glibc.html" title="Glibc-2.4">Next</a> <p> Glibc-2.4 </p> </li> <li class="up"> <a accesskey="u" href="chapter.html" title= "Chapter 5. Constructing Cross-Compile Tools">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"> 5.6. Cross GCC-4.1.0 - Static </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"> 5.6.1. Installation of Cross GCC Compiler with Static libgcc and no Threads </h2> </div> <p> First make a couple of essential adjustments to the specs file to ensure GCC uses our build environment: </p> <pre class="userinput"><kbd class="command">patch -Np1 -i ../gcc-4.1.0-specs-1.patch</kbd></pre> <p> To make sure that a couple of tools use the proper syntax, apply the following patch: </p> <pre class="userinput"><kbd class="command">patch -Np1 -i ../gcc-4.1.0-posix-1.patch</kbd></pre> <p> The following patch ensures that <span><strong class= "command">gcc</strong></span> does not search the <tt class= "filename">/usr</tt> directory for <tt class= "filename">libgcc_s.so</tt> when cross-compiling: </p> <pre class="userinput"><kbd class="command">patch -Np1 -i ../gcc-4.1.0-cross_search_paths-1.patch</kbd></pre> <p> Now setup the StartFile Spec to the correct library location: </p> <pre class="userinput"><kbd class="command">echo "#undef STARTFILE_PREFIX_SPEC#define STARTFILE_PREFIX_SPEC \"/tools/lib/\"" >> gcc/config/linux.h</kbd></pre> <p> Now alter <span><strong class="command">gcc</strong></span>'s c preprocessors default include search path to use <tt class= "filename">/tools</tt> only: </p> <pre class="userinput"><kbd class="command">cp -v gcc/Makefile.in{,.orig}sed -e "s@\(^CROSS_SYSTEM_HEADER_DIR =\).*@\1 /tools/include@g" \ gcc/Makefile.in.orig > gcc/Makefile.in</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> The above patches and sed's are critical in ensuring a successful overall build. Do not forget to apply them. </p> </div> </div> <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=/cross-tools \ --host=${LFS_HOST} --target=${LFS_TARGET} --disable-multilib \ --with-local-prefix=/tools --disable-nls --disable-shared \ --disable-threads --enable-languages=c</kbd></pre> <div class="variablelist"> <p class="title"> <b>The meaning of the configure options:</b> </p> <dl> <dt> <span class="term"><em class= "parameter"><tt>--with-local-prefix=/tools</tt></em></span> </dt> <dd> <p> The purpose of this switch is to remove <tt class= "filename">/usr/local/include</tt> from <span><strong class= "command">gcc</strong></span>'s include search path. This is not absolutely essential, however, it helps to minimize the influence of the host system. </p> </dd> <dt> <span class="term"><em class= "parameter"><tt>--disable-shared</tt></em></span> </dt> <dd> <p> Disables the creation of the shared libraries. </p> </dd> <dt> <span class="term"><em class= "parameter"><tt>--disable-threads</tt></em></span> </dt> <dd> <p> This will prevent GCC from finding the multi-thread include files, since they haven't been created for this architecture yet. GCC will be able to find the multi-thread information after the Glibc headers are created. </p> </dd> <dt> <span class="term"><em class= "parameter"><tt>--enable-languages=c</tt></em></span> </dt> <dd> <p> This option ensures that only the C compiler is built. </p> </dd> </dl> </div> <p> Continue with compiling the package: </p> <pre class="userinput"><kbd class="command">make all-gcc</kbd></pre> <p> Install the package: </p> <pre class="userinput"><kbd class="command">make install-gcc</kbd></pre> </div> <div class="content" lang="en" xml:lang="en"> <p> Details on this package are located in <a href= "../final-system/gcc.html#contents-gcc" title= "10.9.2. Contents of GCC">Section 10.9.2, “Contents of GCC.”</a> </p> </div> </div> <div class="navfooter"> <ul> <li class="prev"> <a accesskey="p" href="binutils.html" title= "Cross Binutils-2.16.1">Prev</a> <p> Cross Binutils-2.16.1 </p> </li> <li class="next"> <a accesskey="n" href="glibc.html" title="Glibc-2.4">Next</a> <p> Glibc-2.4 </p> </li> <li class="up"> <a accesskey="u" href="chapter.html" title= "Chapter 5. Constructing Cross-Compile Tools">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 + -