Hello Everyone As I mentioned in another thread, my intention is to re-add this method into the LFS book. I've done a test build using this, and everything works as expected. Using Greg's extended tests, we know for certain that binutils and gcc will be linking against the right Glibc in chapter 6.
There is a bug open to remove this feature from gcc. But, it is a year old now and still open. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19353 Our longtime Toolchain Maintainer, Ryan Oliver, still prefers to use this method. His comments are in the above bug link, as well. I'm inclined to follow his recommendations, if only because it's what is in our stable book and Cross-LFS. So we have consistency and a tried method. If GCC devs do ever decide to remove it and close that bug, then perhaps we can re-consider our options. I would at this time like to open this up to comments or suggestions before I apply the changes to trunk. If there is a major reason why we *shouldn't* use this feature of GCC, it should be brought up now. Attached is the patch I propose to the book. Note that I could also add (perhaps in the cleaning up section) to move the original ld files back in /tools so that if /tools wasn't kept or tarred up before, it's in a useful state. -- JH
Index: chapter06/gcc.xml =================================================================== --- chapter06/gcc.xml (revision 7307) +++ chapter06/gcc.xml (working copy) @@ -99,6 +99,11 @@ <screen><userinput>ln -sv ../usr/bin/cpp /lib</userinput></screen> +<para>Many packages use the name <command>cc</command> to call the C +compiler. To satisfy those packages, create a symlink:</para> + +<screen><userinput>ln -sv gcc /usr/bin/cc</userinput></screen> + <note><para>At this point, it is strongly recommended to repeat the sanity check performed earlier in this chapter. Refer back to <xref linkend="ch-system-readjusting" role=","/> and repeat the check. If the results Index: chapter06/readjusting.xml =================================================================== --- chapter06/readjusting.xml (revision 7308) +++ chapter06/readjusting.xml (working copy) @@ -19,18 +19,24 @@ directory to the LFS <filename class="directory">/{,usr/}lib</filename> directories.</para> -<para>First, create a symlink to the adjusted linker we created in chapter 5.</para> +<para>First, backup the <filename class="directory">/tools</filename> linker, and +replace it with the adjusted linker we made in chapter 5. We'll also create a +hard link to its counterpart in <filename class="directory">/tools/$MACHTYPE/bin</filename></para> -<screen><userinput>ln -sv /tools/bin/ld-new /usr/bin/ld</userinput></screen> +<screen><userinput>mv -v /tools/bin/{ld,ld-old} +mv -v /tools/$MACHTYPE/bin/{ld,ld-old} +mv -v /tools/bin{ld-new,ld} +ln -v /tools/bin/ld /tools/$MACHTYPE/bin/ld</userinput></screen> <para>Next, amend the GCC specs file so that it points to the new -dynamic linker. A <command>sed</command> command accomplishes this:</para> +dynamic linker, and so that GCC knows where to find its start files. +A <command>perl</command> command accomplishes this:</para> -<screen><userinput>SPECFILE=`dirname $(gcc -print-libgcc-file-name)`/specs && -gcc -dumpspecs > $SPECFILE && -sed -i -e '/^\*link:$/{n;s,$, -L/usr/lib,}' \ - -e '[EMAIL PROTECTED]/tools/lib/ld-linux.so.2@/lib/[EMAIL PROTECTED]' $SPECFILE && -unset SPECFILE</userinput></screen> +<screen><userinput>gcc -dumpspecs | \ +perl -pi -e 's@/tools/lib/ld-linux-so.2@/lib/[EMAIL PROTECTED];' \ + -e '[EMAIL PROTECTED]:[EMAIL PROTECTED]/usr/lib/ @g;' > \ + `dirname $(gcc --print-libgcc-file-name)`/specs +</userinput></screen> <para>It is a good idea to visually inspect the specs file to verify the intended change was actually made.</para> @@ -43,18 +49,6 @@ linkend="ch-tools-toolchaintechnotes" role=","/> if necessary.</para></important> -<para>Now create a temporary wrapper script for <filename>gcc</filename>. -This script will point to the real <filename>gcc</filename> -in <filename class="directory">/tools</filename> but with adjusted parameters -to ensure that GCC in the next section links to our newly installed Glibc.</para> - -<screen><userinput>cat > /usr/bin/gcc << "EOF" -#!/bin/bash -/tools/bin/gcc -B/usr/lib/ -B/usr/bin/ $@ -EOF -chmod 755 /usr/bin/gcc -ln -s gcc /usr/bin/cc</userinput></screen> - <caution><para>It is imperative at this point to stop and ensure that the basic functions (compiling and linking) of the adjusted toolchain are working as expected. To do this, perform a sanity
-- http://linuxfromscratch.org/mailman/listinfo/lfs-dev FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page