FC6 (x86_64) as a host system

Fix 203832i at gmail.com
Sun Mar 18 19:51:15 PDT 2007


> Greg came up with a pretty good solution for DIY (IMO). Basically, by
> passing CC="gcc -B/usr/bin/" during binutils-pass1 and gcc-pass1, gcc
> will continue to use the host linker until we get our gcc built.

Maybe this hack work for FC6 (i686), but it isn't actually sufficient
on bi-arch (multilib) system.
Let's see.

	Fedora Core 6 (x86_64).
    gcc-4.1.2
	binutils-2.17

During gcc Pass 1:

./xgcc -B./ -B/tools/x86_64-pc-linux-gnu/bin/ -isystem /tools/x86_64-pc-linux-gn
u/include -isystem /tools/x86_64-pc-linux-gnu/sys-include -L/mnt/lfs/.ebuild/.tm
p/gcc-build/gcc/../ld -O2  -O2 -g -O2   -DIN_GCC    -W -Wall -Wwrite-strings -Ws
trict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include
  -fPIC -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED  -shared -n
odefaultlibs -Wl,--soname=libgcc_s.so.1 -Wl,--version-script=libgcc/./libgcc.map
 -o ./libgcc_s.so.1.tmp  libgcc/./_muldi3_s.o libgcc/./_negdi2_s.o libgcc/./_lsh
rdi3_s.o libgcc/./_ashldi3_s.o libgcc/./_ashrdi3_s.o libgcc/./_cmpdi2_s.o libgcc
/./_ucmpdi2_s.o libgcc/./_clear_cache_s.o libgcc/./_enable_execute_stack_s.o lib
gcc/./_trampoline_s.o libgcc/./__main_s.o libgcc/./_absvsi2_s.o libgcc/./_absvdi
2_s.o libgcc/./_addvsi3_s.o libgcc/./_addvdi3_s.o libgcc/./_subvsi3_s.o libgcc/.
/_subvdi3_s.o libgcc/./_mulvsi3_s.o libgcc/./_mulvdi3_s.o libgcc/./_negvsi2_s.o
libgcc/./_negvdi2_s.o libgcc/./_ctors_s.o libgcc/./_ffssi2_s.o libgcc/./_ffsdi2_
s.o libgcc/./_clz_s.o libgcc/./_clzsi2_s.o libgcc/./_clzdi2_s.o libgcc/./_ctzsi2
_s.o libgcc/./_ctzdi2_s.o libgcc/./_popcount_tab_s.o libgcc/./_popcountsi2_s.o l
ibgcc/./_popcountdi2_s.o libgcc/./_paritysi2_s.o libgcc/./_paritydi2_s.o libgcc/
./_powisf2_s.o libgcc/./_powidf2_s.o libgcc/./_powixf2_s.o libgcc/./_powitf2_s.o
 libgcc/./_mulsc3_s.o libgcc/./_muldc3_s.o libgcc/./_mulxc3_s.o libgcc/./_multc3
_s.o libgcc/./_divsc3_s.o libgcc/./_divdc3_s.o libgcc/./_divxc3_s.o libgcc/./_di
vtc3_s.o libgcc/./_fixunssfsi_s.o libgcc/./_fixunsdfsi_s.o libgcc/./_fixunsxfsi_
s.o libgcc/./_fixsfdi_s.o libgcc/./_fixunssfdi_s.o libgcc/./_floatdisf_s.o libgc
c/./_fixdfdi_s.o libgcc/./_fixunsdfdi_s.o libgcc/./_floatdidf_s.o libgcc/./_fixx
fdi_s.o libgcc/./_fixunsxfdi_s.o libgcc/./_floatdixf_s.o libgcc/./_fixtfdi_s.o l
ibgcc/./_fixunstfdi_s.o libgcc/./_floatditf_s.o libgcc/./_divdi3_s.o libgcc/./_m
oddi3_s.o libgcc/./_udivdi3_s.o libgcc/./_umoddi3_s.o libgcc/./_udiv_w_sdiv_s.o
libgcc/./_udivmoddi4_s.o libgcc/./unwind-dw2_s.o libgcc/./unwind-dw2-fde-glibc_s
.o libgcc/./unwind-sjlj_s.o libgcc/./gthr-gnat_s.o libgcc/./unwind-c_s.o -lc &&
rm -f ./libgcc_s.so && if [ -f ./libgcc_s.so.1 ]; then mv -f ./libgcc_s.so.1 ./l
ibgcc_s.so.1.backup; else true; fi && mv ./libgcc_s.so.1.tmp ./libgcc_s.so.1 &&
ln -s libgcc_s.so.1 ./libgcc_s.so
/lib64/libc.so.6: file not recognized: File format not recognized

$ strings /lib64/libc.so.6 | grep \\.hash
.gnu.hash

$ echo $CC
gcc -B/usr/bin

$ ${CC} -print-prog-name=ld
/usr/bin/ld

$ cat gcc-build/Makefile | grep "^CC ="
CC = gcc -B/usr/bin

$ gcc-build/gcc/xgcc -print-prog-name=ld
/tools/lib/../x86_64-pc-linux-gnu/bin/ld


	If using binutils-2.17.50.0.12

