[lfs-support] Building LFS under Debian

Pierre Labastie pierre.labastie at neuf.fr
Sun Jul 8 13:35:14 PDT 2018

On 08/07/2018 18:25, 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

Looks OK, except you did not mention the symbolic link:
/tools -> /mnt/lfs/tools

This symlink is important and supposed to exist by (almost) all the
instructions in chapter 5...

> 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
> 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

So your CPU is ARM, isn't it? I guess not many people on this list have
experience with that architecture. This does not mean they can't help, but
their support may be limited.

> 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

Does compiling a simple program work?
Try something like (first as a normal user then as the lfs user):

echo 'int main(){}' > simple.c
gcc simple.c
# if there is no error
rm simple.c a.out

If it does not work, this is a problem with debian. If it works, well...
configure should work too.

> 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.

Spiky has answered with a few advises, which I recommend too, especially the
"version-check.sh" script.


More information about the lfs-support mailing list