mirror of
https://git.linuxfromscratch.org/lfs.git
synced 2025-07-10 14:24:10 +01:00
Readjust the gcc header search path to include /usr/include and test it
git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@7972 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
This commit is contained in:
parent
8bfbf407dd
commit
e9a652b5f0
@ -39,6 +39,12 @@
|
|||||||
<listitem>
|
<listitem>
|
||||||
<para>2007-03-23</para>
|
<para>2007-03-23</para>
|
||||||
<itemizedlist>
|
<itemizedlist>
|
||||||
|
<listitem>
|
||||||
|
<para>[dnicholson] - When readjusting the GCC specs file, ensure
|
||||||
|
that GCC will search for the system headers in /usr/include. An
|
||||||
|
addition to the toolchain sanity checks has been made to test
|
||||||
|
this. This fix originates from DIY Linux.</para>
|
||||||
|
</listitem>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>[dnicholson] - Included the branch update patch for the
|
<para>[dnicholson] - Included the branch update patch for the
|
||||||
temporary Glibc in Chapter 5 to help minimize differences with the
|
temporary Glibc in Chapter 5 to help minimize differences with the
|
||||||
|
@ -161,19 +161,20 @@ cd ../gcc-build</userinput></screen>
|
|||||||
href="readjusting.xml"
|
href="readjusting.xml"
|
||||||
xpointer="xpointer(//*[@os='g'])"/>
|
xpointer="xpointer(//*[@os='g'])"/>
|
||||||
|
|
||||||
|
<screen role="nodump"><userinput>grep -B2 '^ /usr/include' dummy.log</userinput></screen>
|
||||||
|
|
||||||
<xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
<xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
||||||
href="readjusting.xml"
|
href="readjusting.xml"
|
||||||
xpointer="xpointer(//*[@os='h'])"/>
|
xpointer="xpointer(//*[@os='h'])"/>
|
||||||
|
|
||||||
|
<screen><computeroutput>#include <...> search starts here:
|
||||||
|
/usr/lib/gcc/i686-pc-linux-gnu/&gcc-version;/include
|
||||||
|
/usr/include</computeroutput></screen>
|
||||||
|
|
||||||
<xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
<xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
||||||
href="readjusting.xml"
|
href="readjusting.xml"
|
||||||
xpointer="xpointer(//*[@os='i'])"/>
|
xpointer="xpointer(//*[@os='i'])"/>
|
||||||
|
|
||||||
<screen><computeroutput>SEARCH_DIR("/usr/i686-pc-linux-gnu/lib")
|
|
||||||
SEARCH_DIR("/usr/local/lib")
|
|
||||||
SEARCH_DIR("/lib")
|
|
||||||
SEARCH_DIR("/usr/lib");</computeroutput></screen>
|
|
||||||
|
|
||||||
<xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
<xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
||||||
href="readjusting.xml"
|
href="readjusting.xml"
|
||||||
xpointer="xpointer(//*[@os='j'])"/>
|
xpointer="xpointer(//*[@os='j'])"/>
|
||||||
@ -182,6 +183,11 @@ SEARCH_DIR("/usr/lib");</computeroutput></screen>
|
|||||||
href="readjusting.xml"
|
href="readjusting.xml"
|
||||||
xpointer="xpointer(//*[@os='k'])"/>
|
xpointer="xpointer(//*[@os='k'])"/>
|
||||||
|
|
||||||
|
<screen><computeroutput>SEARCH_DIR("/usr/i686-pc-linux-gnu/lib")
|
||||||
|
SEARCH_DIR("/usr/local/lib")
|
||||||
|
SEARCH_DIR("/lib")
|
||||||
|
SEARCH_DIR("/usr/lib");</computeroutput></screen>
|
||||||
|
|
||||||
<xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
<xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
||||||
href="readjusting.xml"
|
href="readjusting.xml"
|
||||||
xpointer="xpointer(//*[@os='l'])"/>
|
xpointer="xpointer(//*[@os='l'])"/>
|
||||||
@ -218,6 +224,14 @@ SEARCH_DIR("/usr/lib");</computeroutput></screen>
|
|||||||
href="readjusting.xml"
|
href="readjusting.xml"
|
||||||
xpointer="xpointer(//*[@os='t'])"/>
|
xpointer="xpointer(//*[@os='t'])"/>
|
||||||
|
|
||||||
|
<xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
||||||
|
href="readjusting.xml"
|
||||||
|
xpointer="xpointer(//*[@os='u'])"/>
|
||||||
|
|
||||||
|
<xi:include xmlns:xi="http://www.w3.org/2003/XInclude"
|
||||||
|
href="readjusting.xml"
|
||||||
|
xpointer="xpointer(//*[@os='v'])"/>
|
||||||
|
|
||||||
</sect2>
|
</sect2>
|
||||||
|
|
||||||
<sect2 id="contents-gcc" role="content">
|
<sect2 id="contents-gcc" role="content">
|
||||||
|
@ -44,9 +44,10 @@ ln -sv /tools/bin/ld /tools/$(gcc -dumpmachine)/bin/ld</userinput></screen>
|
|||||||
linkend="ch-tools-toolchaintechnotes" role=","/> if necessary.</para>
|
linkend="ch-tools-toolchaintechnotes" role=","/> if necessary.</para>
|
||||||
</important>
|
</important>
|
||||||
|
|
||||||
<screen><userinput>gcc -dumpspecs | \
|
<screen><userinput>gcc -dumpspecs | sed \
|
||||||
perl -p -e 's@/tools/lib/ld-linux.so.2@/lib/ld-linux.so.2@g;' \
|
-e 's@/tools/lib/ld-linux.so.2@/lib/ld-linux.so.2@g' \
|
||||||
-e 's@\*startfile_prefix_spec:\n@$_/usr/lib/ @g;' > \
|
-e '/\*startfile_prefix_spec:/{n;s@.*@/usr/lib/ @}' \
|
||||||
|
-e '/\*cpp:/{n;s@$@ -isystem /usr/include@}' > \
|
||||||
`dirname $(gcc --print-libgcc-file-name)`/specs</userinput></screen>
|
`dirname $(gcc --print-libgcc-file-name)`/specs</userinput></screen>
|
||||||
|
|
||||||
<para>It is a good idea to visually inspect the specs file to verify the
|
<para>It is a good idea to visually inspect the specs file to verify the
|
||||||
@ -57,7 +58,7 @@ perl -p -e 's@/tools/lib/ld-linux.so.2@/lib/ld-linux.so.2@g;' \
|
|||||||
as expected. To do this, perform the following sanity checks:</para>
|
as expected. To do this, perform the following sanity checks:</para>
|
||||||
|
|
||||||
<screen role="nodump" os="a"><userinput>echo 'main(){}' > dummy.c
|
<screen role="nodump" os="a"><userinput>echo 'main(){}' > dummy.c
|
||||||
cc dummy.c -Wl,--verbose &> dummy.log
|
cc dummy.c -v -Wl,--verbose &> dummy.log
|
||||||
readelf -l a.out | grep ': /lib'</userinput></screen>
|
readelf -l a.out | grep ': /lib'</userinput></screen>
|
||||||
|
|
||||||
<para os="b">If everything is working correctly, there should be no errors,
|
<para os="b">If everything is working correctly, there should be no errors,
|
||||||
@ -80,44 +81,54 @@ readelf -l a.out | grep ': /lib'</userinput></screen>
|
|||||||
/usr/lib/crti.o succeeded
|
/usr/lib/crti.o succeeded
|
||||||
/usr/lib/crtn.o succeeded</computeroutput></screen>
|
/usr/lib/crtn.o succeeded</computeroutput></screen>
|
||||||
|
|
||||||
<para os="g">Next, verify that the new linker is being used with the correct search paths:</para>
|
<para os="g">Verify that the compiler is searching for the correct header
|
||||||
|
files:</para>
|
||||||
|
|
||||||
<screen role="nodump" os="h"><userinput>grep 'SEARCH.*/usr/lib' dummy.log |sed 's|; |\n|g'</userinput></screen>
|
<screen role="nodump"><userinput>grep -B1 '^ /usr/include' dummy.log</userinput></screen>
|
||||||
|
|
||||||
<para os="i">If everything is working correctly, there should be no errors,
|
<para os="h">This command should return successfully with the following output:</para>
|
||||||
|
|
||||||
|
<screen><computeroutput>#include <...> search starts here:
|
||||||
|
/usr/include</computeroutput></screen>
|
||||||
|
|
||||||
|
<para os="i">Next, verify that the new linker is being used with the correct search paths:</para>
|
||||||
|
|
||||||
|
<screen role="nodump" os="j"><userinput>grep 'SEARCH.*/usr/lib' dummy.log |sed 's|; |\n|g'</userinput></screen>
|
||||||
|
|
||||||
|
<para os="k">If everything is working correctly, there should be no errors,
|
||||||
and the output of the last command will be:</para>
|
and the output of the last command will be:</para>
|
||||||
|
|
||||||
<screen><computeroutput>SEARCH_DIR("/tools/i686-pc-linux-gnu/lib")
|
<screen><computeroutput>SEARCH_DIR("/tools/i686-pc-linux-gnu/lib")
|
||||||
SEARCH_DIR("/usr/lib")
|
SEARCH_DIR("/usr/lib")
|
||||||
SEARCH_DIR("/lib");</computeroutput></screen>
|
SEARCH_DIR("/lib");</computeroutput></screen>
|
||||||
|
|
||||||
<para os="j">Next make sure that we're using the correct libc:</para>
|
<para os="l">Next make sure that we're using the correct libc:</para>
|
||||||
|
|
||||||
<screen role="nodump" os="k"><userinput>grep "/lib/libc.so.6 " dummy.log</userinput></screen>
|
<screen role="nodump" os="m"><userinput>grep "/lib/libc.so.6 " dummy.log</userinput></screen>
|
||||||
|
|
||||||
<para os="l">If everything is working correctly, there should be no errors,
|
<para os="n">If everything is working correctly, there should be no errors,
|
||||||
and the output of the last command will be:</para>
|
and the output of the last command will be:</para>
|
||||||
|
|
||||||
<screen os="m"><computeroutput>attempt to open /lib/libc.so.6 succeeded</computeroutput></screen>
|
<screen os="o"><computeroutput>attempt to open /lib/libc.so.6 succeeded</computeroutput></screen>
|
||||||
|
|
||||||
<para os="n">Lastly, make sure GCC is using the correct dynamic linker:</para>
|
<para os="p">Lastly, make sure GCC is using the correct dynamic linker:</para>
|
||||||
|
|
||||||
<screen role="nodump" os="o"><userinput>grep found dummy.log</userinput></screen>
|
<screen role="nodump" os="q"><userinput>grep found dummy.log</userinput></screen>
|
||||||
|
|
||||||
<para os="p">If everything is working correctly, there should be no errors,
|
<para os="r">If everything is working correctly, there should be no errors,
|
||||||
and the output of the last command will be (allowing for
|
and the output of the last command will be (allowing for
|
||||||
platform-specific differences in dynamic linker name):</para>
|
platform-specific differences in dynamic linker name):</para>
|
||||||
|
|
||||||
<screen os="q"><computeroutput>found ld-linux.so.2 at /lib/ld-linux.so.2</computeroutput></screen>
|
<screen os="s"><computeroutput>found ld-linux.so.2 at /lib/ld-linux.so.2</computeroutput></screen>
|
||||||
|
|
||||||
<para os="r">If the output does not appear as shown above or is not received
|
<para os="t">If the output does not appear as shown above or is not received
|
||||||
at all, then something is seriously wrong. Investigate and retrace the
|
at all, then something is seriously wrong. Investigate and retrace the
|
||||||
steps to find out where the problem is and correct it. The most likely
|
steps to find out where the problem is and correct it. The most likely
|
||||||
reason is that something went wrong with the specs file adjustment. Any
|
reason is that something went wrong with the specs file adjustment. Any
|
||||||
issues will need to be resolved before continuing on with the process.</para>
|
issues will need to be resolved before continuing on with the process.</para>
|
||||||
|
|
||||||
<para os="s">Once everything is working correctly, clean up the test files:</para>
|
<para os="u">Once everything is working correctly, clean up the test files:</para>
|
||||||
|
|
||||||
<screen role="nodump" os="t"><userinput>rm -v dummy.c a.out dummy.log</userinput></screen>
|
<screen role="nodump" os="v"><userinput>rm -v dummy.c a.out dummy.log</userinput></screen>
|
||||||
|
|
||||||
</sect1>
|
</sect1>
|
||||||
|
Loading…
Reference in New Issue
Block a user