- Timestamp:
- 06/01/2004 09:43:10 PM (20 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, 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, 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:
- 0078c4c
- Parents:
- fd37ef0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
chapter05/adjusting.xml
rfd37ef0 rf904a87 8 8 <?dbhtml filename="adjusting.html"?> 9 9 10 <para>Now that the temporary C libraries have been installed, we want all 11 the tools compiled in the rest of this chapter to be linked against these 12 libraries. To accomplish this, we need to adjust the linker and the compiler's 13 specs file. Some people would say that it is <emphasis><quote>black magic juju 10 <para>Now that the temporary C libraries have been installed, all 11 the tools compiled in the rest of this chapter should be linked against these 12 libraries. In order to accomplish this the linker, and the compiler's 13 specs file, need to be adjsted.</para> 14 15 <para> Some people would say that there is <emphasis><quote>black magic juju 14 16 below this line</quote></emphasis>, but it is really very simple.</para> 15 17 16 <para>First install the adjusted linker(adjusted at the end of the first pass17 of Binutils) by running the following command from within18 <para>First the adjusted linker is installed (adjusted at the end of the first pass 19 of Binutils), by running the following command from within 18 20 the <filename class="directory">binutils-build</filename> directory:</para> 19 21 … … 23 25 against the libraries in <filename class="directory">/tools/lib</filename>.</para> 24 26 25 <note><para>If you somehow missed the earlier warning to retain the Binutils 26 source and build directories from the first pass or otherwise accidentally 27 deleted them or just don't have access to them, don't worry, all is not lost. 28 Just ignore the above command. The result is a small chance of the subsequent 27 <note><para>If you missed the earlier warning to retain the Binutils 28 source and build directories from the first pass, dont worry - all is not lost. 29 Just ignore the above command. This results in a small chance of the subsequent 29 30 testing programs linking against libraries on the host. This is not ideal, but 30 it's not a major problem. The situation is corrected when we install the31 second pass of Binutils a bit further on.</para></note>31 it's not a major problem. The situation is corrected when the second pass of 32 Binutils is installed later on.</para></note> 32 33 33 <para>Now that the adjusted linker is installed, you have to34 <emphasis>remove</emphasis> the Binutils build and source directories.</para>34 <para>Now that the adjusted linker is installed, the Binutils build and source 35 direcotries should be <emphasis>removed</emphasis>.</para> 35 36 36 <para>The next t hing to dois to amend our GCC specs file so that it points37 to the new dynamic linker. A simple sed will accomplish this:</para>37 <para>The next task is to amend our GCC specs file so that it points 38 to the new dynamic linker. A simple sed script will accomplish this:</para> 38 39 39 40 <!-- Ampersands are needed to allow cut and paste --> … … 45 46 unset SPECFILE</userinput></screen> 46 47 47 <para>We recommend that you cut-and-paste the above rather than try and type it 48 all in. Or you can edit the specs file by hand if you want to: just replace the 49 occurrence of <quote>/lib/ld-linux.so.2</quote> with 50 <quote>/tools/lib/ld-linux.so.2</quote>. Be sure to visually inspect the specs 51 file to verify the intended change was actually made.</para> 48 <para>It is recommended that the above command be cut-and-pasted in order to ensure correctness - Alternatively the specs file can be edited by hand. This is done simply by replacing every occurrence of <quote>/lib/ld-linux.so.2</quote> with <quote>/tools/lib/ld-linux.so.2</quote>.</para> 49 50 <para> Be sure to visually inspect the specs file in order to verify the intended changes have been mande.</para> 52 51 53 52 <important><para>If you are working on a platform where the name of the dynamic … … 59 58 <para>Lastly, there is a possibility that some include files from the host 60 59 system have found their way into GCC's private include dir. This can happen 61 because of GCC's <quote>fixincludes</quote> process which runs as part of the 62 GCC build. We'll explain more about this further on in this chapter. For now, 63 run the following commands to eliminate this possibility:</para>60 as a result of of GCC's <quote>fixincludes</quote> process which runs as part 61 of the GCC build. We'll explain more about this further on in this chapter. 62 Run the following commands to eliminate this possibility:</para> 64 63 65 64 <screen><userinput>rm -f /tools/lib/gcc/*/*/include/{pthread.h,bits/sigthread.h}</userinput></screen> … … 68 67 <caution><para>It is imperative at this point to stop and ensure that the basic 69 68 functions (compiling and linking) of the new toolchain are working as expected. 70 For this we are going to perform a simple sanity check:</para>69 To perform a simple sanity check run the following commands:</para> 71 70 72 71 <screen><userinput>echo 'main(){}' > dummy.c … … 75 74 76 75 <para>If everything is working correctly, there should be no errors, and the 77 output of the last command will be (allowing for platform specific differences 78 in dynamic linker name):</para> 76 output of the last command will be of the form:</para> 79 77 80 78 <blockquote><screen><computeroutput>[Requesting program interpreter: /tools/lib/ld-linux.so.2]</computeroutput></screen></blockquote> … … 83 81 appears as the prefix of our dynamic linker.</para> 84 82 85 <para>If you did not receive the output86 as shown above, or received no output at all, then something is seriously wrong.87 You will need to investigate and retrace your steps to find out where the83 <para>If the output is not 84 as shown above, or there was no output at all, then something is seriously 85 wrong. You will need to investigate and retrace your steps to find out where the 88 86 problem is and correct it. There is no point in continuing until this is done. 89 First, redo the sanity checkusing <command>gcc</command> instead of90 <command>cc</command>. If this works it meansthe87 First, perform the sanity check again, using <command>gcc</command> instead of 88 <command>cc</command>. If this works then the 91 89 <filename class="symlink">/tools/bin/cc</filename> symlink is missing. Revisit 92 <xref linkend="ch-tools-gcc-pass1"/> and fixthe symlink. Second, ensure your PATH90 <xref linkend="ch-tools-gcc-pass1"/> and install the symlink. Second, ensure your PATH 93 91 is correct. You can check this by running <userinput>echo $PATH</userinput> and 94 92 verifying that <filename class="directory">/tools/bin</filename> is at the head … … 97 95 <xref linkend="ch-tools-settingenviron"/>. Third, something may have gone wrong with 98 96 the specs file amendment above. In this case redo the specs file amendment 99 ensuring to cut-and-paste the commands as was recommended.</para>97 being careful to cut-and-paste the commands.</para> 100 98 101 99 <para>Once you are satisfied that all is well, clean up the test files:</para>
Note:
See TracChangeset
for help on using the changeset viewer.