Changeset efcb393 for chapter05/glibc.xml
- Timestamp:
- 05/03/2020 09:02:51 PM (4 years ago)
- Branches:
- 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, arm, bdubbs/gcc13, ml-11.0, multilib, renodr/libudev-from-systemd, s6-init, trunk, xry111/arm64, xry111/arm64-12.0, xry111/clfs-ng, xry111/lfs-next, xry111/loongarch, xry111/loongarch-12.0, xry111/loongarch-12.1, xry111/mips64el, xry111/pip3, xry111/rust-wip-20221008, xry111/update-glibc
- Children:
- a715dec
- Parents:
- 9d719e2
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
chapter05/glibc.xml
r9d719e2 refcb393 44 44 <title>Installation of Glibc</title> 45 45 46 <para>First, create two symbolic links, which are needed for proper 47 operation of the dynamic library loader:</para> 48 49 <screen><userinput remap="pre">ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64 50 ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64/ld-lsb-x86-64.so.3</userinput></screen> 51 52 <para>Some of the Glibc programs use the non-FHS compliant 53 <filename class="directory">/var/db</filename> directory to store their 54 runtime data. Apply the following patch to make such programs store their 55 runtime data in the FHS-compliant locations:</para> 56 57 <screen><userinput remap="pre">patch -Np1 -i ../glibc-&glibc-version;-fhs-1.patch</userinput></screen> 58 46 59 <para>The Glibc documentation recommends building Glibc 47 60 in a dedicated build directory:</para> … … 53 66 54 67 <screen><userinput remap="configure">../configure \ 55 --prefix=/ tools\68 --prefix=/usr \ 56 69 --host=$LFS_TGT \ 57 70 --build=$(../scripts/config.guess) \ 58 71 --enable-kernel=&min-kernel; \ 59 --with-headers=/tools/include</userinput></screen> 72 --with-headers=$LFS/usr/include \ 73 libc_cv_slibdir=/lib</userinput></screen> 60 74 <!-- 61 75 libc_cv_forced_unwind=yes \ … … 69 83 <listitem> 70 84 <para>The combined effect of these switches is that Glibc's build system 71 configures itself to cross-compile, using the cross-linker and85 configures itself to be cross-compiled, using the cross-linker and 72 86 cross-compiler in <filename class="directory">/tools</filename>.</para> 73 87 </listitem> … … 84 98 85 99 <varlistentry> 86 <term><parameter>--with-headers= /tools/include</parameter></term>100 <term><parameter>--with-headers=$LFS/usr/include</parameter></term> 87 101 <listitem> 88 102 <para>This tells Glibc to compile itself against the headers recently 89 installed to the toolsdirectory, so that it knows exactly what103 installed to the usr/include directory, so that it knows exactly what 90 104 features the kernel has and can optimize itself accordingly.</para> 91 105 </listitem> 92 106 </varlistentry> 107 108 <varlistentry> 109 <term><parameter>libc_cv_slibdir=/lib</parameter></term> 110 <listitem> 111 <para>This ensures that the library is installed in /lib instead 112 of the default /lib64 on 64 bit machines.</para> 113 </listitem> 114 </varlistentry> 93 115 <!-- 94 <varlistentry>95 <term><parameter>libc_cv_forced_unwind=yes</parameter></term>96 <listitem>97 <para>The linker installed during98 <xref linkend="ch-tools-binutils-pass1"/> was cross-compiled and as99 such cannot be used until Glibc has been installed. This means that100 the configure test for force-unwind support will fail, as it relies on101 a working linker. The libc_cv_forced_unwind=yes variable is passed in102 order to inform <command>configure</command> that force-unwind103 support is available without it having to run the test.</para>104 </listitem>105 </varlistentry>106 116 <varlistentry> 107 117 <term><parameter>libc_cv_c_cleanup=yes</parameter></term> … … 112 122 </listitem> 113 123 </varlistentry> 114 --> 115 <!--<varlistentry>124 125 <varlistentry> 116 126 <term><parameter>libc_cv_ctors_header=yes</parameter></term> 117 127 <listitem> … … 148 158 <para>Install the package:</para> 149 159 150 <screen><userinput remap="install">make install</userinput></screen> 151 152 <caution> 153 <para>At this point, it is imperative to stop and ensure that the basic 154 functions (compiling and linking) of the new toolchain are working as 155 expected. To perform a sanity check, run the following commands:</para> 160 <screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen> 161 162 <variablelist> 163 <title>The meaning of the <command>make install</command> option:</title> 164 165 <varlistentry> 166 <term><parameter>DESTDIR=$LFS</parameter></term> 167 <listitem> 168 <para>The <envar>DESTDIR</envar> make variable is used by almost all 169 packages to define the location where the package should be 170 installed. If it is not set, it defaults to the root (<filename 171 class="directory">/</filename>) directory. Here we specify that 172 the package be installed in <filename class="directory">$LFS 173 </filename>, which will become the root after <xref linkend= 174 "ch-tools-chroot"/>.</para> 175 </listitem> 176 </varlistentry> 177 178 </variablelist> 179 180 <caution> 181 <para>At this point, it is imperative to stop and ensure that the basic 182 functions (compiling and linking) of the new toolchain are working as 183 expected. To perform a sanity check, run the following commands:</para> 156 184 157 185 <screen><userinput>echo 'int main(){}' > dummy.c 158 186 $LFS_TGT-gcc dummy.c 159 readelf -l a.out | grep ' : /tools'</userinput></screen>160 161 <para>If everything is working correctly, there should be no errors,162 and the output of the last command will be of the form:</para>163 164 <screen><computeroutput>[Requesting program interpreter: / tools/lib64/ld-linux-x86-64.so.2]</computeroutput></screen>165 166 <para>Note that for 32-bit machines, the interpreter name will be167 <filename>/tools/lib/ld-linux.so.2</filename>.</para>168 169 <para>If the output is not shown as above or there was no output at all,170 then something is wrong. Investigate and retrace the steps to find out171 where the problem is and correct it. This issue must be resolved before172 continuing on.</para>173 174 <para>Once all is well, clean up the test files:</para>187 readelf -l a.out | grep '/ld-linux'</userinput></screen> 188 189 <para>If everything is working correctly, there should be no errors, 190 and the output of the last command will be of the form:</para> 191 192 <screen><computeroutput>[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]</computeroutput></screen> 193 194 <para>Note that for 32-bit machines, the interpreter name will be 195 <filename>/lib/ld-linux.so.2</filename>.</para> 196 197 <para>If the output is not shown as above or there was no output at all, 198 then something is wrong. Investigate and retrace the steps to find out 199 where the problem is and correct it. This issue must be resolved before 200 continuing on.</para> 201 202 <para>Once all is well, clean up the test files:</para> 175 203 176 204 <screen><userinput>rm -v dummy.c a.out</userinput></screen> 177 205 178 </caution> 179 180 <note><para>Building Binutils in the section after next will serve as an 181 additional check that the toolchain has been built properly. If Binutils 182 fails to build, it is an indication that something has gone wrong with the 183 previous Binutils, GCC, or Glibc installations.</para></note> 206 </caution> 207 208 <note><para>Building packages in the next sections will serve as an 209 additional check that the toolchain has been built properly. If some 210 package, especially binutils-pass2 or gcc-pass2, fails to build, it is 211 an indication that something has gone wrong with the 212 previous Binutils, GCC, or Glibc installations.</para></note> 213 214 <para>Now that our cross-toolchain is complete, finalize the installation 215 of the limits.h header. For doing so, run an utility provided by the GCC 216 developers:</para> 217 218 <screen><userinput>$LFS/tools/libexec/gcc/$LFS_TGT/&gcc-version;/install-tools/mkheaders</userinput></screen> 184 219 185 220 </sect2>
Note:
See TracChangeset
for help on using the changeset viewer.