Changeset 6dfcfecc for chapter08/glibc.xml
- Timestamp:
- 03/31/2021 10:41:39 AM (3 years ago)
- Branches:
- ml-11.0, multilib
- Children:
- 7610848
- Parents:
- 811b5a39
- git-author:
- Thomas Trepl <thomas@…> (06/29/2020 07:55:01 AM)
- git-committer:
- Xℹ Ruoyao <xry111@…> (03/31/2021 10:41:39 AM)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
chapter08/glibc.xml
r811b5a39 r6dfcfecc 34 34 35 35 <seglistitem> 36 <seg>&glibc- ch6-sbu;</seg>37 <seg>&glibc- ch6-du;</seg>36 <seg>&glibc-fin-sbu;</seg> 37 <seg>&glibc-fin-du;</seg> 38 38 </seglistitem> 39 39 </segmentedlist> … … 43 43 <sect2 role="installation"> 44 44 <title>Installation of Glibc</title> 45 46 <note><para>The Glibc build system is self-contained and will install47 perfectly, even though the compiler specs file and linker are still48 pointing to <filename class="directory">/tools</filename>. The specs49 and linker cannot be adjusted before the Glibc install because the50 Glibc autoconf tests would give false results and defeat the goal51 of achieving a clean build.</para></note>52 45 53 46 <para>Some of the Glibc programs use the non-FHS compliant … … 57 50 58 51 <screen><userinput remap="pre">patch -Np1 -i ../&glibc-fhs-patch;</userinput></screen> 59 <!-- 60 <para>Fix a minor security issue with glob functions:</para> 61 62 <screen><userinput remap="pre">patch -Np1 -i ../&glibc-glob-patch;</userinput></screen> 63 --> 64 <!-- No longer needed 65 <para>Fix a problem introduced with the linux-5.2 kernel:</para> 66 67 <screen><userinput remap="pre">sed -i '/asm.socket.h/a# include <linux/sockios.h>' \ 68 sysdeps/unix/sysv/linux/bits/socket.h</userinput></screen> 69 --> 70 <para>Create a symlink for LSB 71 compliance. Additionally, for x86_64, create a compatibility symlink 72 required for the dynamic loader to function correctly:</para> 73 74 <screen><userinput remap="pre">case $(uname -m) in 75 i?86) ln -sfv ld-linux.so.2 /lib/ld-lsb.so.3 76 ;; 77 x86_64) ln -sfv ../lib/ld-linux-x86-64.so.2 /lib64 78 ln -sfv ../lib/ld-linux-x86-64.so.2 /lib64/ld-lsb-x86-64.so.3 79 ;; 80 esac</userinput></screen> 81 <!-- 82 <para>Remove a file that may be left over from a previous build attempt: 83 </para> 84 85 <screen><userinput remap="pre">rm -f /usr/include/limits.h</userinput></screen> 86 --> 52 87 53 <para>The Glibc documentation recommends building Glibc 88 54 in a dedicated build directory:</para> … … 93 59 <para>Prepare Glibc for compilation:</para> 94 60 95 <screen><userinput remap="configure">CC="gcc -ffile-prefix-map=/tools=/usr" \ 96 ../configure --prefix=/usr \ 97 --disable-werror \ 98 --enable-kernel=&min-kernel; \ 99 --enable-stack-protector=strong \ 100 --with-headers=/usr/include \ 61 <screen arch="default"><userinput remap="configure">../configure --prefix=/usr \ 62 --disable-werror \ 63 --enable-kernel=&min-kernel; \ 64 --enable-stack-protector=strong \ 65 --with-headers=/usr/include \ 101 66 libc_cv_slibdir=/lib</userinput></screen> 102 103 <variablelist> 104 <title>The meaning of the options and new configure parameters:</title> 105 106 <varlistentry> 107 <term><parameter>CC="gcc -ffile-prefix-map=/tools=/usr"</parameter></term> 108 <listitem> 109 <para>Make GCC record any references to files in /tools in result 110 of the compilation as if the files resided in /usr. This avoids 111 introduction of invalid paths in debugging symbols.</para> 112 </listitem> 113 </varlistentry> 67 <screen arch="ml_32,ml_x32,ml_all"><userinput remap="configure">../configure --prefix=/usr \ 68 --disable-werror \ 69 --enable-kernel=&min-kernel; \ 70 --enable-stack-protector=strong \ 71 --with-headers=/usr/include \ 72 --enable-multi-arch \ 73 libc_cv_slibdir=/lib</userinput></screen> 74 75 <variablelist> 76 <title>The meaning of the configure options:</title> 114 77 115 78 <varlistentry> … … 118 81 <para>This option disables the -Werror option passed to 119 82 GCC. This is necessary for running the test suite.</para> 83 </listitem> 84 </varlistentry> 85 86 <varlistentry> 87 <term><parameter>--enable-kernel=&min-kernel;</parameter></term> 88 <listitem> 89 <para>This option tells the build system that this glibc may 90 be used with kernels as old as &min-kernel;. This means generating 91 workarounds in case a system call introduced in a later version 92 cannot be used.</para> 120 93 </listitem> 121 94 </varlistentry> … … 129 102 </listitem> 130 103 </varlistentry> 131 104 <!-- do we need this one? --> 132 105 <varlistentry> 133 106 <term><parameter>--with-headers=/usr/include</parameter></term> 134 107 <listitem> 135 108 <para>This option tells the build system where to find the 136 kernel API headers. By default, those headers are sought in 137 <filename class="directory">/tools/include</filename>.</para> 109 kernel API headers.</para> 138 110 </listitem> 139 111 </varlistentry> … … 183 155 is known to fail in the LFS chroot environment.</para> 184 156 </listitem> 185 157 <!-- 186 158 <listitem> 187 159 <para><emphasis>inet/tst-idna_name_classify</emphasis> … … 194 166 may fail on some architectures.</para> 195 167 </listitem> 196 168 --> 197 169 <listitem> 198 170 <para>The <emphasis>nss/tst-nss-files-hosts-multi</emphasis> … … 213 185 AMD processor.</para> 214 186 </listitem> 215 <!-- 216 <listitem> 217 <para>The 218 <emphasis>nptl/tst-thread-affinity-{pthread,pthread2,sched}</emphasis> 219 tests may fail for reasons that have not been determined. </para> 220 </listitem> 221 222 <listitem> 223 <para>Other tests known to fail on some architectures are 224 malloc/tst-malloc-usable and nptl/tst-cleanupx4. </para> 225 </listitem> 226 --> 187 227 188 </itemizedlist> 228 189 … … 389 350 <term><parameter>zic -L /dev/null ...</parameter></term> 390 351 <listitem> 391 <para>This creates posix time zones ,without any leap seconds. It is352 <para>This creates posix time zones without any leap seconds. It is 392 353 conventional to put these in both 393 354 <filename class="directory">zoneinfo</filename> and … … 397 358 test-suites will report errors. On an embedded system, where space is 398 359 tight and you do not intend to ever update the time zones, you could save 399 1.9 MB by not using the <filename class="directory">posix</filename>360 1.9 MB by not using the <filename class="directory">posix</filename> 400 361 directory, but some applications or test-suites might produce some 401 362 failures.</para> … … 477 438 EOF</userinput></screen> 478 439 479 <para arch="default">If desired, the dynamic loader can also search a directory and440 <para>If desired, the dynamic loader can also search a directory and 480 441 include the contents of files found there. Generally the files in 481 442 this include directory are one line specifying the desired library path. 482 443 To add this capability run the following commands:</para> 483 444 484 <screen role="nodump" arch="default"><userinput>cat >> /etc/ld.so.conf << "EOF"445 <screen role="nodump"><userinput>cat >> /etc/ld.so.conf << "EOF" 485 446 <literal># Add an include directory 486 447 include /etc/ld.so.conf.d/*.conf … … 489 450 mkdir -pv /etc/ld.so.conf.d</userinput></screen> 490 451 491 <para arch="ml_32,ml_x32,ml_all">The dynamic loader can also search a directory and492 include the contents of files found there. Generally the files in493 this include directory are one line specifying the desired library path.494 To add this capability run the following commands:</para>495 <screen arch="ml_32,ml_x32,ml_all"><userinput>cat >> /etc/ld.so.conf << "EOF"496 <literal># Add an include directory497 include /etc/ld.so.conf.d/*.conf498 </literal>499 EOF500 mkdir -pv /etc/ld.so.conf.d</userinput></screen>501 502 452 </sect3> 503 453 </sect2> 454 455 <!-- - - - - - - - - - --> 456 <!-- Multilib - 32bit --> 457 <!-- - - - - - - - - - --> 458 <sect2 arch="ml_32,ml_all"> 459 <title>Building Glibc - 32bit</title> 460 461 <para>Now recompile for m32. The extracted source can be 462 reused but needs to cleaned before installing the m32 463 version of Glibc.</para> 464 465 <para>Clear the build directory and remove artefacts from 466 previous build:</para> 467 468 <screen><userinput remap="pre">rm -rf ./* 469 find .. -name "*.a" -delete</userinput></screen> 470 471 <para>Configure Glibc for m32 with the following commands:</para> 472 473 <screen><userinput remap="configure">CC="gcc -m32" CXX="g++ -m32" \ 474 ../configure \ 475 --prefix=/usr \ 476 --host=i686-pc-linux-gnu \ 477 --build=$(../scripts/config.guess) \ 478 --enable-kernel=&min-kernel; \ 479 --with-headers=/usr/include \ 480 --enable-multi-arch \ 481 --libdir=&usr-lib-m32; \ 482 --libexecdir=&usr-lib-m32; \ 483 libc_cv_slibdir=&lib-m32;</userinput></screen> 484 485 <para>Compile the package:</para> 486 487 <screen><userinput remap="make">make</userinput></screen> 488 489 <para>Install the package:</para> 490 491 <screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install 492 cp -a DESTDIR&lib-m32;/* &lib-m32;/ 493 cp -a DESTDIR&usr-lib-m32;/* &usr-lib-m32;/ 494 install -vm644 DESTDIR/usr/include/gnu/{lib-names,stubs}-32.h \ 495 /usr/include/gnu/ 496 ln -svf ..&lib-m32;/ld-linux.so.2 /lib/ld-linux.so.2</userinput></screen> 497 498 <para>Add the library name to the dynamic loader config:</para> 499 500 <screen role="install"><userinput>echo "&usr-lib-m32;" >> /etc/ld.so.conf</userinput></screen> 501 502 <caution> 503 <para>At this point, it is imperative to stop and ensure that the basic 504 functions (compiling and linking) of the new toolchain are working as 505 expected. To perform a sanity check, run the following commands:</para> 506 507 <screen><userinput>echo 'int main(){}' > dummy.c 508 gcc -m32 dummy.c 509 readelf -l a.out | grep '/ld-linux'</userinput></screen> 510 511 <para>If everything is working correctly, there should be no errors, 512 and the output of the last command will be of the form:</para> 513 514 <screen><computeroutput>[Requesting program interpreter: /lib/ld-linux.so.2]</computeroutput></screen> 515 516 <para>If the output is not shown as above or there was no output at all, 517 then something is wrong. Investigate and retrace the steps to find out 518 where the problem is and correct it. This issue must be resolved before 519 continuing on.</para> 520 521 <para>Once all is well, clean up the test files:</para> 522 523 <screen><userinput>rm -v dummy.c a.out</userinput></screen> 524 525 </caution> 526 527 </sect2><!-- m32 --> 528 529 <!-- - - - - - - - - - --> 530 <!-- Multilib - x32bit --> 531 <!-- - - - - - - - - - --> 532 533 <sect2 arch="ml_x32,ml_all"> 534 <title>Building Glibc - x32bit</title> 535 536 <para>Now recompile for mx32. The extracted source can be 537 reused but needs to cleaned before installing the mx32 538 version of Glibc.</para> 539 540 <para>Clear the build directory and remove artefacts from 541 previous build:</para> 542 543 <screen><userinput remap="pre">rm -rf ./* 544 find .. -name "*.a" -delete</userinput></screen> 545 546 <para>Configure Glibc for mx32 with the following commands:</para> 547 548 <screen><userinput remap="configure">CC="gcc -mx32" CXX="g++ -mx32" \ 549 ../configure \ 550 --prefix=/usr \ 551 --host=x86_64-pc-linux-gnux32 \ 552 --build=$(../scripts/config.guess) \ 553 --enable-kernel=&min-kernel; \ 554 --with-headers=$LFS/usr/include \ 555 --enable-multi-arch \ 556 --libdir=&usr-lib-mx32; \ 557 --libexecdir=&usr-lib-mx32; \ 558 libc_cv_slibdir=&lib-mx32;</userinput></screen> 559 560 <para>Compile the package:</para> 561 562 <screen><userinput remap="make">make</userinput></screen> 563 564 <para>Install the package:</para> 565 566 <screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install 567 cp -a DESTDIR&lib-mx32;/* &lib-mx32;/ 568 cp -a DESTDIR&usr-lib-mx32;/* &usr-lib-mx32;/ 569 install -vm644 DESTDIR/usr/include/gnu/{lib-names,stubs}-x32.h \ 570 /usr/include/gnu/ 571 ln -svf ..&lib-mx32;/ld-linux-x32.so.2 /lib/ld-linux-x32.so.2</userinput></screen> 572 573 <para>Add the library name to the dynamic loader config:</para> 574 575 <screen role="install"><userinput>echo "&usr-lib-mx32;" >> /etc/ld.so.conf</userinput></screen> 576 577 <caution> 578 <para>At this point, it is imperative to stop and ensure that the basic 579 functions (compiling and linking) of the new toolchain are working as 580 expected. To perform a sanity check, run the following commands:</para> 581 582 <screen><userinput>echo 'int main(){}' > dummy.c 583 gcc -mx32 dummy.c 584 readelf -l a.out | grep '/ld-linux-x32'</userinput></screen> 585 586 <para>If everything is working correctly, there should be no errors, 587 and the output of the last command will be of the form:</para> 588 589 <screen><computeroutput>[Requesting program interpreter: /lib/ld-linux-x32.so.2]</computeroutput></screen> 590 591 <para>If the output is not shown as above or there was no output at all, 592 then something is wrong. Investigate and retrace the steps to find out 593 where the problem is and correct it. This issue must be resolved before 594 continuing on.</para> 595 596 <para>Once all is well, clean up the test files:</para> 597 598 <screen><userinput>rm -v dummy.c a.out</userinput></screen> 599 600 </caution> 601 602 </sect2><!-- mx32 --> 504 603 505 604 <sect2 id="contents-glibc" role="content">
Note:
See TracChangeset
for help on using the changeset viewer.