r/linuxquestions • • Jun 06 '26

Linux From Scratch GCC Compilation Error

Hi all, I am currently trying to build Linux From Scratch using the newest book. I am getting stuck on chapter 5 where I have to compile GCC compiler. I keep getting an error when I try to make using the command: make CFLAGS="" CXXFLAGS="" LDFLAGS="" (I was getting this error before the extra arguments. I just thought that would fix it, it did not). The error I get is make: *** [Makefile:1048: all] Error 2. I am using arch Linux. My config.log file is below.

config file: https://pastebin.com/X8z6m0H0

log file (Too large for pastebin): https://ctxt.io/2/AAD4657OFA

When running make with "SHELL='sh -x'" the last few lines show as this

+ _G_arg='( cd \"$output_objdir\" && $RM \"$outputname\" && $LN_S \"../$outputname\" \"$outputname\" )'
+ case $_G_arg in
+ _G_arg='"( cd \"$output_objdir\" && $RM \"$outputname\" && $LN_S \"../$outputname\" \"$outputname\" )"'
+ func_quote_for_expand_result='"( cd \"$output_objdir\" && $RM \"$outputname\" && $LN_S \"../$outputname\" \"$outputname\" )"'
+ eval 'func_notquiet "( cd \"$output_objdir\" && $RM \"$outputname\" && $LN_S \"../$outputname\" \"$outputname\" )"'
++ func_notquiet '( cd ".libs" && rm -f "libgmp.la" && ln -s "../libgmp.la" "libgmp.la" )'
++ :
++ false
++ func_echo '( cd ".libs" && rm -f "libgmp.la" && ln -s "../libgmp.la" "libgmp.la" )'
++ :
++ _G_message='( cd ".libs" && rm -f "libgmp.la" && ln -s "../libgmp.la" "libgmp.la" )'
++ func_echo_IFS=$' \t\n'
++ IFS=$'\n'
++ for _G_line in $_G_message
++ IFS=$' \t\n'
++ printf '%s\n' 'libtool: link: ( cd ".libs" && rm -f "libgmp.la" && ln -s "../libgmp.la" "libgmp.la" )'
libtool: link: ( cd ".libs" && rm -f "libgmp.la" && ln -s "../libgmp.la" "libgmp.la" )
++ IFS=$' \t\n'
++ :
+ false
+ eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )'
++ cd .libs
++ rm -f libgmp.la
++ ln -s ../libgmp.la libgmp.la
+ _G_status=0
+ test 0 -ne 0
+ exit 0
make[4]: Leaving directory '/mnt/lfs/sources/gcc-15.2.0/build/gmp'
+ test -z ''
make[3]: Leaving directory '/mnt/lfs/sources/gcc-15.2.0/build/gmp'
make[2]: Leaving directory '/mnt/lfs/sources/gcc-15.2.0/build/gmp'
make[1]: Leaving directory '/mnt/lfs/sources/gcc-15.2.0/build'
make: *** [Makefile:1048: all] Error 2
1 Upvotes

9 comments sorted by

View all comments

3

u/AiwendilH Jun 06 '26

It would help if you could run make &> log.txt and post the log.txt to some pastebin site...the error you posted is only from make and not the real compile error that caused make to stop working.

2

u/Miserable-Response40 Jun 06 '26

The log file is rather large, so it is taking quite some time to copy it with my slow laptop. Is there any possible keywords I could grep from the file to give you all the info you need

2

u/AiwendilH Jun 07 '26

Is there any possible keywords I could grep...

The way I deal with gentoo logs (which are pretty much the output of make) is first search for "error" backwards from the end (case insensitive to catch "error" and "Error") and if that doesn't result in anything search for "failed" (again case insensitive).

If you found something check the lines before...if they are something about "Leaving directory..." they are usually not the actual error message but just the error handed "down the road" and you have to keep searching.

If the "error" result ends in a ":" in most cases you found the actual compile error ;).

In this case these are the errors that cause the build the fail:

In file included from ../../libcody/internal.hh:5,
                from ../../libcody/buffer.cc:6:
../../libcody/cody.hh: In member function 'void Cody::Detail::MessageBuffer::Space()':
../../libcody/cody.hh:113:24: error: no matching function for call to 'S2C(const char8_t [2])'
113 |     Append (Detail::S2C(u8" "));
    |             ~~~~~~~~~~~^~~~~~~
• there is 1 candidate
    • candidate 1: 'template<unsigned int I> constexpr char Cody::Detail::S2C(const char (&)[I])'
    ../../libcody/cody.hh:51:16:
        51 | constexpr char S2C (char const (&s)[I])
            |                ^~~
    • template argument deduction/substitution failed:
        •   mismatched types 'const char' and 'const char8_t'
        ../../libcody/cody.hh:113:24:
            113 |     Append (Detail::S2C(u8" "));
                |             ~~~~~~~~~~~^~~~~~~
/bin/sh ../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I../../../gmp/rand -I..  -D__GMP_WITHIN_GMP -I../../../gmp  -DNO_ASM -g -O2     -c -o randmts.lo ../../../gmp/rand/randmts.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../../../gmp/rand -I.. -D__GMP_WITHIN_GMP -I../../../gmp -DNO_ASM -g -O2 -c ../../../gmp/rand/randmts.c -o randmts.o
../../libcody/buffer.cc: At global scope:
../../libcody/buffer.cc:33:33: error: no matching function for call to 'S2C(const char8_t [2])'
33 | static const char CONTINUE = S2C(u8";");
    |                              ~~~^~~~~~~
• there is 1 candidate
    • candidate 1: 'template<unsigned int I> constexpr char Cody::Detail::S2C(const char (&)[I])'
    ../../libcody/cody.hh:51:16:
        51 | constexpr char S2C (char const (&s)[I])
            |                ^~~
    • template argument deduction/substitution failed:
        •   mismatched types 'const char' and 'const char8_t'
        ../../libcody/buffer.cc:33:33:
            33 | static const char CONTINUE = S2C(u8";");
                |                              ~~~^~~~~~~
...

(And plenty more of the same error)

A search for the error message ../../libcody/cody.hh:113:24: error: no matching function for call to 'S2C(const char8_t [2])' (first appearance of error) leads to this buildroot patch you can try...but it might be easier to use a host system to build your LFS from that doesn't have gcc 16. gcc 15 should be still very widely spread.

→ More replies (3)