Le 19/04/2014 07:42, mar...@byteanywhere.com a écrit :
> 
> 
> I have a symlink between:
>  ls -ld /tools
> lrwxrwxrwx 1 root root 47 Apr 17 08:08 /tools ->
> /home/marian/crosstool/x86_64-unknown-linux-gnu/
> 
> 
> export PREFIX=/home/marian/crosstool/x86_64-unknown-linux-gnu
> export TARGET=x86_64-unknown-linux-gnu
> export
> SYSROOT=/home/marian/crosstool/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/sys-root
> export PATH=/tools/bin:/bin:/usr/bin
> 

I think there are at least 2 problems in the above:
1)  TARGET=x86_64-unknown-linux-gnu: you have not told what your host is, but
I assume it is a 64 bit PC running linux. In this case, the host is already
x86_64-unknown-linux-gnu, so the build systems of binutils and gcc do not
understand that you want to create a cross compiler. As explained in LFS page
5.2, you need to slightly deviate from that by changing the vendor name from
"unknown" to something else. Of course, if your host is not a 64 bit PC, the
preceding does not apply.

2)
SYSROOT=/home/marian/crosstool/x86_64-unknown-linux-gnu/x86_64-unknown-linux-gnu/sys-root

SYSROOT is the _root_ of the new system disk image, where the linker will look
for the target libraries. Using --with-sysroot=$SYSROOT
--with-lib-path=/tools/lib below means that the linker will look into
$SYSROOT/tools/lib for target libraries. Clearly, those directories do not 
exist.

What I would recommend is to use the LFS section 4.4 setup. If you do not want
to do that, you should at least have:
PREFIX=/whatever/tools
SYSROOT=/whatever
ln -s /whatever/tools /

>
> 1. Binutils
>  ../binutils-2.24/configure --prefix=/tools --with-sysroot=$SYSROOT
> --with-lib-path=/tools/lib --target=$TARGET --disable-nls  
> --disable-werror
> 
>   binutils compiles fine. no errors.
> 
> 2. Kernel headers
> 
> make headers_check
> make INSTALL_HDR_PATH=dest headers_install
> cp -rv dest/include/* /tools/include
> 
> 
> 3.  From some other docs i saw they install the glibc headers as well here.
> I have tried this, but the same error is happening when building gcc or
> glibc.
>    System glibc headers
> 
>    mkdir glibc-build
>    cd glibc-build
> 
> ../glibc-2.19/configure --prefix=/tools --host=$TARGET
> --build=$(../glibc-2.19/scripts/config.guess) --disable-profile
> --enable-kernel=2.6.32 --with-headers=/tools/include
> libc_cv_forced_unwind=yes libc_cv_ctors_header=yes libc_cv_c_cleanup=yes 
> --without-selinux
> 
>    make -k install-headers install_root=/

That's a very bad idea, you have overwritten your host headers, unless you did
not run this command as user "root", in which case you have done nothing...
You should have seen errors, though.
This step is not needed anyway.

> 
> 4. GCC stage 1
> 
> ../gcc-4.8.2/configure --target=$TARGET --prefix=/tools
> --with-sysroot=$SYSROOT --with-newlib  --without-headers  
> --with-local-prefix=/tools    
> --with-native-system-header-dir=/tools/include --disable-nls
> --disable-shared  --disable-multilib  --disable-decimal-float 
> --disable-threads --disable-libatomic  --disable-libgomp --disable-libitm
> --disable-libmudflap --disable-libquadmath --disable-libsanitizer
> --disable-libssp  --disable-libstdc++-v3 --enable-languages=c,c++
> --with-mpfr-include=$(pwd)/../gcc-4.8.2/mpfr/src
> --with-mpfr-lib=$(pwd)/mpfr/src/.libs
> 
Did you run the "for file in [...] done" part?
>    Here if i use make, i get the same error, that compiler can not create
> executables. From config log, the error is that cross gcc is not able
> to find a couple of libs (which seems generated by glibc) crt1.o, crti.o,
> crtn.o and libc.so

Those are not found by the linker because it looks for them in
$SYSROOT/tools/lib/somepath, which does not exist. Also, the compiler thinks
it is a native compiler if the TARGET is not different from the host, and the
algorithm to find the files is different.
> 
>   Thus from other docs i have seen these being used, so i have tried to
> continue using them:
> 
> make all-gcc
> make all-target-libgcc
> make install-gcc
> make install-target-libgcc
You should be able to run just make.
> 
> 5.  building glibc fails building in sunrpc folder,
> for some rpc_* files, with the same same error, saying that those libs can
> not be found.
> 
> 
See what happens when you correct the errors above (TARGET and SYSROOT, I 
think).


Pierre
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-support
FAQ: http://www.linuxfromscratch.org/lfs/faq.html
Unsubscribe: See the above information page

Reply via email to