Changeset 6e41459 for chapter05/adjusting.xml
- Timestamp:
- 08/08/2004 02:10:39 AM (20 years ago)
- Branches:
- 6.0
- Children:
- ef13657
- Parents:
- 78349b7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
chapter05/adjusting.xml
r78349b7 r6e41459 9 9 10 10 <para>Now that the temporary C libraries have been installed, all 11 t he tools compiled in the rest of this chapter should be linked against these12 libraries. In order to accomplish this, the linker and the compiler's 13 specs file, need to be adjsted.</para>11 tools compiled in the rest of this chapter should be linked against 12 these libraries. In order to accomplish this, the linker and the 13 compiler's specs file need to be adjusted.</para> 14 14 15 <para> Some people would say that there is <emphasis><quote>black magic juju 16 below this line</quote></emphasis>, but it is really very simple.</para> 17 18 <para>First, the linker, adjusted at the end of the first pass of Binutils, is 19 installed by running the following command from within 20 the <filename class="directory">binutils-build</filename> directory:</para> 15 <para>The linker, adjusted at the end of the first pass of Binutils, 16 is installed by running the following command from within the 17 <filename class="directory">binutils-build</filename> directory:</para> 21 18 22 19 <screen><userinput>make -C ld install</userinput></screen> 23 20 24 <para>From this point onwards everything will link <emphasis>only</emphasis>21 <para>From this point onwards, everything will link only 25 22 against the libraries in <filename class="directory">/tools/lib</filename>.</para> 26 23 27 <note><para>If you missed the earlier warning to retain the Binutils28 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 30 testing programs linking against libraries on the host. This is not ideal, but 31 it's not a major problem. The situation is corrected when the second pass of 32 Binutils is installed later on.</para></note>24 <note><para>If the earlier warning to retain the Binutils source and 25 build directories from the first pass was missed, ignore the above 26 command. This results in a small chance that the subsequent testing 27 programs will link against libraries on the host. This is not ideal, 28 but it is not a major problem. The situation is corrected when the 29 second pass of Binutils is installed later.</para></note> 33 30 34 31 <para>Now that the adjusted linker is installed, the Binutils build and source 35 directories should be <emphasis>removed</emphasis>.</para>32 directories should be removed.</para> 36 33 37 34 <para>The next task is to amend our GCC specs file so that it points … … 46 43 unset SPECFILE</userinput></screen> 47 44 48 <para>It is recommended that the above command be cut-and-pasted in order to49 ensure correctness - Alternatively, the specs file can be edited by hand. This 50 is done simplyby replacing every occurrence of51 <quote>/lib/ld-linux.so.2</quote> with <quote>/tools/lib/ld-linux.so.2</quote>.52 < /para>45 <para>It is recommended that the above command be cut-and-pasted in 46 order to ensure correctness. Alternatively, the specs file can be 47 edited by hand. This is done by replacing every occurrence of 48 <quote>/lib/ld-linux.so.2</quote> with 49 <quote>/tools/lib/ld-linux.so.2</quote>.</para> 53 50 54 <para> Be sure to visually inspect the specs file in order to verify the intended changes have been made.</para> 51 <para>Be sure to visually inspect the specs file in order to verify the 52 intended changes have been made.</para> 55 53 56 <important><para>If you are working on a platform where the name of the dynamic 57 linker is something other than <filename>ld-linux.so.2</filename>, you 58 <emphasis>must</emphasis> replace <filename>ld-linux.so.2</filename> with the 59 name of your platform's dynamic linker in the above commands. Refer back to 60 <xref linkend="ch-tools-toolchaintechnotes"/> if necessary.</para></important> 54 <important><para>If working on a platform where the name of the 55 dynamic linker is something other than 56 <filename>ld-linux.so.2</filename>, replace 57 <filename>ld-linux.so.2</filename> with the name of the platform's 58 dynamic linker in the above commands. Refer back to <xref 59 linkend="ch-tools-toolchaintechnotes"/> if 60 necessary.</para></important> 61 61 62 <para>Lastly, there is a possibility that some include files from the host 63 system have found their way into GCC's private include dir. This can happen 64 as a result of of GCC's <quote>fixincludes</quote> process which runs as part 65 of the GCC build. We'll explain more about this further on in this chapter. 66 Run the following commands to eliminate this possibility:</para> 62 <para>There is a possibility that some include files from the host 63 system have found their way into GCC's private include dir. This can 64 happen as a result of GCC's <quote>fixincludes</quote> process, which runs as part 65 of the GCC build. This is explained in more detail later in this 66 chapter. Run the following command to eliminate this 67 possibility:</para> 67 68 68 69 <screen><userinput>rm -f /tools/lib/gcc/*/*/include/{pthread.h,bits/sigthread.h}</userinput></screen> 69 70 70 71 <caution><para>It is imperative at this point to stop and ensure that the basic 72 functions (compiling and linking) of the new toolchain are working as expected. 73 To perform a simple sanity check, run the followingcommands:</para>71 <caution><para>At this point, it is imperative to stop and ensure that 72 the basic functions (compiling and linking) of the new toolchain are 73 working as expected. To perform a sanity check, run the following 74 commands:</para> 74 75 75 76 <screen><userinput>echo 'main(){}' > dummy.c … … 77 78 readelf -l a.out | grep ': /tools'</userinput></screen> 78 79 79 <para>If everything is working correctly, there should be no errors, and the80 output of the last command will be of the form:</para>80 <para>If everything is working correctly, there should be no errors, 81 and the output of the last command will be of the form:</para> 81 82 82 83 <blockquote><screen><computeroutput>[Requesting program interpreter: /tools/lib/ld-linux.so.2]</computeroutput></screen></blockquote> 83 84 84 85 <para>Note especially that <filename class="directory">/tools/lib</filename> 85 appears as the prefix of ourdynamic linker.</para>86 appears as the prefix of the dynamic linker.</para> 86 87 87 <para>If the output is not 88 as shown above, or there was no output at all, then something is seriously 89 wrong. You will need to investigate and retrace your steps to find out where the 90 problem is and correct it. There is no point in continuing until this is done. 91 First, perform the sanity check again, using <command>gcc</command> instead of 92 <command>cc</command>. If this works, then the 93 <filename class="symlink">/tools/bin/cc</filename> symlink is missing. Revisit 94 <xref linkend="ch-tools-gcc-pass1"/> and install the symlink. Second, ensure your PATH 95 is correct. You can check this by running <userinput>echo $PATH</userinput> and 96 verifying that <filename class="directory">/tools/bin</filename> is at the head 97 of the list. If the PATH is wrong it could mean you're not logged in as user 98 <emphasis>lfs</emphasis> or something went wrong back in 99 <xref linkend="ch-tools-settingenviron"/>. Third, something may have gone wrong with 100 the specs file amendment above. In this case redo the specs file amendment 101 being careful to cut-and-paste the commands.</para> 88 <para>If the output is not shown as above or there was no output at 89 all, then something is wrong. Investigate and retrace the steps to 90 find out where the problem is and correct it. This issue must be 91 resolved before continuing on. First, perform the sanity check again, 92 using <command>gcc</command> instead of <command>cc</command>. If this 93 works, then the <filename>/tools/bin/cc</filename> symlink is missing. 94 Revisit <xref linkend="ch-tools-gcc-pass1"/> and install the symlink. 95 Next, ensure that the PATH is correct. This can be checked by running 96 <command>echo $PATH</command> and verifying that <filename 97 class="directory">/tools/bin</filename> is at the head of the list. If 98 the PATH is wrong it could mean that you are not logged in as user 99 <emphasis>lfs</emphasis> or that something went wrong back in <xref 100 linkend="ch-tools-settingenviron"/> Another option is that something 101 may have gone wrong with the specs file amendment above. In this case, 102 redo the specs file amendment, being careful to cut-and-paste the 103 commands.</para> 102 104 103 <para>Once you are satisfied thatall is well, clean up the test files:</para>105 <para>Once all is well, clean up the test files:</para> 104 106 105 107 <screen><userinput>rm dummy.c a.out</userinput></screen> 106 108 </caution> 107 109 110 </sect1> 108 111 109 </sect1>
Note:
See TracChangeset
for help on using the changeset viewer.