[lfs-support] How can I install binutils and gcc with one pass to build temporary system?

Hazel Russman hazeldebian at googlemail.com
Tue Dec 27 05:50:07 PST 2016

On Tue, 27 Dec 2016 19:25:45 +0600
ssmtpmailtesting ssmtpmailtesting <ssmtpmailtesting at gmail.com> wrote:

> What does it mean by cross compiler or cross compiling?
It means compiling for a different computer. In LFS however, we trick gcc into thinking that it's compiling for a different computer when it really isn't. The reason is that when gcc is in cross-compilation mode, it won't make assumptions about the target system based on what it finds on the host.
> I'm in chapter 5 to build temporary system.
> I tried this for binutils:
> ../configure --prefix=/tools            \
>              --with-sysroot=$LFS        \
>              --with-lib-path=/tools/lib \
>              --target=$LFS_TGT          \
>              --disable-nls              \
>              --disable-werror
> make -j2
> make install
> It looked, binutils was installed successfully in /tools. But I don't know
> what --with-sysroot=$LFS does. Can anyone explain this? Won't
> --prefix=/tools and --target=$LFS_TGT install binutils? Why do we need
> --with-sysroot=$LFS?
The book explains clearly what each argument does. All of them are necessary to create a clean break with the host system.
> After installing binutils in that way I wanted to install gcc in /tools in
> one pass too. I wanted to skip gcc pass 2:
> http://www.linuxfromscratch.org/lfs/view/stable/chapter05/gcc-pass2.html
Please don't skip anything. You will end up with a non-functioning system.

> Can anyone tell me how I should configure and install gcc with one pass
> using that previously installed binutils?
If that was feasible, the book would include it. In fact the two-stage process is essential for a clean break with the host. 
> Also when do I need this: --host=$LFS_TGT? What's the difference between
> --host=$LFS_TGT and --with-sysroot=$LFS? --host is in
> http://www.linuxfromscratch.org/lfs/view/stable/chapter05/gcc-libstdc++.html
> and http://www.linuxfromscratch.org/lfs/view/stable/chapter05/glibc.html
> http://www.linuxfromscratch.org/lfs/view/stable/chapter05/glibc.html , In
> glibc I saw: --build=$(../scripts/config.guess) , what does this --build
> do? When do I need --build? Why didn't we need --build in binutils and gcc?
Because, if you specify a target, you don't need to specify the host; by default, it will be the same. However you can only use --target for a build tool like gcc or binutils. glibc is not a build tool, so you have to set the host on which it is to run explicitly.


H Russman

More information about the lfs-support mailing list