📄 glibc.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.7. Glibc-2.4 </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="gcc-static.html" title= "Cross GCC-4.1.0 - Static">Prev</a> <p> Cross GCC-4.1.0 - Static </p> </li> <li class="next"> <a accesskey="n" href="gcc-final.html" title= "GCC-4.1.0 - Cross Compiler Final">Next</a> <p> GCC-4.1.0 - Cross Compiler Final </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.7. Glibc-2.4 </h1> </div> <div class="package" lang="en" xml:lang="en"> <p> The Glibc package contains the main C library. This library provides the basic routines for allocating memory, searching directories, opening and closing files, reading and writing files, string handling, pattern matching, arithmetic, and so on. </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, Diffutils, Gawk, GCC, Gettext, Grep, Make, Patch, Perl, Sed, and Texinfo</span> </div> </div> </div> </div> <div class="installation" lang="en" xml:lang="en"> <div class="titlepage"> <h2 class="sect2"> 5.7.1. Installation of Glibc </h2> </div> <p> It should be noted that compiling Glibc in any way other than the method suggested in this book puts the stability of the system at risk. </p> <p> MIPS is no longer supported in the main glibc tree, so we have to extract the glibc-ports-2.4 into our glibc-2.4 directory. Then we move ports to the location expected by our build and patches. </p> <pre class="userinput"><kbd class="command">tar -jxvf glibc-ports-2.4.tar.bz2mv -v glibc-ports-2.4 ports</kbd></pre> <p> The following patch fixes a link issues when building MIPS glibc: </p> <pre class="userinput"><kbd class="command">patch -Np1 -i ../glibc-2.4-mips_fixes-1.patch</kbd></pre> <p> Disable linking to <tt class="filename">libgcc_eh</tt>: </p> <pre class="userinput"><kbd class="command">patch -Np1 -i ../glibc-2.4-libgcc_eh-1.patch</kbd></pre> <p> The following patch removes the potential of localdef segfaulting: </p> <pre class="userinput"><kbd class="command">patch -Np1 -i ../glibc-2.4-localedef_segfault-1.patch</kbd></pre> <p> The following sed fixes a build issue with Glibc. This will prevent nscd from trying to link to libraries that don't exist: </p> <pre class="userinput"><kbd class="command">cp nscd/Makefile{,.orig}sed -e "/nscd_stat.o: sysincludes = # nothing/d" nscd/Makefile.orig > \nscd/Makefile</kbd></pre> <p> The Glibc documentation recommends building Glibc outside of the source directory in a dedicated build directory: </p> <pre class="userinput"><kbd class="command">mkdir -v ../glibc-buildcd ../glibc-build</kbd></pre> <p> For NPTL enabled systems the following lines need to be added to <tt class="filename">config.cache</tt>: </p> <pre class="userinput"><kbd class="command">echo "libc_cv_forced_unwind=yes" > config.cacheecho "libc_cv_c_cleanup=yes" >> config.cache</kbd></pre> <p> Prepare Glibc for compilation: </p> <pre class="userinput"><kbd class="command">BUILD_CC="gcc" CC="${LFS_TARGET}-gcc" \ AR="${LFS_TARGET}-ar" RANLIB="${LFS_TARGET}-ranlib" \ ../glibc-2.4/configure --prefix=/tools \ --host=${LFS_TARGET} --build=${LFS_HOST} \ --disable-profile --enable-add-ons \ --with-tls --enable-kernel=2.6.0 --with-__thread \ --with-binutils=/cross-tools/bin --with-headers=/tools/include \ --cache-file=config.cache</kbd></pre> <div class="variablelist"> <p class="title"> <b>The meaning of the new configure options:</b> </p> <dl> <dt> <span class="term"><em class= "parameter"><tt>BUILD_CC="gcc"</tt></em></span> </dt> <dd> <p> This sets Glibc to use the current compiler on our system. This is used to create the tools Glibc uses during its build. </p> </dd> <dt> <span class="term"><em class= "parameter"><tt>CC="${LFS_TARGET}-gcc"</tt></em></span> </dt> <dd> <p> This forces Glibc to use the GCC compiler that we made for our target architecture. </p> </dd> <dt> <span class="term"><em class= "parameter"><tt>AR="${LFS_TARGET}-ar"</tt></em></span> </dt> <dd> <p> This forces Glibc to use the <span><strong class= "command">ar</strong></span> utility we made for our target architecture. </p> </dd> <dt> <span class="term"><em class= "parameter"><tt>RANLIB="${LFS_TARGET}-ranlib"</tt></em></span> </dt> <dd> <p> This forces Glibc to use the <span><strong class= "command">ranlib</strong></span> utility we made for our target architecture. </p> </dd> <dt> <span class="term"><em class= "parameter"><tt>--disable-profile</tt></em></span> </dt> <dd> <p> This builds the libraries without profiling information. Omit this option if profiling on the temporary tools is necessary. </p> </dd> <dt> <span class="term"><em class= "parameter"><tt>--enable-add-ons</tt></em></span> </dt> <dd> <p> This tells Glibc to utilize all add-ons that are available. </p> </dd> <dt> <span class="term"><em class= "parameter"><tt>--with-tls</tt></em></span> </dt> <dd> <p> This tells Glibc to use Thread Local Storage. </p> </dd> <dt> <span class="term"><em class= "parameter"><tt>--with-__thread</tt></em></span> </dt> <dd> <p> This tells Glibc to use use the __thread for libc and libpthread builds. </p> </dd> <dt> <span class="term"><em class= "parameter"><tt>--with-binutils=/cross-tools/bin</tt></em></span> </dt> <dd> <p> This tells Glibc to use the Binutils that are specific to our target architecture. </p> </dd> <dt> <span class="term"><em class= "parameter"><tt>--cache-file=config.cache</tt></em></span> </dt> <dd> <p> This tells Glibc to utilize a premade cache file. </p> </dd> </dl> </div> <p> During this stage the following warning might appear: </p> <div class="blockquote"> <blockquote class="blockquote"> <pre class="screen"><tt class="computeroutput">configure: WARNING:*** These auxiliary programs are missing or*** incompatible versions: msgfmt*** some features will be disabled.*** Check the INSTALL file for required versions.</tt></pre> </blockquote> </div> <p> The missing or incompatible <span><strong class= "command">msgfmt</strong></span> program is generally harmless. This <span><strong class="command">msgfmt</strong></span> program is part of the Gettext package which the host distribution should provide. </p> <p> Compile the package: </p> <pre class="userinput"><kbd class="command">make</kbd></pre> <p> Install the package: </p> <pre class="userinput"><kbd class="command">make install</kbd></pre> </div> <div class="content" lang="en" xml:lang="en"> <p> Details on this package are located in <a href= "../final-system/glibc.html#contents-glibc" title= "10.6.5. Contents of Glibc">Section 10.6.5, “Contents of Glibc.”</a> </p> </div> </div> <div class="navfooter"> <ul> <li class="prev"> <a accesskey="p" href="gcc-static.html" title= "Cross GCC-4.1.0 - Static">Prev</a> <p> Cross GCC-4.1.0 - Static </p> </li> <li class="next"> <a accesskey="n" href="gcc-final.html" title= "GCC-4.1.0 - Cross Compiler Final">Next</a> <p> GCC-4.1.0 - Cross Compiler Final </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 + -