1 | <sect2><title> </title><para> </para></sect2>
|
---|
2 |
|
---|
3 | <sect2>
|
---|
4 | <title>Glibc installation</title>
|
---|
5 |
|
---|
6 | <para>Before starting to install glibc, you must cd into the
|
---|
7 | glibc-&glibc-version; directory and unpack glibc-linuxthreads inside
|
---|
8 | the glibc-&glibc-version; directory, not in /usr/src as you normally
|
---|
9 | would do.</para>
|
---|
10 |
|
---|
11 | <para>This package is known to behave badly when you have changed its
|
---|
12 | default optimization flags (including the -march and -mcpu options). Glibc
|
---|
13 | is best left alone. Therefore, if you have defined any environment variables
|
---|
14 | that override default optimizations, such as CFLAGS and CXXFLAGS, we
|
---|
15 | recommend unsetting or modifying them when building Glibc.</para>
|
---|
16 |
|
---|
17 | <para>Basically, compiling Glibc in any other way than the book suggests
|
---|
18 | is putting your system at a very high risk.</para>
|
---|
19 |
|
---|
20 | <para>We'll start by applying a patch to Glibc that fixes the following:</para>
|
---|
21 |
|
---|
22 | <itemizedlist>
|
---|
23 | <listitem><para>It converts all occurrences of <emphasis>$(PERL)</emphasis>
|
---|
24 | to <emphasis>/usr/bin/perl</emphasis> in the
|
---|
25 | <filename>malloc/Makefile</filename> file. This is done because Glibc
|
---|
26 | can't autodetect the location of perl because the Perl package hasn't been
|
---|
27 | installed yet. And if Glibc thinks Perl isn't installed, the
|
---|
28 | <userinput>mtrace</userinput> perl program won't be installed
|
---|
29 | either.</para></listitem>
|
---|
30 |
|
---|
31 | <listitem><para>It replaces all occurrences of <emphasis>root</emphasis>
|
---|
32 | with <emphasis>0</emphasis> in the <filename>login/Makefile</filename>
|
---|
33 | file. This is done because Glibc itself isn't installed yet and therefore
|
---|
34 | username to userid resolving isn't working yet, so a
|
---|
35 | <userinput>chown root file</userinput> will fail, however it'll work fine
|
---|
36 | if you use the numeric IDs (such as <userinput>chown 0
|
---|
37 | file</userinput>).</para></listitem>
|
---|
38 |
|
---|
39 | </itemizedlist>
|
---|
40 |
|
---|
41 | <para><screen><userinput>patch -Np1 -i ../glibc-&glibc-rootperl-patch-version;-root-perl.patch</userinput></screen></para>
|
---|
42 |
|
---|
43 | <para>There is a potential problem that causes statically linked binaries
|
---|
44 | to crash that were linked against Glibc-2.2 or older libraries. Even though
|
---|
45 | static binaries have all the necessary parts of Glibc built-in, they still
|
---|
46 | rely on one external library set: Glibc's NSS libraries. These libraries,
|
---|
47 | among other things, tell programs where the system's password database is
|
---|
48 | (/etc/password, or NIS, or whatever other scheme has been
|
---|
49 | configured).</para>
|
---|
50 |
|
---|
51 | <para>Glibc has undergone some changes since version 2.2.x and the new NSS
|
---|
52 | code is incompatible with the old one. So when Glibc is installed, it will
|
---|
53 | install its new NSS libraries and static programs will load these new NSS
|
---|
54 | libraries and start to abort with <emphasis>segmentation fault</emphasis>
|
---|
55 | error. This patch undoes a few of the changes to overcome the problem.</para>
|
---|
56 |
|
---|
57 | <para>If you started chapter 5 with a host system that uses Glibc-2.2.x
|
---|
58 | or older, you must apply the following patch. We will install Glibc again at
|
---|
59 | the end of this chapter to remove this patch so you'll have a pristine Glibc
|
---|
60 | as the developers intended it.</para>
|
---|
61 |
|
---|
62 | <para><screen><userinput>patch -Np1 -i ../glibc-&glibc-libnss-patch-version;-libnss.patch</userinput></screen></para>
|
---|
63 |
|
---|
64 | <para>Glibc will check for the <filename>/etc/ld.so.conf</filename> file
|
---|
65 | and abort with an error if the file is missing, so we must create it:</para>
|
---|
66 |
|
---|
67 | <para><screen><userinput>touch /etc/ld.so.conf</userinput></screen></para>
|
---|
68 |
|
---|
69 | <para>It is recommended by the Glibc installation documentation to build
|
---|
70 | Glibc outside of the source directory in a dedicated directory:</para>
|
---|
71 |
|
---|
72 | <para><screen><userinput>mkdir ../glibc-build &&
|
---|
73 | cd ../glibc-build</userinput></screen></para>
|
---|
74 |
|
---|
75 | <para>Next, prepare Glibc to be compiled:</para>
|
---|
76 |
|
---|
77 | <para><screen><userinput>../glibc-&glibc-version;/configure --prefix=/usr \
|
---|
78 | --disable-profile --enable-add-ons \
|
---|
79 | --libexecdir=/usr/bin</userinput></screen></para>
|
---|
80 |
|
---|
81 | <para>The meaning of the configure options are:</para>
|
---|
82 |
|
---|
83 | <itemizedlist>
|
---|
84 | <listitem><para><userinput>--disable-profile:</userinput> This disables the
|
---|
85 | building of libraries with profiling information. This command may be
|
---|
86 | omitted if you plan to do profiling.</para></listitem>
|
---|
87 |
|
---|
88 | <listitem><para><userinput>--enable-add-ons:</userinput> This enables the
|
---|
89 | add-on that we install with Glibc, linuxthreads</para></listitem>
|
---|
90 |
|
---|
91 | <listitem><para><userinput>--libexecdir=/usr/bin:</userinput> This will
|
---|
92 | cause the pt_chown program to be installed in the /usr/bin
|
---|
93 | directory.</para></listitem>
|
---|
94 | </itemizedlist>
|
---|
95 |
|
---|
96 | <para>During this stage you will see the following warning:</para>
|
---|
97 |
|
---|
98 | <blockquote><screen>configure: warning:
|
---|
99 | *** These auxiliary programs are missing or too old: msgfmt
|
---|
100 | *** some features will be disabled.
|
---|
101 | *** Check the INSTALL file for required versions.</screen></blockquote>
|
---|
102 |
|
---|
103 | <para>The missing msgfmt (from the gettext package which we will install
|
---|
104 | later in this chapter) won't cause any problems. msgfmt is used to generate
|
---|
105 | the binary translation files that are used to make your system talk in a
|
---|
106 | different language. Because these translation files have already been
|
---|
107 | generated for you, there is no need for msgfmt. You'd only need msgfmt if
|
---|
108 | you change the translation source files (the <filename>*.po</filename>
|
---|
109 | files in the <filename class="directory">po</filename> subdirectory) which
|
---|
110 | would require you to re-generate the binary files.</para>
|
---|
111 |
|
---|
112 | <para>Because Glibc hasn't been installed yet, one of the tests that was
|
---|
113 | run by the configure script failed. This test is supposed to test gcc to
|
---|
114 | determine whether or not a cross-compiler is installed. However, Glibc
|
---|
115 | needs to be installed already to run this test. Since the test failed, the
|
---|
116 | configure script automatically assumed we do have a cross-compiler. We have
|
---|
117 | to override that assumption by explicitly telling Glibc we're not
|
---|
118 | cross-compiling. Not doing this has a couple of unintended side effects,
|
---|
119 | such as the timezone files not being installed.</para>
|
---|
120 |
|
---|
121 | <para><screen><userinput>echo "cross-compiling = no" > configparms</userinput></screen></para>
|
---|
122 |
|
---|
123 | <para>Continue with compiling the package:</para>
|
---|
124 |
|
---|
125 | <para><screen><userinput>make</userinput></screen></para>
|
---|
126 |
|
---|
127 | <para>We'll continue with installing the package. The Linuxthreads man
|
---|
128 | pages are not going to be installed at this point because it requires a
|
---|
129 | working Perl installation. We'll install Perl later on in this chapter,
|
---|
130 | and the man pages will be installed when Glibc is installed for the second
|
---|
131 | time at the end of this chapter.</para>
|
---|
132 |
|
---|
133 | <para><screen><userinput>make install</userinput></screen></para>
|
---|
134 |
|
---|
135 | <para>Locales aren't installed when you ran
|
---|
136 | <userinput>make install</userinput>, so we have to do that ourselves now.
|
---|
137 | Locales are used by Glibc to make your Linux system talk in a different
|
---|
138 | language:</para>
|
---|
139 |
|
---|
140 | <para><screen><userinput>make localedata/install-locales</userinput></screen></para>
|
---|
141 |
|
---|
142 | <para>An alternative to running <userinput>make
|
---|
143 | localedata/install-locales</userinput> is to only install those locales
|
---|
144 | which you need or want. This can be achieved using the localedef
|
---|
145 | command. Information on this can be found in the INSTALL
|
---|
146 | file in the glibc-&glibc-version; tree.</para>
|
---|
147 |
|
---|
148 | <para>To finish off the installation we'll reload Bash so it uses the
|
---|
149 | libnss files. This will also get rid of the
|
---|
150 | <emphasis>I have no name!</emphasis> message in the command prompt:</para>
|
---|
151 |
|
---|
152 | <para><screen><userinput>exec /static/bin/bash --login</userinput></screen></para>
|
---|
153 |
|
---|
154 | </sect2>
|
---|
155 |
|
---|