Changeset 70957a40 for introduction/important
- Timestamp:
- 08/21/2022 11:49:45 AM (20 months ago)
- Branches:
- 11.2, 11.3, 12.0, 12.1, kea, ken/TL2024, ken/inkscape-core-mods, ken/tuningfonts, lazarus, lxqt, plabs/newcss, plabs/python-mods, python3.11, qt5new, rahul/power-profiles-daemon, renodr/vulkan-addition, trunk, xry111/llvm18, xry111/soup3, xry111/xf86-video-removal
- Children:
- 7f17762
- Parents:
- cf6ee3d9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
introduction/important/building-notes.xml
rcf6ee3d9 r70957a40 496 496 </sect2> 497 497 498 <!-- Commented out because it's wrong and known to destroy system499 EVEN IF you followed the <warning> below!500 498 <sect2 id="stripping"> 501 499 <title>Stripping One More Time</title> 502 500 503 <warning>504 <para>If you did not strip programs and libraries in LFS,505 the following will probably make your system unusable. To avoid that,506 run the instructions at <ulink url="&lfs-root;/chapter08/stripping.html"/>507 instead. After the critical files are stripped using those instructions,508 the instructions below can be run any time new packages are installed.509 </para>510 </warning>511 512 501 <para> 513 502 In LFS, stripping of debugging symbols was discussed a couple of 514 503 times. When building BLFS packages, there are generally no special 515 instructions that discuss stripping again. It is probably not a good 516 idea to strip an executable or a library while it is in use, so exiting 517 any windowing environment is a good idea. Then you can do: 518 </para> 519 520 <screen><userinput>find /usr/{bin,lib,sbin} \ 521 -type f \( -name \*.so* -a ! -name \*dbg \) \ 522 -exec strip - -strip-unneeded {} \;</userinput></screen> 504 instructions that discuss stripping again. Stripping can be done 505 while installing a package, or afterwards. 506 </para> 507 508 <bridgehead renderas="sect3" id="stripping-install">Stripping while Installing a Package</bridgehead> 509 510 <para> 511 There are several ways to strip executables installed by a 512 package. They depend on the build system used (see below <link 513 linkend="buildsystems">the section about build systems</link>), 514 so only some 515 generalities can be listed here: 516 </para> 517 518 <itemizedlist> 519 <listitem> 520 <para> 521 The packages using autotools usually have an 522 <parameter>install-strip</parameter> target in their generated 523 <filename>Makefile</filename> files. So installing stripped 524 executables is just a matter of using 525 <command>make install-strip</command> instead of 526 <command>make install</command>. 527 </para> 528 </listitem> 529 <listitem> 530 <para> 531 The packages using the meson build system can accept 532 <parameter>-Dstrip=true</parameter> when running 533 <command>meson</command>. 534 </para> 535 </listitem> 536 <listitem> 537 <para> 538 <command>cmake</command> generates 539 <parameter>install/strip</parameter> targets for both the 540 <parameter>Unix Makefiles</parameter> and 541 <parameter>Ninja</parameter> generators (the default is 542 <parameter>Unix Makefiles</parameter> on linux). So just run 543 <command>make install/strip</command> or 544 <command>ninja install/strip</command> instead of the 545 <command>install</command> counterparts. 546 </para> 547 </listitem> 548 <listitem> 549 <para> 550 Removing (or not generating) debug symbols can also be 551 achieved by removing the 552 <parameter>-g<something></parameter> options 553 in C/C++ calls. How to do that is very specific for each 554 package, so it will not be developed here. See also below 555 the paragraphs about optimization. 556 </para> 557 </listitem> 558 </itemizedlist> 559 560 <bridgehead renderas="sect3" id="stripping-installed">Stripping Installed Executables</bridgehead> 561 562 <para> 563 The <command>strip</command> utility changes files in place, which 564 may break anything using it if it is loaded in memory. Note that 565 if a file is in use but just removed from the disk (i.e. not overwritten 566 nor modified), this is not a problem since the kernel can use 567 <quote>deleted</quote> files. 568 Look at <filename>/proc/*/maps</filename>, and it is likely that 569 you'll see some <emphasis>(deleted)</emphasis> entries. The 570 <command>mv</command> just removes the destination file from the 571 directory but does not touch its content, so that it satisfies the 572 condition for the kernel to use the old (deleted) file. The script 573 below is just an example. Feel free to add stronger error detection, 574 other directories to scan, ... It should be run as the &root; user: 575 </para> 576 577 <screen role="root"><userinput>{ find /usr/lib -type f \( -name \*.a -o \ 578 \( -name \*.so* ! -name \*dbg \) \) 579 find /usr/{bin,sbin,libexec} -type f; } | while read file; do 580 if readelf -h $file >/dev/null 2>&1; then 581 cp -a $file ${file}.tmp && 582 strip --strip-unneeded ${file}.tmp && 583 mv ${file}.tmp $file 584 fi 585 done</userinput></screen> 523 586 524 587 <para> … … 535 598 536 599 </sect2> 537 --> 600 538 601 <!-- 539 602 <sect2 id="libtool">
Note:
See TracChangeset
for help on using the changeset viewer.