[lfs-dev] gcc fails to build

John Frankish john.frankish at outlook.com
Thu Nov 8 02:50:25 PST 2018


Ref:

Linux From Scratch - Version SVN-20181029
Chapter 5. Constructing a Temporary System
5.5. GCC-8.2.0 - Pass 1

Using the latest script to update the dynamic linker results in gcc failing to build.

Using a previous script fixes the problem.

Details below.

Regards
John

----------

This script:

for file in gcc/config/{linux,i386/linux{,64}}.h
do
  cp -uv $file{,.orig}
  sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' \
      -e 's@/usr@/tools at g' $file.orig > $file
  echo '
#undef STANDARD_STARTFILE_PREFIX_1
#undef STANDARD_STARTFILE_PREFIX_2
#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"
#define STANDARD_STARTFILE_PREFIX_2 ""' >> $file
  touch $file.orig
done

results in:

g++ -fno-PIE -c  -DIN_GCC_FRONTEND -DIN_GCC_FRONTEND -g -O2 -DIN_GCC  -DCROSS_DIRECTORY_STRUCTURE   -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings   -DHAVE_CONFIG_H -I. -Ic-family -I../../gcc -I../../gcc/c-family -I../../gcc/../include -I../../gcc/../libcpp/include -I/mnt/tc/sources/gcc-8.2.0/build/./gmp -I/mnt/tc/sources/gcc-8.2.0/gmp -I/mnt/tc/sources/gcc-8.2.0/build/./mpfr/src -I/mnt/tc/sources/gcc-8.2.0/mpfr/src -I/mnt/tc/sources/gcc-8.2.0/mpc/src  -I../../gcc/../libdecnumber -I../../gcc/../libdecnumber/dpd -I../libdecnumber -I../../gcc/../libbacktrace   -o c-family/c-cppbuiltin.o -MT c-family/c-cppbuiltin.o -MMD -MP -MF c-family/.deps/c-cppbuiltin.TPo ../../gcc/c-family/c-cppbuiltin.c
In file included from ./tm.h:38:0,
                 from ../../gcc/target.h:52,
                 from ../../gcc/c-family/c-cppbuiltin.c:23:
../../gcc/c-family/c-cppbuiltin.c: In function 'void c_cpp_builtins(cpp_reader*)':
../../gcc/config/i386/linux-common.h:25:7: error: 'GNU_USER_TARGET_OS_CPP_BUILTINS' was not declared in this scope
       GNU_USER_TARGET_OS_CPP_BUILTINS();       \
       ^
../../gcc/c-family/c-cppbuiltin.c:1415:3: note: in expansion of macro 'TARGET_OS_CPP_BUILTINS'
   TARGET_OS_CPP_BUILTINS ();
   ^~~~~~~~~~~~~~~~~~~~~~
../../gcc/config/i386/linux-common.h:25:7: note: suggested alternative: 'ANDROID_TARGET_OS_CPP_BUILTINS'
       GNU_USER_TARGET_OS_CPP_BUILTINS();       \
       ^
../../gcc/c-family/c-cppbuiltin.c:1415:3: note: in expansion of macro 'TARGET_OS_CPP_BUILTINS'
   TARGET_OS_CPP_BUILTINS ();
   ^~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [Makefile:1110: c-family/c-cppbuiltin.o] Error 1
make[2]: Leaving directory '/mnt/tc/sources/gcc-8.2.0/build/gcc'
make[1]: *** [Makefile:4255: all-gcc] Error 2
make[1]: Leaving directory '/mnt/tc/sources/gcc-8.2.0/build'
make: *** [Makefile:890: all] Error 2

This script works:

for file in $(find gcc/config -name linux64.h -o -name linux.h)
do
  cp $file $file.orig
  sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' -e 's@/usr@/tools at g' $file.orig > $file
  echo '
#undef STANDARD_STARTFILE_PREFIX_1
#undef STANDARD_STARTFILE_PREFIX_2
#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"
#define STANDARD_STARTFILE_PREFIX_2 ""' >> $file
  touch $file.orig
done


More information about the lfs-dev mailing list