./xgcc -B./ -B/tools/x86_64-pc-linux-gnu/bin/ -isystem /tools/x86_64-pc-linux-gn
u/include -isystem /tools/x86_64-pc-linux-gnu/sys-include -L/mnt/lfs/.ebuild/.tm
p/gcc-build/gcc/../ld -O2  -O2 -g -O2   -DIN_GCC    -W -Wall -Wwrite-strings -Ws
trict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include
  -fPIC -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED  -shared -n
odefaultlibs -Wl,--soname=libgcc_s.so.1 -Wl,--version-script=libgcc/32/libgcc.ma
p -o 32/libgcc_s.so.1.tmp  -m32 libgcc/32/_muldi3_s.o libgcc/32/_negdi2_s.o libg
cc/32/_lshrdi3_s.o libgcc/32/_ashldi3_s.o libgcc/32/_ashrdi3_s.o libgcc/32/_cmpd
i2_s.o libgcc/32/_ucmpdi2_s.o libgcc/32/_clear_cache_s.o libgcc/32/_enable_execu
te_stack_s.o libgcc/32/_trampoline_s.o libgcc/32/__main_s.o libgcc/32/_absvsi2_s
.o libgcc/32/_absvdi2_s.o libgcc/32/_addvsi3_s.o libgcc/32/_addvdi3_s.o libgcc/3
2/_subvsi3_s.o libgcc/32/_subvdi3_s.o libgcc/32/_mulvsi3_s.o libgcc/32/_mulvdi3_
s.o libgcc/32/_negvsi2_s.o libgcc/32/_negvdi2_s.o libgcc/32/_ctors_s.o libgcc/32
/_ffssi2_s.o libgcc/32/_ffsdi2_s.o libgcc/32/_clz_s.o libgcc/32/_clzsi2_s.o libg
cc/32/_clzdi2_s.o libgcc/32/_ctzsi2_s.o libgcc/32/_ctzdi2_s.o libgcc/32/_popcoun
t_tab_s.o libgcc/32/_popcountsi2_s.o libgcc/32/_popcountdi2_s.o libgcc/32/_parit
ysi2_s.o libgcc/32/_paritydi2_s.o libgcc/32/_powisf2_s.o libgcc/32/_powidf2_s.o
libgcc/32/_powixf2_s.o libgcc/32/_powitf2_s.o libgcc/32/_mulsc3_s.o libgcc/32/_m
uldc3_s.o libgcc/32/_mulxc3_s.o libgcc/32/_multc3_s.o libgcc/32/_divsc3_s.o libg
cc/32/_divdc3_s.o libgcc/32/_divxc3_s.o libgcc/32/_divtc3_s.o libgcc/32/_fixunss
fsi_s.o libgcc/32/_fixunsdfsi_s.o libgcc/32/_fixunsxfsi_s.o libgcc/32/_fixsfdi_s
.o libgcc/32/_fixunssfdi_s.o libgcc/32/_floatdisf_s.o libgcc/32/_fixdfdi_s.o lib
gcc/32/_fixunsdfdi_s.o libgcc/32/_floatdidf_s.o libgcc/32/_fixxfdi_s.o libgcc/32
/_fixunsxfdi_s.o libgcc/32/_floatdixf_s.o libgcc/32/_fixtfdi_s.o libgcc/32/_fixu
nstfdi_s.o libgcc/32/_floatditf_s.o libgcc/32/_divdi3_s.o libgcc/32/_moddi3_s.o
libgcc/32/_udivdi3_s.o libgcc/32/_umoddi3_s.o libgcc/32/_udiv_w_sdiv_s.o libgcc/
32/_udivmoddi4_s.o libgcc/32/unwind-dw2_s.o libgcc/32/unwind-dw2-fde-glibc_s.o l
ibgcc/32/unwind-sjlj_s.o libgcc/32/gthr-gnat_s.o libgcc/32/unwind-c_s.o -lc && r
m -f 32/libgcc_s.so && if [ -f 32/libgcc_s.so.1 ]; then mv -f 32/libgcc_s.so.1 3
2/libgcc_s.so.1.backup; else true; fi && mv 32/libgcc_s.so.1.tmp 32/libgcc_s.so.
1 && ln -s libgcc_s.so.1 32/libgcc_s.so
/tools/bin/ld: crti.o: No such file: No such file or directory

$ /tools/bin/ld --verbose | grep SEARCH
SEARCH_DIR("/tools/x86_64-pc-linux-gnu/lib64"); SEARCH_DIR("/tools/lib64"); SEAR
CH_DIR("/usr/local/lib64"); SEARCH_DIR("/lib64"); SEARCH_DIR("/usr/lib64"); SEAR
CH_DIR("/tools/x86_64-pc-linux-gnu/lib"); SEARCH_DIR("/tools/lib"); SEARCH_DIR("
/usr/local/lib"); SEARCH_DIR("/lib"); SEARCH_DIR("/usr/lib");

$ ls -l /usr/lib64/crt*
-rw-r--r-- 1 root root 1648 ¦Þ¦¦T  8 22:54 /usr/lib64/crt1.o
-rw-r--r-- 1 root root 1512 ¦Þ¦¦T  8 22:54 /usr/lib64/crti.o
-rw-r--r-- 1 root root  768 ¦Þ¦¦T  8 22:54 /usr/lib64/crtn.o



I don't investigated further, because now I'm building a pure 64-bit
toolchain, using "--disable-multilib", and it compiles
just fine, except of some problems, with locations of various libs and
a few other. If someone is interesting in this, I can
submit my patches and/or ebuilds when I'll finish.

Fix



More information about the lfs-dev mailing list