\documentclass[letterpaper]{article}
\nonstopmode
\akai
\usepackage{linuxdoc-sgml}
\usepackage{qwertz}
\usepackage{url}
\usepackage[latin1]{inputenc}
\usepackage{t1enc}
\usepackage[english]{babel}
\usepackage{epsfig}
\usepackage{null}
\def\addbibtoc{
\addcontentsline{toc}{section}{\numberline{\mbox{}}\relax\bibname}
}%end-preamble
\setcounter{page}{1}
\title{Glibc 2 HOWTO ¤¤¤åª©}
\author{­ì§@ Eric Green, {\ttfamily ejg3@cornell.edu}\\ 
Ä¶ªÌ Allex Juang, {\ttfamily allex@ms2.accmail.com}}
\date{1.5 ª©, 1998¦~ 2¤ë 8¤é}
\abstract{³o¥÷ glibc 2 HOWTO ¤º®e¥]¬A¦b Linux ¨t²Î¤W¦w¸Ë»P¨Ï¥Î²Ä¤Gª© GNU C Library¡C}


\begin{document}
\maketitle
\tableofcontents

\section{Â²¤¶}






\subsection{Ãö©ó glibc 2}



Glibc 2 ¬O³Ì·sª©ªº GNU C ¨ç¦¡®w¡C
¥¦¥Ø«e¤£»Ý­×§ï´N¥i¥H¦b GNU Hurd¡ALinux i386¡A m68k¡A ¥H¤Î alpha ¨t²Î¤W°õ¦æ¡A
¦Ó 2.1 ª©¤¤±N¥[¤J¹ï Linux PowerPC¡A MIPS¡A Sparc¡A Sparc 64 »P Arm
µ¥¨t²Îªº¤ä´©¡C¥¼¨Ó±N¥[¤J¹ï¨ä¥¦¬[ºc¤Î§@·~¨t²Îªº¤ä´©¡C

¦b Linux ¤W¡Aglibc 2 ¬O¥D­nª©¥»¬° 6 ªº libc¡A¤]´N¬O Linux libc 5 ªº«áÄ~ªÌ¡C
Linux libc ªºµo®i¤H­û·Q¥H¦¹³vº¥¨ú¥N libc 5¡C
´N 2.0.6 ¨Ó¬Ý¡Aglibc ¤w¨ã¦³¦¨¼ô²£«~ªº«~½è¡C
Glibc 2.1 ª© (¦b¤£¤[ªº±N¨Ó) ±N¥[¤J§ó¦hªº¥\¯à¡A
¨Ã²¾´Ó¨ì§ó¦h¨t²Î¤W¡A¨¬°÷·í§@¥D¬y¨Ï¥Î¡C

Glibc 2 ¦³¤T­Ó¿ï¾Ü©Êªºªþ¥[®M¥ó¡G
\begin{description}
\item[Crypt] \mbox{}

UFC-crypt ¥[±K®M¥ó¡C ¥Ñ©ó¥X¤f­­¨î©Ò¥H­n¤ÀÂ÷¥X¨Ó¡C

\item[LinuxThreads] \mbox{}

Posix 1003.1c {\tt\char`\"}pthread{\tt\char`\"} ¤¶­±ªº¹ê§@¡C

\item[Locale data] \mbox{}

¥]§t»s³y¨Ï¥Î glibc ªº internationalization ¥\¯à©Ò»Ý locale
¸ê®ÆÀÉ®×ªº¸ê®Æ¡C

\end{description}


±j¯P«ØÄ³¦w¸Ë Cryt »P LinuxThreads ³o¨â­Óªþ¥[®M¥ó¡A
¦pªG¤£¦w¸Ëªº¸Ü¡A¦³¥i¯à·|»P¨ä¥¦¨t²Î¤Wªº¨ç¦¡®w³y¦¨¤£¬Û®eªº±¡§Î¡C
(°²¦p§A¤£·Q¨Ï¥Î³o¨â­Óªþ¥[®M¥óªº¸Ü¡A
¨º§A¥²¶·¦b°õ¦æ configure ®É¥[¤W --disable-sanity-checks ªº¿ï¶µ)




\subsection{Ãö©ó³o¥÷¤å¥ó}



³o¥÷¤å¥ó²[»\¦p¦ó¦b Linux ¨t²Î¤W¦w¸Ë glib 2¡A
¾A¥Î¹ï¶H¬O¨º¨Ç¦b intel-based ¾÷¾¹¤W¨Ï¥Î libc 5 ªº¨Ï¥ÎªÌ¡C
¦ý¬O¹ï©ó¨ä¥¦¨t²Î¥H¤Î¨ä¥¦¤£¦P¨ç¦¡®w (¦p glibc 1) ªº¨Ï¥ÎªÌ¡A
¥u­n±N³o¥÷¤å¥ó¤¤¥X²{ªºÀÉ¦W¥H¤Î¨t²Î¬[ºc¦WºÙ§@¾A·íªº¥N´«¡A
À³¸Ó¤]¥i±o¨ì¨ÇÀ°§U¡C

³o¥÷ HOWTO ªº³Ì·sª©¥»ªº«þ¨©¥i¦b
\nameurl{http://sunsite.unc.edu/LDP}{Linux Documentation Project}
©Î¬O
\nameurl{http://www.imaxx.net/~thrytis/glibc/Glibc2-HOWTO.html}{}
§ä¨ì¡C




\subsection{³o¥÷¤å¥óªº³Ì·s§ïÅÜ}



1.5 »P 1.4 ª©ªº®t§O¡G
\begin{itemize}
\item ¥Ñ Ed Bailey ¥[¤J¯Á¤Þ
\item §Úªº·s¹q¤l¶l¥ó«H½c¦ì§}
\end{itemize}


1.4 »P 1.3 ª©ªº®t§O¡G
\begin{itemize}
\item ±N¥Ø«eª¬ºA¥Ñ¹êÅç©Ê§ï¦¨¦¨¼ô²£«~¡C
\item §ó·sµo®i¤¤ªº²¾´Ó¦Cªí¡C
\item §ó·s³Ì·sª©¨ì 2.0.6¡C
\end{itemize}





\section{¿ï¾Ü§Aªº¦w¸Ë¤è¦¡}



¦³³\¦hºØ¤è¦¡¦w¸Ë glibc¡A§A¥i¥H¦w¸Ë¦¨¤@­Ó´ú¸Õ¥Îªº¨ç¦¡®w¡A
±N¥Ø«e¨Ï¥Îªº¨ç¦¡®w·í§@¬O¤º©wªº¡A
µM«á¦b½sÄ¶µ{¦¡ªº®É­Ô¥Î¤£¦Pªº¿ï¶µ¨Ó¸Õ¥Î·sªº¨ç¦¡®w¡C
¥Î³oºØ¦w¸Ë¤è¦¡¥H«á¥i¥H»´©öªº²¾°£ glibc¡C
(ÁöµM¥Î glibc ³sµ²ªºµ{¦¡¦b²¾°£ glibc «á³£±N¤£¯à¨Ï¥Î)
¥t¥~¡A¥Î³oºØ¤è¦¡¦w¸Ë¡A§A¥²¶·¥Ñ­ì©l½X­«·s½sÄ¶¡A
¨Ã¨S¦³ binary distribution ¥i¥H¦w¸Ë¦¨´ú¸Õªº¨ç¦¡®w¡C
³o¼Ëªº¦w¸Ë½Ð°Ñ·Ó\ref{test-install} {(¦w¸Ë¦¨´ú¸Õ¥Îªº¨ç¦¡®w)}¡C

³o¥÷¤å¥ó¤¤©Ò»¡ªº¥t¤@ºØ¤è¦¡«h¬O±N glibc ¦w¸Ë¦¨¥D­n¨ç¦¡®w¡C
©Ò¦³·s½sÄ¶ªºµ{¦¡³£±N·|¨Ï¥Î glibc¡A
¦ý¬O§A¤]¥i¥H¦b½sÄ¶®É¥Î¤£¦Pªº¿ï¶µ¦Ó±Nµ{¦¡³sµ²¨ìÂÂªº¨ç¦¡®w¡C
§A¥i¥Hª½±µ¦w¸Ë¤w¸g½sÄ¶¦nªºª©¥»¡A¤]¥i¥H¦Û¤v½sÄ¶¨ç¦¡®w¡C
°²¦p·Q§ó§ï³Ì¨Î¤Æ©Î¬O²ÕºA¿ï¶µ¡A
©Î¬O·Q¥[¤J¤w½sÄ¶¦nªºª©¥»¤¤¥¼¤ä´©ªº add-on ªº¸Ü¡A
¨º§A¥²»Ý¨ú±o­ì©l½X¨Ã¥B¦Û¤v½sÄ¶¡A³o­Ó¦w¸Ëªº¹Lµ{½Ð°Ñ·Ó
\ref{primary-install} {(¦w¸Ë¦¨¥D­nªº C ¨ç¦¡®w)}

Frodo Looijaard ´y­z¤F¥t¤@ºØ glibc ªº¦w¸Ë¤è¦¡¡C
¥Lªº¤èªk¬O±N glibc ¦w¸Ë¦¨¦¸­nªº¨ç¦¡®w¡A
µM«á³]©w¥æ¤e½sÄ¶¾¹ (cross compiler) ¨Ó¨Ï¥Î glibc¡C
³o­Ó¤è¦¡¤ñ°_³o¥÷¤å¥ó¤¤ªº´ú¸Õ¦w¸Ë­n½ÆÂøªº¦h¡A¦ý¬O¤ñ¸û®e©ö³sµ²¨ì glibc¡C
³o­Ó¤èªk¦b¥Lªº
\nameurl{http://huizen.dds.nl/~frodol/glibc/}{Installing glibc-2 on Linux}
¤å¥ó¤¤»¡©ú¡C

°²¦p§A²{¦b¨Ï¥Îªº¬O Debian 1.3¡A
¦ý¬O¤£·Q¬°¤F glibc ¦Ó¤É¯Å¨ì¤£Ã­©wªºª©¥»¡A
¨º»ò
\nameurl{http://www.gate.net/~storm/FAQ/libc5-libc6-Mini-HOWTO.html}{Debian libc5 to libc6 Mini-HOWTO}
·|§i¶D§A¦p¦ó¨Ï¥Î Debian ªº package ¨Ó¤É¯Å¡C

°²¦p§A­n§â glibc 2 ¦w¸Ë¨ì¤@­«­nªº¨t²Î¤W¡A
¨º¤]³\§AÀ³¨Ï¥Î´ú¸Õªº¦w¸Ë¡A©Î¬O¦b³Æ¥Î¨t²Î¤W¸Õ¸Õ¬Ý¡C
§Y¨Ï¨S¦³¯äÂÎ¡A¬Y¨Çµ{¦¡¦b½sÄ¶¤§«e¤´µM»Ý­n¬Y¨Ç­×§ï¡A
­ì¦]¦b©ó¬Y¨Ç¨ç¦¡­ì«¬»P«¬ºA¤Wªº§ïÅÜ¡C




\section{¨ú±o¨ç¦¡®w\label{getting}}



Glibc 2 ¥]§t glibc package ¥H¤Î¼Æ­Óªþ¥[®M¥ó¡G
LinuxThreads¡B Locale »P Crypt¡A ­ì©l½X¦b
\begin{itemize}
\item \nameurl{ftp://prep.ai.mit.edu/pub/gnu/glibc-2.0.6.tar.gz}{}
\item \nameurl{ftp://prep.ai.mit.edu/pub/gnu/glibc-linuxthreads-2.0.6.tar.gz}{}
\item \nameurl{ftp://prep.ai.mit.edu/pub/gnu/glibc-localedata-2.0.6.tar.gz}{}
\item \nameurl{ftp://prep.ai.mit.edu/pub/gnu/glibc-crypt-2.0.6.tar.gz}{}
\end{itemize}


§A»Ý­n¤j¬ù 150MB ªººÏºÐªÅ¶¡¨Ó§@§¹¥þªº½sÄ¶»P¦w¸Ë¡A
®Ö¤ß¨ç¦¡®wªº°ò¥»¦w¸Ë¤j¬ù­n 50MB¡C

2.0.6 ¨Ã¨S¦³ binary ªº package¡A
2.0.4 ªº binary package ¥u¦³ i386 ¤Î m68k ªºª©¥»¡A
¦Ó 2.0.1 for alpha «h¥i¥H¦b¥H¤U¦a¤è§ä¨ì¡G
\begin{itemize}
\item Intel x86:
\begin{itemize}
\item \nameurl{ftp://prep.ai.mit.edu/pub/gnu/glibc-2.0.4.bin.i386.tar.gz}{}
\item \nameurl{ftp://prep.ai.mit.edu/pub/gnu/glibc-crypt-2.0.4.bin.i386.tar.gz}{}
\end{itemize}

\item Alpha:
\begin{itemize}
\item \nameurl{ftp://prep.ai.mit.edu/pub/gnu/glibc-2.0.1.bin.alpha-linux.tar.gz}{}
\item \nameurl{ftp://prep.ai.mit.edu/pub/gnu/glibc-crypt-2.0.1.bin.alpha-linux.tar.gz}{}
\end{itemize}

\item m68k:
\begin{itemize}
\item \nameurl{ftp://prep.ai.mit.edu/pub/gnu/glibc-2.0.4-m68k-linux.bin.tar.gz}{}
\item \nameurl{ftp://prep.ai.mit.edu/pub/gnu/glibc-crypt-2.0.4-m68k-linux.bin.tar.gz}{}
\end{itemize}
\end{itemize}


¥Ñ©ó cypt ³o­Óªþ¥[®M¥ó¦³¥X¤f­­¨î¡A«D¬ü°ê¨Ï¥ÎªÌ½Ð¨ì
\nameurl{ftp://ftp.ifi.uio.no/pub/gnu}{}
¨ú±o¡C

¦pªG§A¥Îªº¬O RedHat distribution¡A
¨º§A¥i¥H±q
\nameurl{ftp://ftp.redhat.com/pub/redhat/}{}
¨ú±o glibc2 ªº rpm¡C
¦b RedHat distribution 5.0 ¤¤¡A glibc 2 ¬O¥D­nªº C ¨ç¦¡®w¡C

¦pªG§A¥Îªº¬O Debian distribution¡A¨º§A¥i¥H±q
\nameurl{ftp://ftp.debian.org/debian/dists/unstable/main/}{}
¨ú±o glibc2 ªº package¡CÀÉ¦W¬O libc6¡C
Glibc 2 ¥Ø«e¬O Debian ´ú¸Õª©ªº°ò¥» package¡A
µ¥¨ì Debian 2.0 ¥X¨Ó¤§«á±N·|¬O¥D­nªº C ¨ç¦¡®w¡C




\section{¦w¸Ë¦¨´ú¸Õ¥Îªº¨ç¦¡®w\label{test-install}}



³o¤@¸`ªº¤º®e¬OÃö©ó¦p¦ó±N glibc 2 ¦w¸Ë¦¨´ú¸Õ¥Îªº¨ç¦¡®w¡C
©Ò¦³½sÄ¶ªºµ{¦¡³£³sµ²¨ì§A¥Ø«eªº¨ç¦¡®w¡A
°£«D§Aµ¹¤F¬Y¨ÇÃB¥~ªº°Ñ¼Æ¤~·|³sµ²¨ì·sªº¨ç¦¡®w¡C
¥Ñ©ó¸ô®|³Q½sÄ¶¨ì¬Y¨ÇÀÉ®×¤¤¡A§A»Ý­n¥Ñ­ì©l½X¨Ó¦w¸Ë³o¨ç¦¡®w¡C




\subsection{½sÄ¶»P¦w¸Ë}






\subsubsection{»Ý¨D}



\begin{itemize}
\item ¬ù 150 MB ªººÏºÐªÅ¶¡
\item GNU make 3.75
\item gcc $>$= 2.7.2 (³Ì¦n¬O 2.7.2.1)
\item binutils 2.8.1 (°²¦p¬O alpha §AÁÙ»Ý­n snapshot)
\item bash 2.0
\item autoconf 2.12 (°²¦p§A§ó°Ê¤F configure.in)
\item texinfo 3.11
\end{itemize}


¦b¤@¥x¦w¸Ë¦³ 64MB °O¾ÐÅé i586@133 ªº¾÷¾¹¤W¡A
½sÄ¶§¹¾ãªº¨ç¦¡®w (¥]¬Aªþ¥[®M¥ó) ¤j¬ù¶·­n 3 ¤p®É¡C
¦Ó¦b i686@200 «h¶·¬ù¤@­Ó¥b¤p®É¡C




\subsubsection{¸Ñ¶}­ì©l½X}



§A¥²»Ý¥Ñ archive ¤¤¨ú¥X­ì©l½X¡C¦p¦¹¤~¯à½sÄ¶¥¦¡A³Ì¦nªº¤è¦¡¦p¤U¡G
\begin{tscreen}
\begin{verbatim}
 tar xzf glibc-2.0.6.tar.gz
 cd glibc-2.0.6
 tar xzf ../glibc-linuxthreads-2.0.6.tar.gz
 tar xzf ../glibc-crypt-2.0.6.tar.gz
 tar xzf ../glibc-localedata-2.0.6.tar.gz
 
\end{verbatim}
\end{tscreen}

³o·|±N linuxthreads¡B crypt »P localedata µ¥¥Ø¿ý©ñ¦Ü glibc-2.0.6 ªº¥Ø¿ý©³¤U¡A
¦p¦¹ configure ¤~¥i¥H§ä¨ì³o¨Ç add-ons¡C




\subsubsection{³]©w²ÕºA}



¦b glibc-2.0.6 ªº¥Ø¿ý©³¤U¡A«Ø¥ß¤@­Ó·sªº¥Ø¿ý compile¡A¨Ã¥B cd ¨ì compile ©³¤U¡A
©Ò¦³ªº¤u§@³£·|¦b³o­Ó¥Ø¿ý¤¤§¹¦¨¡A³o·|Â²¤Æ«áÄòªº²M°£¤u§@¡C
(µo®iªÌ¦ü¥G¨Ã¥¼Åý 'make clean' §@±o«Ü¦n)
\begin{tscreen}
\begin{verbatim}
 mkdir compile
 cd compile
 
\end{verbatim}
\end{tscreen}

°õ¦æ {\ttfamily ../configure}¡C
­n¨Ï¥Î¤÷¥[®M¥ó¡A§A¥²»Ý¥Î --enable-add-ons «ü©w¡A
¨Ò¦p»¡ --enable-add-ons=linuxthreads,crypt,localedata¡C

§A¤]¥²»Ý«ü©w­n¦w¸Ëªº¥Ø¿ý¡A/usr/i486-linuxglibc2 ¬O­Ó¤£¿ùªº¿ï¾Ü¡A
³o¼Ëªº configure ©R¥O¦p¤U¡G
\begin{tscreen}
\begin{verbatim}
 ../configure --enable-add-ons=linuxthreads,crypt,localedata --prefix=/usr/i486-linuxglibc2
 
\end{verbatim}
\end{tscreen}





\subsubsection{½sÄ¶»P¦w¸Ë}



­n½sÄ¶»PÅçÃÒ¡A°õ¦æ
\begin{tscreen}
\begin{verbatim}
 make
 make check
 
\end{verbatim}
\end{tscreen}

°²¦p 'make check' ¦¨¥\¤F¡A¦w¸Ë¨ç¦¡®w¡G
\begin{tscreen}
\begin{verbatim}
 make install
 
\end{verbatim}
\end{tscreen}





\subsection{§ó·s dynamic loader}



\begin{enumerate}
\item «Ø¥ß³sµ²¡A
±q {\ttfamily ld.so} ¨ì {\ttfamily /lib/ld-linux.so.2}¡G
\begin{tscreen}
\begin{verbatim}
 ln -s /usr/i486-linuxglibc2/lib/ld-linux.so.2 /lib/ld-linux.so.2
 
\end{verbatim}
\end{tscreen}

·í¤@­ÓÀÉ®×³sµ²®É¡A³o­Ó¨ç¦¡®w¬O°ß¤@¤@­Ó¦ì¸m©T©wªº¡C
·íÃ­©wªºª©¥»¥X²{ªº®É­Ô¡A
¦b /lib ¨Ï¥Î³sµ²¤]·|¨Ï±o±N glibc ¤É¯Å¬°¥D­n¨ç¦¡®w®É§ó¬°»´ÃP¡C
\item ­×§ï {\ttfamily /etc/ld.so.conf}¡C
§A»Ý­n¼W¥[·sªº¨ç¦¡®w©Ò¦bªº¸ô®|¨ìÀÉ®×ªº³Ì«á¡A
³o¸ô®|À³¸Ó¬O {\ttfamily $<$prefix$>$/lib}¡C
°²¦p¥Î¥H¤Wªº¿ï¾Ü´NÀ³¸Ó¬O {\ttfamily /usr/i486-linuxglibc2/lib}¡C
¦b§A­×§ï¤F {\ttfamily /etc/ld.so.conf} ¤§«á¡A°õ¦æ¡G
\begin{tscreen}
\begin{verbatim}
 ldconfig -v
 
\end{verbatim}
\end{tscreen}
\end{enumerate}





\subsection{³]©w gcc}



¦w¸Ëªº³Ì«á¤@¨B¬O§ó·s {\ttfamily /usr/lib/gcc-lib}
¥H¨Ï gcc ª¾¹D¦p¦ó¨Ï¥Î·sªº¨ç¦¡®w¡C
­º¥ý¡A§A»Ý­n½Æ»s¥Ø«eªº²ÕºA¡A­nª¾¹D¥Ø«eªº²ÕºA¡A¨Ï¥Î gcc ªº -v ¿ï¶µ¡G
\begin{tscreen}
\begin{verbatim}
 % gcc -v
 Reading specs from /usr/lib/gcc-lib/i486-unknown-linux/2.7.2.2/specs
 gcc version 2.7.2.2
 
\end{verbatim}
\end{tscreen}

³o¸Ì¡Ai486-unknown-linux ¬O¥Ø«e©Ò¥Îªº¨t²Î¡A2.7.2.2 «h¬O¥Ø«eª©¥»¡C
§A»Ý­n±N {\ttfamily /usr/lib/gcc-lib/$<$¨t²Î$>$} ½Æ»s¨ì·sªº´ú¸Õ¨t²Î¥Ø¿ý¡G
\begin{tscreen}
\begin{verbatim}
 cd /usr/lib/gcc-lib/
 cp -r i486-unknown-linux i486-linuxglibc2
 
\end{verbatim}
\end{tscreen}

¨ì§Aªº·s¨t²Î¥Ø¿ý¥H¤Îª©¥»¥Ø¿ý¤U¡G
\begin{tscreen}
\begin{verbatim}
 cd /usr/lib/gcc-lib/i486-linuxglibc2/2.7.2.2
 
\end{verbatim}
\end{tscreen}

­×§ï¥Ø¿ý¤Uªº {\ttfamily specs}¡C¦b³oÀÉ®×¤¤¡A
±N {\ttfamily /lib/ld-linux.so.1} ´«¦¨ {\ttfamily /lib/ld-linux.so.2}¡A
§A¤]¥²»Ý­n²¾¥hÀÉ®×¤¤©Ò¦³ªº {\ttfamily \%$\{$...:-lgmon$\}$} ªí¥Ü¦¡¡A
¦]¬° glibc ¤£¨Ï¥Î gmon ¨ç¦¡®w¨Ó°µ profile¡C
§A¥i¥H¦b\ref{specs} {(Specs ÀÉ½d¨Ò)}§ä¨ì¤@­Ó½d¨Ò¡C




\subsection{§ó·s¼ÐÀYÀÉ³sµ²}



§A»Ý­n¦b§Aªº include ¥Ø¿ý¤U«Ø¥ß³sµ²¨ì¨ä¥¦ªº include ¥Ø¿ý¡G
\begin{tscreen}
\begin{verbatim}
 cd /usr/i486-linuxglibc2/include
 ln -s /usr/src/linux/include/linux
 ln -s /usr/src/linux/include/asm
 ln -s /usr/X11R6/include/X11
 
\end{verbatim}
\end{tscreen}

¤]³\§A¦³¨ä¥¦ªº¨ç¦¡®w¡A¨Ò¦p»¡ ncurse¡A
¦Ó³o¨Ç¨ç¦¡®w·|»Ý­n¥¦­Ì¦Û¤vªº¼ÐÀYÀÉ¡A
§AÀ³¸Ó±q {\ttfamily /usr/include} ½Æ»s©Î³sµ²³o¨ÇÀÉ®×¡C
(¦³¨Ç¨ç¦¡®w»Ý­n­«·s¥Î glibc2 ¨Ó compile¡A¦b³oºØ±¡§Î¤U¡A
¥u­n½sÄ¶¨Ã¥B¦w¸Ë¨ì {\ttfamily /usr/i486-linuxglibc2})




\subsection{´ú¸Õ§Aªº¦w¸Ë}



­n´ú¸Õ¦w¸Ë¬O§_¦¨¥\¡A«Ø¥ß¤@ÀÉ®× glibc.c ¦p¤U¡G
\begin{tscreen}
\begin{verbatim}
 #include <stdio.h>

 main()
 {
     printf("hello world!\n");
 }
 
\end{verbatim}
\end{tscreen}

¥Î {\tt\char`\"}-b $<$¦w¸Ë¥Ø¿ý$>$ -nostdinc -I$<$¦w¸Ë¥Ø¿ý$>$/include -I/usr/lib/gcc-lib/$<$·s¨t²Î¥Ø¿ý$>$/$<$gcc ª©¥»$>$/include{\tt\char`\"} ªº¿ï¶µ½sÄ¶¡G
\begin{tscreen}
\begin{verbatim}
 % gcc -b i486-linuxglibc2 -nostdinc -I/usr/i486-linuxglibc2/include -I/usr/lib/gcc-lib/i486-linuxglibc2/2.7.2.2/include glibc.c -o glibc
 
\end{verbatim}
\end{tscreen}

¨Ï¥Î ldd ½T©wµ{¦¡¬O¥Î glibc2 ³sµ²¡A¦Ó«DÂÂ¦³ªº libc¡G
\begin{tscreen}
\begin{verbatim}
 % ldd glibc
 libc.so.6 => /usr/i486-linuxglibc2/lib/libc-2.0.5.so (0x4000d000)
 /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
 
\end{verbatim}
\end{tscreen}

¦pªG³q¹L½sÄ¶¡A³sµ²¤]½T©w¡A
¨Ã¥B°õ¦æ®É¤]²£¥Í {\tt\char`\"}hello world!{\tt\char`\"} ªº¿é¥X¡A¨º»ò¦w¸Ë´N¦¨¥\¤F¡C






\section{¦w¸Ë¦¨¥D­n¨ç¦¡®w\label{primary-install}}



³o¤@¸`ªº¤º®e¬OÃö©ó±N glibc2 ¦w¸Ë¦¨§Aªº¥D­n C ¨ç¦¡®w¡C
¥ô¦ó§A½sÄ¶ªº·sµ{¦¡³£±N·|³sµ²¨ì³o¤@­Ó¨ç¦¡®w¡A
°£«D§A¥Î¤F¯S®íªº½sÄ¶¿ï¶µ¨Ó³sµ²¨ì¨ä¥¦ªºª©¥»¡C

°²¦p§A¬O¥Î RedHat ©Î Debian ¨Ã¥B¤w¤U¸ü¬ÛÃöªº rpm ©Î deb ÀÉ¡A
½Ð°Ñ¾\ RedHat ©Î Debian ªº¦w¸Ë»¡©ú¡A§A¥i¥Hª½±µ¸õ¹L³o¤@¸`¡C




\subsection{¥Ñ­ì©l½X½sÄ¶¨ç¦¡®w\label{compiling}}



³o¤@¸`¸ÑÄÀ¦p¦ó¥Ñ­ì©l½X½sÄ¶ glibc 2 »Pªþ¥[®M¥ó¡C
¦pªG§A·Q­n§ïÅÜ³Ì¨Î¤Æ»P²ÕºA¿ï¶µ©Î¨Ï¥ÎÃB¥~ªº®M¥ó¡A¨º§A´N¥²¶·½sÄ¶¨ç¦¡®w¡C




\subsubsection{»Ý¨D}



\begin{itemize}
\item ¬ù 150 MB ªººÏºÐªÅ¶¡
\item GNU make 3.75
\item gcc $>$= 2.7.2 (³Ì¦n¬O 2.7.2.1)
\item binutils 2.8.1 (°²¦p¬O alpha §A»Ý­n snapshot)
\item bash 2.0
\item autoconf 2.12 (°²¦p§A§ó°Ê¤F configure.in)
\item texinfo 3.11
\end{itemize}


¦b¤@¦w¸Ë¦³ 64MB °O¾ÐÅéªº i586@133 ¾÷¾¹¤W¡A
½sÄ¶§¹¾ãªº¨ç¦¡®w»Pªþ¥[®M¥ó¤j¬ù»Ý­n¤T­Ó¤p®É¡C
¦Ó¦b i686@200 ªº¾÷¾¹¤W«h¬ù»Ý­n¤@­Ó¥b¤p®É¡C




\subsubsection{¸Ñ¶}­ì©l½X}



§A»Ý­n±q archive ¤¤¸Ñ¥X­ì©l½X¤~¯à½sÄ¶¥¦¡A
³Ì¦nªº¤è¦¡¬O¡G
\begin{tscreen}
\begin{verbatim}
 tar xzf glibc-2.0.6.tar.gz
 cd glibc-2.0.6
 tar xzf ../glibc-linuxthreads-2.0.6.tar.gz
 tar xzf ../glibc-crypt-2.0.6.tar.gz
 tar xzf ../glibc-localedata-2.0.6.tar.gz
 
\end{verbatim}
\end{tscreen}

³o±N·|§â linuxthreads¡Bcrypt »P localedata µ¥¥Ø¿ý©ñ¨ì glibc-2.0.6 ¥Ø¿ý¤U¡A
¦p¦¹ configure ¤~¯à§ä¨ì³o¨Çªþ¥[®M¥ó¡C




\subsubsection{³]©w²ÕºA}



¦b {\ttfamily glibc-2.0.6} ªº¥Ø¿ý©³¤U¡A«Ø¥ß¤@­Ó·sªº¥Ø¿ý compile¡A
¨Ã¥B cd ¨ì compile ©³¤U¡A©Ò¤]ªº¤u§@³£·|¦b³o­Ó¥Ø¿ý¤¤§¹¦¨¡A
³o·|Â²¤Æ«áÄòªº²M°£¤u§@¡C
(µo®iªÌ¦ü¥G¨Ã¥¼Åý 'make clean' §@±o«Ü¦n)
\begin{tscreen}
\begin{verbatim}
 mkdir compile
 cd compile
 
\end{verbatim}
\end{tscreen}


°õ¦æ {\ttfamily ../configure}¡C
­n¨Ï¥Îªþ¥[®M¥ó§A¥²»Ý¥Î --enable-add-ons ¨Ó«ü©w¡A
¨Ò¦p --enable-add-ons=linuxthreads,crypt,localedata¡C
¤]³\§A¤]·|·Q­n«ü©w¦w¸Ëªº¥Ø¿ý¡A­n²Å¦X linux ¼Ð·Ç¬[ºc¡A
«ü©w¬° --prefix=/usr¡C
(·í¦b linux ¨t²Î¤W prefix ³Q³]¬° {\ttfamily /usr}¡A
configure ª¾¹D­n½Õ¾ã¨ä¥¦ªº¸ô®|¡A
¦n±N libc.so ¥H¤Î¨ä¥¦­«­nªº¨ç¦¡®w©ñ¨ì {\ttfamily /lib})
§¹¾ãªº configure ©R¥O¦p¤U¡G
\begin{tscreen}
\begin{verbatim}
 ../configure --enable-add-ons=linuxthreads,crypt,localedata --prefix=/usr
\end{verbatim}
\end{tscreen}





\subsubsection{½sÄ¶}



­n½sÄ¶»PÅçÃÒ¡A
°õ¦æ¡G
\begin{tscreen}
\begin{verbatim}
 make
 make check
 
\end{verbatim}
\end{tscreen}





\subsection{·Ç³Æ¦w¸Ë}

 

µL½×¬O¥Ñ­ì©l½X½sÄ¶©Î¬O¹w¥ý½sÄ¶¦nªºª©¥»¡A§A²{¦b¥²»Ý²¾°Ê¬Y¨ÇÀÉ®×¨Óªï±µ·sªº¨ç¦¡®w¡C
¥ô¦ó·s½sÄ¶ªºµ{¦¡·|³Q³sµ²¨ì glibc¡A¦ý¬OÂÂ¦³ÀRºA³sµ²ªºµ{¦¡¤´µM­Ê¾aµÛ libc 5¡A
©Ò¥H§A¤£¯à¥u¬OÂÐ»\±¼ÂÂ¦³ªºª©¥»¡C

\begin{enumerate}
\item «Ø¥ß¤@­Ó·sªº¥Ø¿ý¨Ó©ñ¸mÂÂÀÉ®×¡G
\begin{tscreen}
\begin{verbatim}
 mkdir -p /usr/i486-linuxlibc5/lib
 
\end{verbatim}
\end{tscreen}

\item ÂÂªº¼ÐÀYÀÉ¥²»Ý±q {\ttfamily /usr/include} ²¾¶}¡G
\begin{tscreen}
\begin{verbatim}
 mv /usr/include /usr/i486-linuxlibc5/include
 
\end{verbatim}
\end{tscreen}

\item «Ø¥ß¤@­Ó·sªº include ¥Ø¿ý¡A¨Ã¥B³]©w¨ì¨ä¥¦ include ¥Ø¿ýªº³sµ²¡G
\begin{tscreen}
\begin{verbatim}
 mkdir /usr/include
 ln -s /usr/src/linux/include/linux /usr/include/linux
 ln -s /usr/src/linux/include/asm /usr/include/asm
 ln -s /usr/X11R6/include/X11 /usr/include/X11
 ln -s /usr/lib/g++-include /usr/include/g++
 
\end{verbatim}
\end{tscreen}

³o¨Ç³sµ²¶·­nµø§Aªº¨t²Î¦Óµy§@½Õ¾ã¡C
³Ì¤Ö¦b Slackware ¤¤¡Ag++ ¼ÐÀYÀÉ®×¦b {\ttfamily /usr/local/g++-include}¡A
¦Ó Debian «o©ñ¦b {\ttfamily /usr/include/g++}¡A
¨Ã¥B±N {\ttfamily /usr/lib/g++-include} ³sµ²¨ì {\ttfamily /usr/include/g++}¡C
¦b«áªÌªº±¡§Î¡A§A¤]³\·|·Q­n±N­ì©lªº g++ include ¥Ø¿ý²¾¦^¨ì
{\ttfamily /usr/include}¡C
\item ¦^¦s©Ò¦³ÃB¥~ªº¼ÐÀYÀÉ»P³sµ²¡C
¬Y¨Ç«D¼Ð·Çªº¨ç¦¡®w·|±NÀÉ®×©ñ¦Ü {\ttfamily /usr/include}¡A
©Î¬O¦b {\ttfamily /usr/include} ©ñ¸m¤@³sµ²¨ì¥¦­Ìªº include ¥Ø¿ý¤U¡C
³o¨ÇÀÉ®×»P³sµ²¥²¶·¦^¦s¡A¦p¦¹¤~¥i¥H¥¿½Tªº¨Ï¥Î³o¨ÇÃB¥~ªº¨ç¦¡®w¡C
\item ±N§Aªº·s¨ç¦¡®w¸ô®|
(¨Ò¦p {\ttfamily /usr/i486-linuxlibc5/lib})
¥[¤J¨ì {\ttfamily /etc/ld.so.conf} ªº{\itshape ³»ºÝ\/}¡C
§A³Ì¦n­n¦³ ld.so 1.8.8 ©Î¬O§ó·sªºª©¥»¡A
¥HÁ×§K¦b¦w¸Ë§¹ glibc ¤§«á¥X²{¤@¨Ç©_©Çªº°T®§¡C
\item ·h²¾©Î½Æ»s©Ò¦³ªºÂÂ¨ç¦¡®w¨ì·sªº¥Ø¿ý¡C
\begin{tscreen}
\begin{verbatim}
 mv /usr/lib/libbsd.a /usr/i486-linuxlibc5/lib
 mv /usr/lib/libc.a /usr/i486-linuxlibc5/lib
 mv /usr/lib/libgmon.a /usr/i486-linuxlibc5/lib
 mv /usr/lib/libm.a /usr/i486-linuxlibc5/lib
 mv /usr/lib/libmcheck.a /usr/i486-linuxlibc5/lib
 mv /usr/lib/libc.so /usr/i486-linuxlibc5/lib
 mv /usr/lib/libm.so /usr/i486-linuxlibc5/lib
 cp /lib/libm.so.5.* /usr/i486-linuxlibc5/lib
 cp /lib/libc.so.5.* /usr/i486-linuxlibc5/lib
 
\end{verbatim}
\end{tscreen}

°²¦p§Aªº {\ttfamily /usr} »P {\ttfamily /} ¬O¦b¤£¦Pªº partition ¤W¡A
¨º {\ttfamily libm.so.5} »P {\ttfamily libc.so.5} À³¸Ó¥Î½Æ»sªº«D·h²¾¡A
¦]¬°¤@¨Ç¥Î¨Ó±Ò°Ê linux ªºµ{¦¡·|»Ý­n³o¨â­Ó¨ç¦¡®w¡A
¦]¦¹¥²¶·­n¦ì¦b root partition¡C
\item ±N {\ttfamily /usr/lib/*.o} ²¾¨ì·sªº¥Ø¿ý¤U¡C
\begin{tscreen}
\begin{verbatim}
 mv /usr/lib/crt1.o /usr/i486-linuxlibc5/lib
 mv /usr/lib/crti.o /usr/i486-linuxlibc5/lib
 mv /usr/lib/crtn.o /usr/i486-linuxlibc5/lib
 mv /usr/lib/gcrt1.o /usr/i486-linuxlibc5/lib
 
\end{verbatim}
\end{tscreen}

\item ¦b§Aªº¨ç¦¡®w²¾°Ê«á¡A
§ó·s library cache¡C
\begin{tscreen}
\begin{verbatim}
 ldconfig -v
 
\end{verbatim}
\end{tscreen}
\end{enumerate}





\subsection{¥Ñ¹w¥ý½sÄ¶¦nªº®M¥ó¦w¸Ë}



¦pªG§A¬O¥Ñ¤@¤w¹w¥ý½sÄ¶¦nªº glibc ¦w¸Ë¡A
§A¥²¶·¡G
\begin{tscreen}
\begin{verbatim}
 cd /
 gzip -dc glibc-2.0.bin.i386.tar.gz | tar tvvf -
 gzip -dc glibc-crypt-2.0.bin.i386.tar.gz | tar tvvf -
 ldconfig -v
 
\end{verbatim}
\end{tscreen}

¦pªG§A¥Îªº¬O¤£¦Pªº¨t²Î¬[ºc©Î¬Oª©¥»¡A½Ð¸m´«¾A·íªºÀÉ¦W¡C




\subsection{¥Ñ­ì©l½X¦w¸Ë}



­n¥Ñ­ì©l½X¦w¸Ë¡A
°õ¦æ¡G
\begin{tscreen}
\begin{verbatim}
 make install
 ldconfig -v
 
\end{verbatim}
\end{tscreen}





\subsection{§ó·s gcc specs}



¦w¸Ëªº³Ì«á¤@¨B
(¤£ºÞ§A¬O¥Ñ¹w¥ý½sÄ¶¦nªº®M¥ó©Î¬O¥Ñ­ì©l½X¦w¸Ë)
¬O§ó·s gcc ªº {\ttfamily spec} ÀÉ¡A
Åý§A¥i¥H¥¿½Tªº³sµ²§Aªºµ{¦¡¡C
­nª¾¹D gcc ©Ò¥Îªº¬O¨º¤@­Ó spec ÀÉ¡A
¦p¤U¿é¤J¡G
\begin{tscreen}
\begin{verbatim}
 % gcc -v
 reading specs from /usr/lib/gcc-lib/i486-unknown-linux/2.7.2.2/specs
 gcc version 2.7.2.2
 
\end{verbatim}
\end{tscreen}


¦b³o¸Ì¡A¨t²Î¬O i486-unknown-linux¡A
¦Óª©¥»«h¬O 2.7.2.2¡C
§A¥²¶·±N {\ttfamily /usr/lib/gcc-lib/$<$¨t²Î$>$} ½Æ»s¨ìÂÂªº¨t²Î¥Ø¿ý¤U¡G
\begin{tscreen}
\begin{verbatim}
 cd /usr/lib/gcc-lib/
 cp -r i486-unknown-linux i486-linuxlibc5
 
\end{verbatim}
\end{tscreen}


¨ì­ì¥ýªº¥Ø¿ý»Pª©¥»¥Ø¿ý¤U¡G
\begin{tscreen}
\begin{verbatim}
 cd /usr/lib/gcc-lib/i486-unknown-linux/2.7.2.2
 
\end{verbatim}
\end{tscreen}

¨Ã­×§ï¦b¦P¤@¥Ø¿ý¤Uªº {\ttfamily specs}¡C
±N³oÀÉ®×¤¤ªº {\ttfamily /lib/ld-linux.so.1} §ï¦¨ {\ttfamily /lib/ld-linux.so.2}¡A
¨Ã¥B­n±N©Ò¦³ªº {\ttfamily \%$\{$...:-lgmon$\}$} ªí¥Ü¦¡§R°£¡A
¦]¬° glibc ¤£¨Ï¥Î gmon ¨ç¦¡®w¨Ó°µ profiling¡C
§A¥i¥H¦b \ref{specs} {(Specs ÀÉ½d¨Ò)} §ä¨ì¤@¥÷ specs ÀÉªº½d¨Ò¡C




\subsection{´ú¸Õ§Aªº¦w¸Ë}



­n´ú¸Õ¦w¸Ë¬O§_¥¿½T¡A
½Ð«Ø¥ß glibc.c ¦p¤U¡G
\begin{tscreen}
\begin{verbatim}
 #include <stdio.h>

 main()
 {
     printf("hello world!\n");
 }
 
\end{verbatim}
\end{tscreen}

¨Ã¥B compile ³o­Óµ{¦¡¡G
\begin{tscreen}
\begin{verbatim}
 % gcc glibc.c -o glibc
 
\end{verbatim}
\end{tscreen}

¨Ï¥Î ldd ¨Ó¬dÃÒ³o­Óµ{¦¡¬O³sµ²¨ì glibc2 ¦Ó«D§AªºÂÂ libc¡G
\begin{tscreen}
\begin{verbatim}
 % ldd glibc
 libc.so.6 => /lib/libc.so.6 (0x4000e000)
 /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
 
\end{verbatim}
\end{tscreen}

°²¦p³o­Óµ{¦¡¥i¥H³q¹L compile¡A¨Ã¥B¦b°õ¦æ«á²£¥Í {\tt\char`\"}hello world!{\tt\char`\"}
ªº¿é¥X¡A¨º»òªí¥Ü¤w¸g¦w¸Ë¦¨¥\¡C






\section{¨Ï¥Î«D¥D­nªº C ¨ç¦¡®w½sÄ¶µ{¦¡}



¦³¨Ç®É­Ô§A·|·Q­n¨Ï¥Î¤£¦Pªº¨ç¦¡®w¨Ó½sÄ¶§Aªºµ{¦¡¡A³o¤@¸`·|¸ÑÄÀ¦p¦ó¹F¦¨³o­Ó¥Øªº¡C
§Ú·|¨Ï¥Î¦b«e¨â¸`¤¤©Ò¨Ï¥Îªº¥Ø¿ý»P¦w¸Ë¦WºÙ¡A°O±o­n§ïÅÜ³o¨Ç¦WºÙ¥H²Å¦X§Aªº³]©w¡C




\subsection{¤@­ÓÃö©ó¨Ï¥Î«D¥D­n C ¨ç¦¡®wªºÄµ§i}

¦b§A¶}©l½sÄ¶¥ô¦ó·|¦b¶}¾÷®É¥Î¨ìªºµ{¦¡¤§«e¡A
°²¦pµ{¦¡¬O°ÊºA³sµ²¡A¨Ã¥B¬O¦b non-root partition ³Q mount ¤§«e¨Ï¥Îªº¸Ü¡A
¨º©Ò¦³³sµ²¥Îªº¨ç¦¡®w³£¥²¶·¦b root partition ¤W¡C
¦b«e­±ªº¦w¸Ëµ{§Ç¸Ì¡A§Ú­Ì±N glibc ¦w¸Ë¦¨¥D­nªº¨ç¦¡®w¡A
¦ÓÂÂªº¨ç¦¡®w¤´µM«O¯d¦b {\ttfamily /lib}¡A
{\ttfamily /lib} ·|¦b root partition ¤W¡A
¤]´N¬O»¡¡A©Ò¦³¦b¶}¾÷®É·|¥Î¨ìªºµ{¦¡³£¯à¥¿±`¤u§@¡C
µM¦Ó¡A­Y§Aªº {\ttfamily /usr} ¬O¦b¤£¦Pªº partition ¤W¡A
¥B§â glibc ·í¦¨´ú¸Õ¥Îªº¨ç¦¡®w¡A¦w¸Ë¦b {\ttfamily /usr/i486-linuxglibc2}¡A
¨º°£«D {\ttfamily /usr} ¤w¸g³Q mount¡A§_«h©Ò¦³§A¥Î glibc ½sÄ¶ªºµ{¦¡³£±N¤£¯à¨Ï¥Î¡C




\subsection{¥Î´ú¸Õ¦w¸Ëªº glibc ½sÄ¶µ{¦¡}

­n¥Î´ú¸Õ¦w¸Ëªº glibc ½sÄ¶µ{¦¡¡A
§A¥²¶·­n±N include ¸ô®|­«³]¦¨ glibc ªº include ¸ô®|¡C
«ü©w {\tt\char`\"}-nostdinc{\tt\char`\"} ·|¨ú®ø¥¿±` include ¸ô®|¡A
¦Ó {\tt\char`\"}-I/usr/i486-linuxglibc2/include{\tt\char`\"} «h·|«ü¨ì glibc ªº include
¥Ø¿ý¡A
§A¤]¥²¶·­n«ü©w gcc ¼Ð·Ç include ¥Ø¿ý¡A
³q±`¬O {\ttfamily /usr/lib/gcc-lib/i486-linuxglibc2/2.7.2.2/include}¡C
(³o¸Ì°²³]§A¦w¸Ë´ú¸Õªº¨ç¦¡®w¦b i486-linuxglibc2¡A
¦Ó gcc ªºª©¥»¬O 2.7.2.2)

­n¥Î´ú¸Õ¦w¸Ëªº glibc ¨Ó³sµ²¡A§A¥²¶·«ü©ú gcc ³]©w¡A
³o¬O¥Ñ {\tt\char`\"}-b i486-linuxglibc2{\tt\char`\"} ³o¿ï¶µ¨Ó¹F¦¨¡C

¹ï¤j³¡¥÷ªºµ{¦¡¡A
§A¥i¥HÂ²³æªº±N¨ä¥[¤J makefile ªº
{\ttfamily \$CFLAGS}
»P
{\ttfamily \$LDFLAGS}
¿ï¶µ¤¤¡G
\begin{tscreen}
\begin{verbatim}
 CFLAGS = -nostdinc -I/usr/i486-linuxglibc2/include -I/usr/lib/gcc-lib/i486-linuxglibc2/2.7.2.2/include -b i486-linuxglibc2
 LDFLAGS = -b i486-linuxglibc2
 
\end{verbatim}
\end{tscreen}

°²¦p§A¨Ï¥Î configure ³o­Ó script¡A¦b°õ¦æ configure ¤§«e¡A
©w¸q shell ÅÜ¼Æ {\ttfamily \$CFLAGS} »P {\ttfamily \$LDFLAGS}
(¦b csh/tcsh ¤U¥Î env/setenv
¦b sh/bash/¨ä¥¦¤§¤U¥Î set/export)¡C
³o¼Ë²£¥Íªº makefile À³¸Ó·|¥]§t¥¿½Tªº {\ttfamily \$CFLAGS} »P
{\ttfamily \$LDFLAGS}¡C
¤£¹L¨Ã«D©Ò¦³ªº configure scrpt ³£·|¥h¨ú±o³o¨ÇÅÜ¼Æ¡A
©Ò¥H¦b°õ¦æ§¹ configure ¤§«á¡A§AÁÙ¬O­nÀË¬d¤@¤U makefile¡A
°²¦p»Ý­nªº¸Ü¡A¤â°Ê­×§ï¥¦¡C

°²¦p§A©Ò­n½sÄ¶ªºµ{¦¡¥u©I¥s gcc¡A(¦Ó¤£ª½±µ©I¥s cpp ©Î binutils)
§A¥i¥H¨Ï¥Î¥H¤Uªº script¡A¬Ù¥h¨C¦¸«ü©w©Ò¦³¿ï¶µªº³Â·Ð¡G
\begin{tscreen}
\begin{verbatim}
 #!/bin/bash
 /usr/bin/gcc -b i486-linuxglibc2 -nostdinc \
              -I/usr/i486-linuxglibc2/include \
              -I/usr/lib/gcc-lib/i486-linuxglibc2/2.7.2.2/include "$@"
 
\end{verbatim}
\end{tscreen}

½sÄ¶®É§A¥i¥H¨Ï¥Î³o­Ó script ¦Ó¤£¬O gcc¡C




\subsection{·í glibc ¬O¥D­n¨ç¦¡®w®É¥Î libc 5 ½sÄ¶µ{¦¡}

·í§A¤w¸g±N glibc ¦w¸Ë¦¨¥D­nªº¨ç¦¡®w¤§«á¡A¤S·Q¥ÎÂÂªº¨ç¦¡®w¨Ó½sÄ¶µ{¦¡ªº®É­Ô¡A
§A¥²¶·±N include ¸ô®|­«³]¦¨ÂÂªº¸ô®|¡C
«ü©w {\tt\char`\"}-nostdinc{\tt\char`\"} ±N·|¨Ï¹w³]ªº¸ô®|µL®Ä¡A
¦Ó {\tt\char`\"}-I/usr/i486-linuxlibc5/include{\tt\char`\"} ·|±N include
ªº¸ô®|«ü¨ìÂÂ¨ç¦¡®wªº include ¸ô®|¡A
§A¤]¥²¶·­n«ü©w
{\tt\char`\"}-I/usr/lib/gcc-lib/i486-linuxlibc5/2.7.2.2/include{\tt\char`\"}
¥H§t¤J gcc ©Ò»Ýªº include ÀÉ¡C
ª`·N­nµø§A·sªº¥Ø¿ý»P gcc ª©¥»¨Ó½Õ¾ã³o¨Ç¸ô®|¡C

­n¥ÎÂÂªº libc ¨Ó°µ³sµ²¡A§A¥²¶·«ü©w gcc ©Ò¥Îªº¬[ºc¡C
³o¬O¥Ñ {\tt\char`\"}-b i486-linuxlibc5{\tt\char`\"} ³o­Ó¿ï¶µ©Ò«ü©wªº¡C

¹ï¤j³¡¥÷ªºµ{¦¡¡A§A¥i¥HÂ²³æªº±N³o¨Ç¿ï¶µ¥[¤J¨ì makefile ¸Ìªº
{\ttfamily \$CFLAGS}
»P
{\ttfamily \$LDFLAGS}
¿ï¶µ¸Ì¡G
\begin{tscreen}
\begin{verbatim}
 CFLAGS = -nostdinc -I/usr/i486-linuxlibc5/include -I/usr/lib/gcc-lib/i486-linuxlibc5/2.7.2.2/include -b i486-linuxlibc5
 LDFLAGS = -b i486-linuxlibc5
 
\end{verbatim}
\end{tscreen}

°²¦p§A¨Ï¥Î configure ³o­Ó script¡A
¦b°õ¦æ configure ¤§«e¡A
©w¸q shell ÅÜ¼Æ {\ttfamily \$CFLAGS} »P {\ttfamily \$LDFLAGS}
(¦b csh/tcsh ¤U¥Î env/setenv
¦b sh/bash/©Î¨ä¥¦¤§¤U¥Î set/export)¡C
³o¼Ë²£¥Íªº makefile À³¸Ó·|¥]§t¥¿½Tªº {\ttfamily \$CFLAGS} »P
{\ttfamily \$LDFLAGS}¡C
¤£¹L¨Ã«D©Ò¦³ªº configure scrpt ³£·|¥h¨ú±o³o¨ÇÅÜ¼Æ¡A
©Ò¥H¦b°õ¦æ§¹ configure ¤§«á¡A§AÁÙ¬O­nÂ²ÀË¬d¤@¤U makefile¡A
°²¦p»Ý­nªº¸Ü¡A¤â°Ê­×§ï¥¦¡C

°²¦p§A©Ò­n½sÄ¶ªºµ{¦¡¥u©I¥s gcc¡A(¦Ó¤£ª½±µ©I¥s cpp ©Î binutils)
§A¥i¥H¨Ï¥Î¥H¤Uªº script¡A¬Ù¥h¨C¦¸«ü©w©Ò¦³¿ï¶µªº³Â·Ð¡G
\begin{tscreen}
\begin{verbatim}
 #!/bin/bash
 /usr/bin/gcc -b i486-linuxlibc5 -nostdinc \
              -I/usr/i486-linuxlibc5/include \
              -I/usr/lib/gcc-lib/i486-linuxlibc5/2.7.2.2/include "$@"
 
\end{verbatim}
\end{tscreen}

½sÄ¶®É§A¥i¥H¨Ï¥Î³o­Ó script ¦Ó¤£¬O gcc¡C






\section{½sÄ¶ C++ µ{¦¡}



¦]¬° libg++ ¨Ï¥Î¤F³¡¥÷ªº¼Æ¾Ç¨ç¦¡®w¡A¤]´N¬O»¡·|³sµ²¨ì libm¡C
¥Ñ©ó§A¥Ø«eªº libg++ ¬O¥ÎÂÂª©ªº¨ç¦¡®w©Ò«Ø¥ßªº¡A
©Ò¥H§A¥²¶·­«·s¥Î glibc ¨Ó compile libg++ ©Î¬O¨ú±o¤@¥÷¹w¥ý½sÄ¶¦nªºª©¥»¡C
³Ì·sª©ªº libg++ source »P¥Î glibc ©Ò³sµ²ªº¹w¥ý½sÄ¶ª©¥i¥H¦b
\nameurl{ftp://ftp.yggdrasil.com/private/hjl/}{}
§ä¨ì¡C




\subsection{¥Î´ú¸Õªº C ¨ç¦¡®w¦w¸Ë libg++}



°²¦p§A¤w¸g±N glibc ¦w¸Ë¦¨´ú¸Õ¥Îªº¨ç¦¡®w¡A¨º§A¥²¶·¦w¸Ë¨ì glibc ©Ò¦w¸Ëªº¥Ø¿ý¤U
(¨Ò¦p¥Ñ«e¤@¸`©Ò¥Üªº {\ttfamily /usr/i486-linuxglibc2})¡C
°²¦p§A­n¦w¸Ë¹w¥ý½sÄ¶¦nªºª©¥»
(³o¤]¬O§Ú«ØÄ³ªº¦w¸Ë¤è¦¡¡A¦]¬°§Ú¤@ª½³£¤£¯à¥Î³oºØ¤è¦¡¦¨¥\¦a½sÄ¶ libg++)¡A
§A¥²¶·±NÀÉ®×¸Ñ¨ì¼È¦sªº¥Ø¿ý¤U¡A
±N {\ttfamily usr/lib/} ¤Uªº©Ò¦³ÀÉ®×·h¨ì
{\ttfamily $<$install directory$>$/lib/}¡A
¨Ã±N {\ttfamily usr/include/} ¤Uªº©Ò¦³ÀÉ®×·h¨ì
{\ttfamily $<$install directory$>$/include/} ¤U¡A
(°O±o¥ý§R°£ {\ttfamily include/g++} ³o­Ó³sµ²¡I)
¦A±N {\ttfamily usr/bin/} ¤UªºÀÉ®×·h¨ì 
{\ttfamily $<$install directory$>$/bin/}¡C




\subsection{¦b¥D­n glibc ¤U¦w¸Ë libg++}

­Y§A¤w¸g±N glibc ¦w¸Ë¦¨¥D­nªº¨ç¦¡®w¡A°²¦pÁÙ·Q­n¥ÎÂÂªº libc ¨Ó½sÄ¶ g++ ªºµ{¦¡¡A
¨º§A¥²¶·¥ý±NÂÂªº libg++ ÀÉ®×²¾¦ÜÂÂªº libc ªº¥Ø¿ý¤U¡C
¤]³\³ÌÂ²³æªº¤è¦¡´N¬O¦p«e¤@¸`¥Î libc 5 ¨Ó¦w¸Ë¤@¥÷·sª©ªº«þ¨©¡A
µM«á¦A¥¿±`¦w¸Ë glibc ª©¡C




\subsection{¨Ï¥Î«D¥D­nªº C ¨ç¦¡®w¨Ó½sÄ¶ C++ µ{¦¡}

°²¦p§A·Q¥Î«D¥D­nªº C ¨ç¦¡®w¨Ó½sÄ¶ C++ µ{¦¡¡A
¨º§A¥²¶·­n¥[¤J g++ ªº include ¥Ø¿ý¡C
¦b¤W­±ªº¨Ò¤l¤¤¡A
¹ï´ú¸Õ¥Îªº glibc ¬O {\ttfamily /usr/i486-linuxglibc2/include/g++}¡A
¦Ó¹ï¥D­n glibc «h¬O {\ttfamily /usr/i486-linuxlibc5/include/g++}¡A
³o³q±`³£¥i¥H¥Ñ²K¥[¦Ü {\ttfamily \$CXXFLAGS} ³o­ÓÅÜ¼Æ¨Ó§¹¦¨¡G
\begin{tscreen}
\begin{verbatim}
 CXXFLAGS = -nostdinc -I/usr/i486-linuxglibc2/include -I/usr/lib/gcc-lib/i486-linuxglibc2/2.7.2.2/include -I/usr/i486-linuxlibc5/include/g++ -b i486-linuxglibc2
 
\end{verbatim}
\end{tscreen}







\section{³ø§i¯äÂÎ}



°²¦p§A¥H¬°³o¨ç¦¡®w¦³¿ù¡A½Ð¥ý¾\Åª FAQ¡A¤]³\¤w¸g¦³¤H¹J¨ì¹L³o­Ó°ÝÃD¡A
¨Ã¥B¤]¤w¸g¦³¤FÂ²³æªº¸Ñ¨M¤èªk¡C
¥t¥~¡A§A¤]À³¸Ó¬d¬Ý {\ttfamily INSTALL} ÀÉ¤¤ªº
"Recommended Tools to Install the GNU C Library" ¤@¸`¡A
¦]¬°¦³¨Ç¿ù»~¤£¦b©ó glibc ¦Ó¬O¦b©ó³o¨Ç¤u¨ã¡C

°²³]§A§ä¨ì¤F¯äÂÎ¡A½Ð¥ý½T©w¨ºªº½T¬O¯äÂÎ¡C
¤@­Ó§PÂ_ªº¦n¤èªk¬O¬Ý¬Ý glibc ªº¦æ¬°¬O§_»P¨ä¥¦ªº C ¨ç¦¡®w¬Û¦P¡C
°²¦p¬Û¦Pªº¸Ü¡A¨º¤]³\§A¬O¿ùªº¡A¦Ó¨ç¦¡®w¬O¥¿½Tªº¡C
(¦ý¤]¤£¤@©w¦p¦¹)
°²¦p¤£¬Û¦Pªº¸Ü¡A¨ºªÖ©w¨âªÌ¤§¤¤¦³¤@­Ó¬O¿ùªº¡C

±µµÛ¡A½Ð¨ì \nameurl{http://www-gnats.gnu.org:8080/cgi-bin/wwwgnats.pl}{}¡A
¨Ã¥B¬d¬Ý¯äÂÎ¸ê®Æ®w¡A½T©w³o­Ó°ÝÃD©|¥¼¦³¤H´£¥X¡C
§A¤]À³¸Ó¬Ý¬Ý {\ttfamily BUGS}
(¤º¥I©ó libc ¤¤)
©Ò¦C¥Xªº¥Ø«e¤w³Qµo²{ªº¯äÂÎ¡C

¤@¥¹§A½T©w§ä¨ì¤F¤@°¦·sªº¯äÂÎ¡A½Ð¸ÕµÛ±N¥¦ÁY¤p¨ì³Ì¤pªº test case¡C
´N C ¨ç¦¡®w¦Ó¨¥¡A§A¥u»Ý­n±N¥¦ÁY¤p¨ì³æ¿W¤@­Ó¨ç¦¡©I¥s(°²¦p¥i¥Hªº¸Ü)¡C
³oÀ³¸Ó¤£¬O¤Ó§xÃøªº¨Æ¡C

³Ì«á¤@­Ó¨BÆJ¬O´N§Aªº test case ´£¥X¯äÂÎ³ø§i¡C
­n°e¥X¯äÂÎ³ø§i¡A½Ð¥]§t§Aªº test case¡B§A©Ò±o¨ìªºµ²ªG¡B§A©Ò´Á«Ýªºµ²ªG¡B
§A»{¬°¥i¯àªº­ì¦]¦b¨º
(¥u­n§A´¿·Q¹Lªº¥ô¦ó­ì¦])¡B§Aªº¨t²ÎÃþ§O¡B§A©Ò¨Ï¥Îªº GNU C ¨ç¦¡®w¡B
GNU CC ½sÄ¶¾¹¡BGNU binutils ªºª©¥»¡C¥t¥~¡A
½Ðªþ¤W°õ¦æ {\ttfamily configure} ®É²£¥Íªº {\ttfamily config.status} »P
{\ttfamily config.make}¡A
³o¨â­ÓÀÉ®×·|¦b§A°õ¦æ {\ttfamily configure} ®É­Ôªº¥Ø¿ý¤U¡C

©Ò¦³ªº¯äÂÎ³ø§i³£À³¸Ó¨Ï¥Î {\ttfamily glibcbug} ³o­Ó GNU libc ©Òªþªº shell script
°e¦Ü \nameurl{mailto:bugs@gnu.org}{bugs@gnu.org} (ÂÂªº¦ì§} \nameurl{mailto:bugs@gnu.ai.mit.edu}{bugs@gnu.ai.mit.edu}
¤]¤´µM¥i¥H¨Ï¥Î)¡C
©Î¬O¨ì GNATS ºô¯¸¤W§Q¥Î
\nameurl{http://www-gnats.gnu.org:8080/cgi-bin/wwwgnats.pl}{}
³o­Ó¤¶­±¨Ó°µ¡C

§Aªº«ØÄ³»P°ÝÃDÀ³¸Ó°e¨ì \nameurl{mailto:bugs-glibc@prep.ai.mit.edu}{bugs-glibc@prep.ai.mit.edu} ³o­Ó¶l»¼¦Cªí¡C
°²¦p§A¨S¦³¾\Åª·s»D¸s²Õ gnu.bug.glibc¡A
¨º»ò§A¥i¥H­n¨D \nameurl{mailto:bug-glibc-request@prep.ai.mit.edu}{bug-glibc-request@prep.ai.mit.edu} ¥[¤J³o­Ó¦Cªí¡C

½Ð¤£­n±N GNU C ¨ç¦¡®wªº¯äÂÎ³ø§i°e¨ì $<$bug-gcc@prep.ai.mit.edu$>$¡A
³o¬O¬°¤F GNU CC ¦Ó³]¥ßªº¡A¦Ó GNU CC »P GNU C ¨ç¦¡®w¬O¥Ñ¤£¦P¤H­Ìªº©ÒºûÅ@ªº¡C






\section{Specs ÀÉ½d¨Ò\label{specs}}



³o¸Ì¬O¤@¥÷ {\ttfamily specs} ªº½d¨Ò¡C³o±N¨Ï gcc ¥Î glibc2 ¨Ó½sÄ¶»P³sµ²¡C
¥¦À³¸Ó¦ì©ó
{\ttfamily /usr/lib/gcc-lib/$<$·s¨t²Î¥Ø¿ý$>$/$<$gcc ª©¥»$>$}.
°²¦p§A¥Îªº¬O x86 ªº¨t²Î¡A¨º§A¤]³\¥i¥Hª½±µ±N³o¤@¬q½Æ»s¨ìÀÉ®×¸Ì¥h¡C
\begin{tscreen}
\begin{verbatim}
 *asm:
 %{V} %{v:%{!V:-V}} %{Qy:} %{!Qn:-Qy} %{n} %{T} %{Ym,*} %{Yd,*} %{Wa,*:%*}

 *asm_final:
 %{pipe:-}

 *cpp:
 %{fPIC:-D__PIC__ -D__pic__} %{fpic:-D__PIC__ -D__pic__} %{!m386:-D__i486__} %{posix:-D_POSIX_SOURCE} %{pthread:-D_REENTRANT}

 *cc1:
 %{profile:-p}

 *cc1plus:

 *endfile:
 %{!shared:crtend.o%s} %{shared:crtendS.o%s} crtn.o%s

 *link:
 -m elf_i386 %{shared:-shared}   %{!shared:     %{!ibcs:       %{!static:       %{rdynamic:-export-dynamic}     %{!dynamic-linker:-dynamic-linker /lib/ld-linux.so.2}}  %{static:-static}}}

 *lib:
 %{!shared: %{pthread:-lpthread}        %{profile:-lc_p} %{!profile: -lc}}

 *libgcc:
 -lgcc

 *startfile:
 %{!shared:      %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s}                  %{!p:%{profile:gcrt1.o%s}                         %{!profile:crt1.o%s}}}}    crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}

 *switches_need_spaces:

 *signed_char:
 %{funsigned-char:-D__CHAR_UNSIGNED__}

 *predefines:
 -D__ELF__ -Dunix -Di386 -Dlinux -Asystem(unix) -Asystem(posix) -Acpu(i386) -Amachine(i386)

 *cross_compile:
 0

 *multilib:
 . ;
 
\end{verbatim}
\end{tscreen}







\section{Âø¶µ}






\subsection{¶i¤@¨Bªº¸ê®Æ}






\subsubsection{¬ÛÃöºô­¶}



\begin{itemize}
\item \nameurl{http://www.gnu.org/software/libc/libc.html}{FSF's GNU C Library Home Page}
\item \nameurl{http://www.imaxx.net/~thrytis/glibc/}{Using GNU Libc 2 with Linux}
\item \nameurl{http://huizen.dds.nl/~frodol/glibc/}{Installing glibc-2 on Linux}.
\item \nameurl{http://www.gate.net/~storm/FAQ/libc5-libc6-Mini-HOWTO.html}{Debian libc5 to libc6 Mini-HOWTO}.
\end{itemize}





\subsubsection{·s»D¸s²Õ}



\begin{itemize}
\item \onlynameurl{comp.os.linux.development.system}
\item \onlynameurl{comp.os.linux.development.apps}
\item \onlynameurl{linux.dev.kernel}
\item \onlynameurl{gnu.bugs.glibc}
\end{itemize}





\subsubsection{¶l»¼¦Cªí}



\begin{description}
\item[Glibc 2 Linux °Q½×¦Cªí] \mbox{}

³o­Ó¶l»¼¦Cªí¬O¬°¤FÅý¦w¸Ë¦³ glibc¡A¤]´N¬O·sªº GNU C ¨ç¦¡®w¡Aªº¨Ï¥ÎªÌ°Q½×¥Îªº¡C
Ä³ÃD¥]¬A¬Û®e©Êªº°ÝÃD¡A¥H¤Î¦b linux/glibc Àô¹Ò¤Uµ{¦¡ªº½sÄ¶°ÝÃD¡C
­n­q¾\³o­Ó¶l»¼¦Cªí¡A
½Ð±H¤@«Ê«H¦Ü \nameurl{mailto:Majordomo@ricardo.ecn.wfu.edu}{Majordomo@ricardo.ecn.wfu.edu}¡A
«Hªº¤º®e¬° "subscribe glibc-linux $<$your email address$>$"¡C

\end{description}





\subsection{°^ÄmªÌ¦Cªí}

¤j³¡¥÷ªº¸ê°T³£¬O¥Ñ
\nameurl{http://www.gnu.org/software/libc/libc.html}{GNU Libc web page}
¥H¤Î
Ulrich Drepper ªº $<$drepper@gnu.ai.mit.edu$>$ glibc 2
announcement
©Ò°½¨Óªº¡A
Andreas Jaeger $<$aj@arthur.rhein-neckar.de$>$ «h´£¨Ñ¤F³¡¥÷ªº¯äÂÎ³ø§i¡C

¥H¤U¦U¦ì³£´¿¹ï¥»¤å¥ó´£¨Ñ¬ÛÃö¸ê°T¥H¤Î·N¨£¡G
\begin{itemize}
\item Allex Juang$<$allex@ms2.accmail.com.tw$>$
\item Mark Brown $<$M.A.Brown-4@sms.ed.ac.uk$>$
\item Ulrich Drepper $<$drepper@gnu.ai.mit.edu$>$
\item Scott K. Ellis $<$ellis@valueweb.net$>$
\item Aron Griffis $<$agriffis@coat.com$>$
\item Andreas Jaeger $<$aj@arthur.rhein-neckar.de$>$
\item Frodo Looijaard $<$frodol@dds.nl$>$
\item Ryan McGuire $<$rmcguire@freenet.columbus.oh.us$>$
\item Shaya Potter $<$spotter@capaccess.org$>$
\item Les Schaffer $<$godzilla@futuris.net$>$
\item Andy Sewell $<$puck@pookhill.demon.co.uk$>$
\item Gary Shea $<$shea@gtsdesign.com$>$
\item Stephane $<$sr@adb.fr$>$
\item Jan Vandenbos $<$jan@imaxx.net$>$
\end{itemize}

³o¥÷¤å¥óªºÂ½Ä¶¬O¥Ñ¥H¤U¼Æ¤H©Ò§¹¦¨ªº¡G
\begin{itemize}
\item ¤¤¤å¡G  Allex Juang$<$allex@ms2.accmail.com.tw$>$
\item ªk¤å¡G  Olivier Tharan $<$tharan@int-evry.fr$>$
\item ¤é¤å¡G  Kazuyuki Okamoto $<$ikko-@pacific.rim.or.jp$>$
\end{itemize}





\subsection{¦^õX}



°£¤F¼¶¼g³o¥÷ HOWTO¡BºûÅ@
\nameurl{http://www.imaxx.net/~thrytis/glibc}{glibc 2 for Linux}
³oºô­¶¡B¨Ã¥B¦b§Úªº¾÷¾¹¤W¨Ï¥Î¤§¥~¡A§Ú»P glibc ­p¹º§¹¥þµLÃö¡A
§Ú¤]¤£¤F¸Ñ³o¤è­±ªºÄ³ÃD¡A¦ý·|¾¨¥i¯àªº¹ï±Hµ¹§Úªº°ÝÃD´£¨ÑÀ°§U¡C
§Ú¤]«ÜÅwªï§A´£¥X¥ô¦óªº¦^õX¡B­×¥¿¡B©Î¬O«ØÄ³¡A½Ð±N¥¦­Ì±H¨ì
\nameurl{mailto:ejg3@cornell.edu}{ejg3@cornell.edu}¡C




\subsection{Copyright.}

¦¹¥÷¤å¥óªºª©ÅvÄÝ©ó Eric Green¡A³o¥÷¤å¥ó¥i¥H¦b LDP ªº°õ·Ó¤U´²§G¡C



\end{document}
