source: chapter06/glibc-inst.xml@ f24558cd

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 11.1 11.1-rc1 11.2 11.2-rc1 11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 12.2 12.2-rc1 6.0 6.1 6.1.1 6.3 6.4 6.5 6.6 6.7 6.8 7.0 7.1 7.2 7.3 7.4 7.5 7.5-systemd 7.6 7.6-systemd 7.7 7.7-systemd 7.8 7.8-systemd 7.9 7.9-systemd 8.0 8.1 8.2 8.3 8.4 9.0 9.1 arm bdubbs/gcc13 ml-11.0 multilib renodr/libudev-from-systemd s6-init trunk v4_1 v5_0 v5_1 v5_1_1 xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/lfs-next xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/loongarch-12.2 xry111/mips64el xry111/multilib xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since f24558cd was 30a2c84, checked in by Gerard Beekmans <gerard@…>, 22 years ago

split up the glibc and man 'mega' patches

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@2269 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

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