- sed/patch the source (gcc/gcc.c) so the hard-codes /usr/lib gets replaced by /tools/lib:
sed -i "/standard_exec_prefix_/s%/usr%/tools%g" gcc/gcc.c
My preference would be the sed/patch, because it removes all the hardcoded host-dirs from gcc's search-path.
For consistency, make it sed -i "/standard_exec_prefix_/s%/usr%/cross-tools%g"
Probably better to just remove it from the addition to the library search path
(only standard_exec_prefixes_2) when cross-compiling...
Two patches attached, choose one or the other...
First removes standard_exec_prefixes_2 from the library search path when cross-compiling (ie removes /usr/lib/gcc/${TARGET}/${VER} )
Second does the above but also removes /usr/libexec/gcc/${TARGET}/${VER} and /usr/lib/gcc/${TARGET}/${VER} from the gcc executable search path when cross-compiling (why gcc should search outside its prefix for its binaries is beyond me when cross-compiling, not that it would ever get there...)
Will add comments to the top in lfs-style patch submission format if one or the other are accepted...
Patches are safe to apply to all gcc builds...
output after applying the second patch [EMAIL PROTECTED]:~/cross-lfs/scripts$ ~/bin/armv4l-softfloat-linux-gnu-gcc \ > -print-search-dirs | sed "s%:%\n%g" install /home/lfs/lib/gcc/armv4l-softfloat-linux-gnu/3.4.3/ programs =/home/lfs/libexec/gcc/armv4l-softfloat-linux-gnu/3.4.3/ /home/lfs/libexec/gcc/armv4l-softfloat-linux-gnu/3.4.3/ /home/lfs/libexec/gcc/armv4l-softfloat-linux-gnu/ /home/lfs/lib/gcc/armv4l-softfloat-linux-gnu/3.4.3/ /home/lfs/lib/gcc/armv4l-softfloat-linux-gnu/ /home/lfs/lib/gcc/armv4l-softfloat-linux-gnu/3.4.3/../../../../armv4l-softfloat-linux-gnu/bin/armv4l-softfloat-linux-gnu/3.4.3/ /home/lfs/lib/gcc/armv4l-softfloat-linux-gnu/3.4.3/../../../../armv4l-softfloat-linux-gnu/bin/ libraries =/home/lfs/lib/gcc/armv4l-softfloat-linux-gnu/3.4.3/ /home/lfs/lib/gcc/armv4l-softfloat-linux-gnu/3.4.3/../../../../armv4l-softfloat-linux-gnu/lib/armv4l-softfloat-linux-gnu/3.4.3/ /home/lfs/lib/gcc/armv4l-softfloat-linux-gnu/3.4.3/../../../../armv4l-softfloat-linux-gnu/lib/ /tgt-tools/lib/armv4l-softfloat-linux-gnu/3.4.3/ /tgt-tools/lib/
Regards [R]
Submitted by: Ryan Oliver <[EMAIL PROTECTED]> Date: 20050502 Description: Removes standard_exec_prefix_2 from library search path when cross-compiling ie: if cross_compile = 1 in the specs file, do not add /usr/lib/gcc/${TARGET}/${GCC_VER} to the library search path --- gcc-3.4.3/gcc/gcc.c-orig 2004-09-09 01:16:11.000000000 +1000 +++ gcc-3.4.3/gcc/gcc.c 2005-05-02 21:32:34.000000000 +1000 @@ -3765,8 +3765,11 @@ add_prefix (&startfile_prefixes, standard_exec_prefix, "BINUTILS", PREFIX_PRIORITY_LAST, 1, warn_std_ptr, 0); - add_prefix (&startfile_prefixes, standard_exec_prefix_2, "BINUTILS", + if (*cross_compile == '0') + { + add_prefix (&startfile_prefixes, standard_exec_prefix_2, "BINUTILS", PREFIX_PRIORITY_LAST, 1, warn_std_ptr, 0); + } tooldir_prefix = concat (tooldir_base_prefix, spec_machine, dir_separator_str, NULL);
Submitted by: Ryan Oliver <[EMAIL PROTECTED]> Date: 20050502 Description: Removes standard_exec_prefix_2 from library search path when cross-compiling. Removes both standard_exec_prefix_1 and standard_exec_prefix_2 from the gcc executable search path when cross-compiling.
ie: if cross_compile = 1 in the specs file, do not - add /usr/lib/gcc/${TARGET}/${GCC_VER} to the library search path - add /usr/lib/gcc/${TARGET}/${GCC_VER} or /usr/libexec/gcc/${TARGET}/${GCC_VER} to the executable search path --- gcc-3.4.3/gcc/gcc.c-orig 2004-09-09 01:16:11.000000000 +1000 +++ gcc-3.4.3/gcc/gcc.c 2005-05-02 21:16:05.000000000 +1000 @@ -3757,16 +3757,22 @@ PREFIX_PRIORITY_LAST, 2, warn_std_ptr, 0); add_prefix (&exec_prefixes, standard_exec_prefix, "BINUTILS", PREFIX_PRIORITY_LAST, 2, warn_std_ptr, 0); - add_prefix (&exec_prefixes, standard_exec_prefix_1, "BINUTILS", + if (*cross_compile == '0') + { + add_prefix (&exec_prefixes, standard_exec_prefix_1, "BINUTILS", PREFIX_PRIORITY_LAST, 2, warn_std_ptr, 0); - add_prefix (&exec_prefixes, standard_exec_prefix_2, "BINUTILS", + add_prefix (&exec_prefixes, standard_exec_prefix_2, "BINUTILS", PREFIX_PRIORITY_LAST, 2, warn_std_ptr, 0); + } #endif add_prefix (&startfile_prefixes, standard_exec_prefix, "BINUTILS", PREFIX_PRIORITY_LAST, 1, warn_std_ptr, 0); - add_prefix (&startfile_prefixes, standard_exec_prefix_2, "BINUTILS", + if (*cross_compile == '0') + { + add_prefix (&startfile_prefixes, standard_exec_prefix_2, "BINUTILS", PREFIX_PRIORITY_LAST, 1, warn_std_ptr, 0); + } tooldir_prefix = concat (tooldir_base_prefix, spec_machine, dir_separator_str, NULL);
-- http://linuxfromscratch.org/mailman/listinfo/lfs-dev FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page