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