[lfs-support] Building LFS under Debian

Bruce Dubbs bruce.dubbs at gmail.com
Sun Jul 8 10:18:03 PDT 2018

On 07/08/2018 11:25 AM, Alan Corey wrote:
> LFS is a work of art, I can't believe it's been around 20 years and
> I'd never heard of it.  20 years ago I was downloading Slackware on
> floppies and lugging them home from college.
> The paths are sort of intricate to a newcomer though.  There are the
> paths I see, the paths the chroot is going to see, then paths used as
> prefix and lib-path.  At couple diagrams might help in the beginning.
> I'm still stuck on binutils, chapter 5,
> http://www.linuxfromscratch.org/lfs/view/stable/chapter05/binutils-pass1.html
> I started out making a mountpoint called /lfs to mount the partition
> I'm working in, then decided it was a bad idea.  What I have looks
> like:
> /lost+found
> /media
> /mnt
>    lfs
>      sources
>        binutils-2.30
>          build
>      tools
> /opt
> /proc

Whys is there no lost+found in /mnt/lfs?  If you mounted your lfs 
partition on /mnt, it should be there.  However the rest looks OK.

> Filezilla has nice directory trees BTW if somebody wants to do
> screenshots for documenting.  :)  Anyway I'm not sure that's right.
> Does the page mean to make build inside of binutils or is it outside
> to be used again later?  My $LFS is set to /mnt/lfs

It should be inside.  One issue that trips many up is that the 
procedures in Section 5.3:

follow instructions as written
cd back to sources
rm expanded directory

Every time.

Another thing that trips up new users is doing some things as root.  The 
LFS environment variable needs to be set for root also.  See the caution 
in Sectipn 2.6. Setting The $LFS Variable.

> I made a little cfg script for consistency rather than doing it from
> memory, it's mostly copied from the web page:
> #!/bin/sh
> ../configure --prefix=/tools            \
>    --with-sysroot=$LFS        \
>    --with-lib-path=/tools/lib \
>    --target=$LFS_TGT          \
>    --disable-nls              \
>    --disable-werror
> configure echos it back as
>   ../configure --prefix=/tools --with-sysroot=/mnt/lfs
> --with-lib-path=/tools/lib --target=aarch64-lfs-linux-gnu
> --disable-nls --disable-werror

We do not test LFS on an ARM processor.  What you have above looks OK, 
but I cannot say the system will be built properly or not.  I suggest 
double checking the host system requirements (Section 2.2).

> in the config.log.  OK, I'll attach the log.
> What worries me is the
> gcc: error trying to exec 'as': execvp: Too many levels of symbolic links
> In the conftest.  Debian has this kludgy alternatives system where gcc
> is /usr/bin/gcc but that's
> lrwxrwxrwx 1 root root 5 Apr  4 06:16 gcc -> gcc-7
> and that's
> lrwxrwxrwx 1 root root 23 Jun 26 03:52 gcc-7 -> aarch64-linux-gnu-gcc-7
> And aarch64-linux-gnu-gcc-7 is the real name of gcc 7
> maybe that's just part of conftest but configure dies with an error
> and no makefile.  as is:
> as -> aarch64-linux-gnu-as in /usr/bin

Those symlinks are probably OK. Debian uses the same thing on x86_64.

   -- Bruce

> These kludgy scripts, and PAM/Selinux/Apparmor are what I'm hoping to
> get away from with linuxfromscratch.   Yes, I usually have a few gcc
> and as and g++ versions around but it seems like there should be a
> better way.
>    Alan

More information about the lfs-support mailing list