source: chapter05/adjusting.xml@ 3d56263

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 7.8 7.9 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 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
Last change on this file since 3d56263 was 3d56263, checked in by Bruce Dubbs <bdubbs@…>, 9 years ago

Fix a warning when doing test compiles.

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

  • Property mode set to 100644
File size: 3.6 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
4 <!ENTITY % general-entities SYSTEM "../general.ent">
5 %general-entities;
6]>
7
8<sect1 id="ch-tools-adjusting">
9 <?dbhtml filename="adjusting.html"?>
10
11 <title>Adjusting the Toolchain</title>
12
13 <para>Now that the temporary C libraries have been installed, all
14 tools compiled in the rest of this chapter should be linked against
15 these libraries. In order to accomplish this, the cross-compiler's
16 specs file needs to be adjusted to point to the new dynamic linker
17 in <filename class="directory">/tools</filename>.</para>
18
19 <para>This is done by dumping the compiler's <quote>specs</quote> file to a
20 location where it will look for it by default.
21 A simple <command>sed</command> substitution then alters the
22 dynamic linker that GCC will use. The principle here is to find all references
23 to the dynamic linker file in <filename class="directory">/lib</filename>
24 or possibly <filename class="directory">/lib64</filename> if the host system
25 is 64-bit capable, and adjust them to point to the new location in
26 <filename class="directory">/tools</filename>.</para>
27
28 <para>For the sake of accuracy, it is recommended to use a copy-and-paste
29 method when issuing the following command. Be sure to visually inspect the
30 specs file to verify that it has properly adjusted all references to the
31 dynamic linker location. Refer to <xref
32 linkend="ch-tools-toolchaintechnotes" role=","/> for the default name
33 of the dynamic linker, if necessary.</para>
34
35<!-- Ampersands are needed to allow copy and paste -->
36<screen><userinput>SPECS=`dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/specs
37$LFS_TGT-gcc -dumpspecs | sed \
38 -e 's@/lib\(64\)\?/ld@/tools&amp;@g' \
39 -e "/^\*cpp:$/{n;s,$, -isystem /tools/include,}" &gt; $SPECS
40echo "New specs file is: $SPECS"
41unset SPECS</userinput></screen>
42
43 <caution>
44 <para>At this point, it is imperative to stop and ensure that the basic
45 functions (compiling and linking) of the new toolchain are working as
46 expected. To perform a sanity check, run the following commands:</para>
47
48<screen><userinput>echo 'int main(){}' &gt; dummy.c
49$LFS_TGT-gcc -B/tools/lib dummy.c
50readelf -l a.out | grep ': /tools'</userinput></screen>
51
52 <para>If everything is working correctly, there should be no errors,
53 and the output of the last command will be of the form:</para>
54
55<screen><computeroutput>[Requesting program interpreter: /tools/lib/ld-linux.so.2]</computeroutput></screen>
56
57 <para>Note that <filename class="directory">/tools/lib</filename>, or
58 <filename class="directory">/tools/lib64</filename> for 64-bit machines
59 appears as the prefix of the dynamic linker.</para>
60
61 <para>If the output is not shown as above or there was no output at all,
62 then something is wrong. Investigate and retrace the steps to find out
63 where the problem is and correct it. This issue must be resolved before
64 continuing on. Something may have gone wrong with the
65 specs file amendment above. In this case, redo the specs file amendment,
66 being careful to copy-and-paste the commands.</para>
67
68 <para>Once all is well, clean up the test files:</para>
69
70<screen><userinput>rm -v dummy.c a.out</userinput></screen>
71
72 </caution>
73
74 <note><para>Building Binutils in the next section will serve as an additional check that
75 the toolchain has been built properly. If Binutils fails to build, it is an
76 indication that something has gone wrong with the previous Binutils, GCC, or Glibc
77 installations.</para></note>
78
79</sect1>
Note: See TracBrowser for help on using the repository browser.