1 | <sect2><title> </title><para> </para></sect2>
|
---|
2 |
|
---|
3 | <sect2>
|
---|
4 | <title>Installation of Glibc</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. You have
|
---|
16 | been warned.</para>
|
---|
17 |
|
---|
18 | <para>Basically, compiling Glibc in any other way than the book suggests
|
---|
19 | is putting your system at very high risk.</para>
|
---|
20 |
|
---|
21 | <para>We'll start by applying a patch to Glibc that fixes a few
|
---|
22 | things:</para>
|
---|
23 |
|
---|
24 | <itemizedlist>
|
---|
25 | <listitem><para>It converts all occurrences of <emphasis>$(PERL)</emphasis>
|
---|
26 | to <emphasis>/usr/bin/perl</emphasis> in the
|
---|
27 | <filename>malloc/Makefile</filename> file. This is done because Glibc
|
---|
28 | can't autodetect the location of perl because the Perl package hasn't been
|
---|
29 | installed yet.</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 | <listitem><para>Lastly, the patch also fixes a problem that causes
|
---|
40 | statically linked binaries to crash that were linked against Glibc-2.2
|
---|
41 | libraries. This patch is only needed temporarily because we have static
|
---|
42 | programs in <filename class="directory">/static/bin</filename> that might
|
---|
43 | be linked against an older Glibc version (the one from the host
|
---|
44 | distribution). We will install Glibc again at the end of this chapter to
|
---|
45 | remove this patch so you'll have a pristine Glibc as the developers
|
---|
46 | intended it.</para></listitem>
|
---|
47 | </itemizedlist>
|
---|
48 |
|
---|
49 | <para><screen><userinput>patch -Np1 -i ../glibc-&glibc-patch-version;.patch</userinput></screen></para>
|
---|
50 |
|
---|
51 | <para>Glibc will check for the <filename>/etc/ld.so.conf</filename> file
|
---|
52 | and abort with an error if the file is missing, so we create it.</para>
|
---|
53 |
|
---|
54 | <para><screen><userinput>touch /etc/ld.so.conf</userinput></screen></para>
|
---|
55 |
|
---|
56 | <para>It is recommended by the Glibc installation documentation to build
|
---|
57 | Glibc outside of the source directory in a dedicated directory. Let's
|
---|
58 | create such a directory and make it our CWD (Current Working
|
---|
59 | Directory).</para>
|
---|
60 |
|
---|
61 | <para><screen><userinput>mkdir ../glibc-build &&
|
---|
62 | cd ../glibc-build</userinput></screen></para>
|
---|
63 |
|
---|
64 | <para>Next, configure Glibc.</para>
|
---|
65 |
|
---|
66 | <para><screen><userinput>../glibc-&glibc-version;/configure --prefix=/usr \
|
---|
67 | --disable-profile --enable-add-ons \
|
---|
68 | --libexecdir=/usr/bin</userinput></screen></para>
|
---|
69 |
|
---|
70 | <para>During the configure stage you will see the following warning:</para>
|
---|
71 |
|
---|
72 | <blockquote><screen>configure: warning:
|
---|
73 | *** These auxiliary programs are missing or too old: msgfmt
|
---|
74 | *** some features will be disabled.
|
---|
75 | *** Check the INSTALL file for required versions.</screen></blockquote>
|
---|
76 |
|
---|
77 | <para>The missing msgfmt (from the gettext package which we will install
|
---|
78 | later in this chapter) won't cause any problems. msgfmt is used to generate
|
---|
79 | the binary translation files that are used to make your system talk in a
|
---|
80 | different language. Because these translation files have already been
|
---|
81 | generated for you, there is no need for msgfmt. You'd only need msgfmt if
|
---|
82 | you change the translation source files (the <filename>*.po</filename>
|
---|
83 | files in the <filename class="directory">po</filename> subdirectory) which
|
---|
84 | would require you to re-generate the binary files.</para>
|
---|
85 |
|
---|
86 | <para>The meaning of the configure switches are:</para>
|
---|
87 |
|
---|
88 | <itemizedlist>
|
---|
89 | <listitem><para><userinput>--disable-profile:</userinput> This disables the
|
---|
90 | building of libraries with profiling information. This command may be
|
---|
91 | omitted if you plan to do profiling.</para></listitem>
|
---|
92 |
|
---|
93 | <listitem><para><userinput>--enable-add-ons:</userinput> This enables the
|
---|
94 | add-on that we install with Glibc, linuxthreads</para></listitem>
|
---|
95 |
|
---|
96 | <listitem><para><userinput>--libexecdir=/usr/bin:</userinput> This will
|
---|
97 | cause the pt_chown program to be installed in the /usr/bin
|
---|
98 | directory.</para></listitem>
|
---|
99 | </itemizedlist>
|
---|
100 |
|
---|
101 | <para>Because Glibc hasn't been installed yet, one of the tests that was
|
---|
102 | run by the configure script failed. This test is supposed to test gcc to
|
---|
103 | determine whether or not a cross-compiler is installed. However, Glibc
|
---|
104 | needs to be installed already to run this test. Since the test failed, the
|
---|
105 | configure script automatically assumed we do have a cross-compiler. So,
|
---|
106 | we have to override that assumption by explicitly telling Glibc we're not
|
---|
107 | cross-compiling.</para>
|
---|
108 |
|
---|
109 | <para><screen><userinput>echo "cross-compiling = no" > configparms</userinput></screen></para>
|
---|
110 |
|
---|
111 | <para>We'll continue with compiling and installing Glibc. The Linuxthreads man
|
---|
112 | pages are not going to be installed at this point because it requires a
|
---|
113 | working Perl installation. We'll install Perl later on in this chapter,
|
---|
114 | and the man pages will be installed when Glibc is installed for the second
|
---|
115 | time at the end of this chapter.</para>
|
---|
116 |
|
---|
117 | <para><screen><userinput>make &&
|
---|
118 | make install</userinput></screen></para>
|
---|
119 |
|
---|
120 | <para>Locales aren't installed by default so we install them now. Locales
|
---|
121 | are used by Glibc to make your Linux system talk in a different language
|
---|
122 | such as your native tongue.</para>
|
---|
123 |
|
---|
124 | <para><screen><userinput>make localedata/install-locales</userinput></screen></para>
|
---|
125 |
|
---|
126 | <para>An alternative to running <userinput>make
|
---|
127 | localedata/install-locales</userinput> is to only install those locales
|
---|
128 | which you need or want. This can be achieved using the localedef
|
---|
129 | command. Information on this can be found in the INSTALL
|
---|
130 | file in the glibc-&glibc-version; tree.</para>
|
---|
131 |
|
---|
132 | <para>To finish off the installation we'll reload Bash so it uses the new
|
---|
133 | libnss files. This will get rid of the <emphasis>I have no name!</emphasis>
|
---|
134 | message in the command prompt.</para>
|
---|
135 |
|
---|
136 | <para><screen><userinput>exec /static/bin/bash --login</userinput></screen></para>
|
---|
137 |
|
---|
138 | </sect2>
|
---|
139 |
|
---|