LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (https://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   LFS 7.7 - Error when building GCC first pass (https://www.linuxquestions.org/questions/linux-from-scratch-13/lfs-7-7-error-when-building-gcc-first-pass-4175540009/)

followj 04-17-2015 01:16 PM

LFS 7.7 - Error when building GCC first pass
 
I'm building my LFS system using Linux Mint 17.1, and when running "make" from GCC first pass (page 37 - LFS 7.7 systemd), I got an error.

Output of

Code:

../gcc-4.9.2/configure --target=$LFS_TGT --prefix=/tools --with-sysroot=$LFS --with-newlib --without-headers --with-local-prefix=/tools --with-native-system-header-dir=/tools/include --disable-nls --disable-shared --disable-multilib --disable-decimal-float --disable-threads --disable-libatomic --disable-libgomp --disable-libitm --disable-libquadmath --disable-libsanitizer --disable-libssp --disable-libvtv --disable-libcilkrts --disable-libstdc++-v3 --enable-languages=c,c++
is
Code:

checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-lfs-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for a sed that does not truncate output... /bin/sed
checking for gawk... gawk
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking whether g++ accepts -static-libstdc++ -static-libgcc... yes
checking for gnatbind... no
checking for gnatmake... no
checking whether compiler driver understands Ada... no
checking how to compare bootstrapped objects... cmp --ignore-initial=16 $$f1 $$f2
checking for objdir... .libs
checking for version 0.10 of ISL... no
checking for version 0.11 of ISL... no
checking for version 0.12 of ISL... no
*** This configuration is not supported in the following subdirectories:
    target-libquadmath gnattools target-libada target-libgfortran target-libgo target-libffi target-libbacktrace target-zlib target-libjava target-libobjc target-libgomp target-libcilkrts target-libatomic target-libitm target-libstdc++-v3 target-libsanitizer target-libvtv target-libssp target-boehm-gc
    (Any other directories should still work fine.)
checking for default BUILD_CONFIG...
checking for --enable-vtable-verify... no
checking for bison... bison -y
checking for bison... bison
checking for gm4... no
checking for gnum4... no
checking for m4... m4
checking for flex... no
checking for lex... no
checking for flex... no
checking for makeinfo... makeinfo
checking for expect... no
checking for runtest... no
checking for ar... ar
checking for as... as
checking for dlltool... no
checking for ld... ld
checking for lipo... no
checking for nm... nm
checking for ranlib... ranlib
checking for strip... strip
checking for windres... no
checking for windmc... no
checking for objcopy... objcopy
checking for objdump... objdump
checking for readelf... readelf
checking for x86_64-lfs-linux-gnu-cc... no
checking for x86_64-lfs-linux-gnu-gcc... no
checking for x86_64-lfs-linux-gnu-c++... no
checking for x86_64-lfs-linux-gnu-g++... no
checking for x86_64-lfs-linux-gnu-cxx... no
checking for x86_64-lfs-linux-gnu-gxx... no
checking for x86_64-lfs-linux-gnu-gcc... no
checking for x86_64-lfs-linux-gnu-gcj... no
checking for x86_64-lfs-linux-gnu-gfortran... no
checking for x86_64-lfs-linux-gnu-gccgo... no
checking for ar... /tools/x86_64-lfs-linux-gnu/bin/ar
checking for as... /tools/x86_64-lfs-linux-gnu/bin/as
checking for dlltool... no
checking for x86_64-lfs-linux-gnu-dlltool... no
checking for ld... /tools/x86_64-lfs-linux-gnu/bin/ld
checking for lipo... no
checking for x86_64-lfs-linux-gnu-lipo... no
checking for nm... /tools/x86_64-lfs-linux-gnu/bin/nm
checking for objdump... /tools/x86_64-lfs-linux-gnu/bin/objdump
checking for ranlib... /tools/x86_64-lfs-linux-gnu/bin/ranlib
checking for readelf... no
checking for x86_64-lfs-linux-gnu-readelf... x86_64-lfs-linux-gnu-readelf
checking for strip... /tools/x86_64-lfs-linux-gnu/bin/strip
checking for windres... no
checking for x86_64-lfs-linux-gnu-windres... no
checking for windmc... no
checking for x86_64-lfs-linux-gnu-windmc... no
checking where to find the target ar... pre-installed in /tools/x86_64-lfs-linux-gnu/bin
checking where to find the target as... pre-installed in /tools/x86_64-lfs-linux-gnu/bin
checking where to find the target cc... just compiled
checking where to find the target c++... just compiled
checking where to find the target c++ for libstdc++... just compiled
checking where to find the target dlltool... pre-installed
checking where to find the target gcc... just compiled
checking where to find the target gcj... pre-installed
checking where to find the target gfortran... pre-installed
checking where to find the target gccgo... pre-installed
checking where to find the target ld... pre-installed in /tools/x86_64-lfs-linux-gnu/bin
checking where to find the target lipo... pre-installed
checking where to find the target nm... pre-installed in /tools/x86_64-lfs-linux-gnu/bin
checking where to find the target objdump... pre-installed in /tools/x86_64-lfs-linux-gnu/bin
checking where to find the target ranlib... pre-installed in /tools/x86_64-lfs-linux-gnu/bin
checking where to find the target readelf... pre-installed
checking where to find the target strip... pre-installed in /tools/x86_64-lfs-linux-gnu/bin
checking where to find the target windres... pre-installed
checking where to find the target windmc... pre-installed
checking whether to enable maintainer-specific portions of Makefiles... no
configure: creating ./config.status
config.status: creating Makefile

Last lines of the "make" output (the entire output is very long):

Code:

In file included from ./tm.h:35:0,
                from ../../gcc-4.9.2/gcc/c-family/c-cppbuiltin.c:23:
../../gcc-4.9.2/gcc/c-family/c-cppbuiltin.c: In function 'void c_cpp_builtins(cpp_reader*)':
../../gcc-4.9.2/gcc/config/i386/linux-common.h:25:39: error: 'GNU_USER_TARGET_OS_CPP_BUILTINS' was not declared in this scope
      GNU_USER_TARGET_OS_CPP_BUILTINS();      \
                                      ^
../../gcc-4.9.2/gcc/c-family/c-cppbuiltin.c:1062:3: note: in expansion of macro 'TARGET_OS_CPP_BUILTINS'
  TARGET_OS_CPP_BUILTINS ();
  ^
make[2]: *** [c-family/c-cppbuiltin.o] Error 1
make[2]: Leaving directory `/mnt/lfs/sources/gcc-build/gcc'
make[1]: *** [all-gcc] Error 2
make[1]: Leaving directory `/mnt/lfs/sources/gcc-build'
make: *** [all] Error 2

What does that error mean? And how can I fix it?

Thanks.

EDIT:

Output of "version-check.sh":

Code:

bash, version 4.3.11(1)-release
/bin/sh -> /bin/bash
Binutils: (GNU Binutils for Ubuntu) 2.24
bison (GNU Bison) 3.0.2
/usr/bin/yacc -> /usr/bin/bison.yacc
bzip2,  Version 1.0.6, 6-Sept-2010.
Coreutils:  8.21
diff (GNU diffutils) 3.3
find (GNU findutils) 4.4.2
GNU Awk 4.0.1
/usr/bin/awk -> /usr/bin/gawk
gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2
g++ (Ubuntu 4.8.2-19ubuntu1) 4.8.2
(Ubuntu EGLIBC 2.19-0ubuntu6.3) 2.19
grep (GNU grep) 2.16
gzip 1.6
Linux version 3.13.0-37-generic (buildd@kapok) (gcc version 4.8.2 (Ubuntu 4.8.2-19ubuntu1) ) #64-Ubuntu SMP Mon Sep 22 21:28:38 UTC 2014
m4 (GNU M4) 1.4.17
GNU Make 3.81
GNU patch 2.7.1
Perl version='5.18.2';
sed (GNU sed) 4.2.2
tar (GNU tar) 1.27.1
makeinfo (GNU texinfo) 5.2
xz (XZ Utils) 5.1.0alpha
g++ compilation OK


business_kid 04-17-2015 02:33 PM

Did you find this by doing a search?
http://www.linuxquestions.org/questi...27-4175441951/
Did you try it?

followj 04-17-2015 02:41 PM

Quote:

Originally Posted by business_kid (Post 5349027)
Did you find this by doing a search?
http://www.linuxquestions.org/questi...27-4175441951/
Did you try it?

I had seen this thread. The problem was solved by installing texinfo and changing the symlink /bin/sh. In my case, both of them are ok, and the script "version-check.sh" doesn't point out any missing software. Before trying to build LFS I had to install bison and texinfo to match version-check requirements.
The problem might be inside one of these packages (bison/yacc/texinfo), I'm looking to see if I can find it.

spiky0011 04-17-2015 03:46 PM

This post might be better in Linx from Scratch forum I have asked for it to be moved

followj 04-17-2015 09:24 PM

Solution
 
Ok, I found what might be the cause.
In the first time I ran this command:

Code:

for file in \
$(find gcc/config -name linux64.h -o -name linux.h -o -name sysv4.h)
do
cp -uv $file{,.orig}
sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&@g' \
-e 's@/usr@/tools@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

I typed every character by hand, and I made a mistake in "$file{,.orig}" because I typed "$file{, .orig}" and I got some strange outputs from sed saying that it coudn't locate the files. So I ran it again but I copied and pasted it instead of typing by hand, and everything looked ok.
So, an interesting thing is that when I got the error from "make", I tried to fix it by removing "gcc-build" dir, creating it again and starting from there.
But then, after HOURS trying to fix this, I simply removed gcc-4.9.2 and started again from unpacking gcc-4.9.2.tar.bz2. Then things just worked.
So, my conclusion is: the cause of the problem was probably my first run of the above command in which I typed a space where shoudn't be one. But something I also noticed was the fact that I was using /bin/dash when I ran all of this because I changed /bin/sh but didn't close the terminal session, so I ran the commands with dash, resulting in a possible different behavior of the command (I have no idea if that makes sense).

So, all this trouble was probably caused by: a space character, or the great idea of changing /bin/sh but continue to use the same gnome-terminal session.

business_kid 04-18-2015 03:03 AM

LFS is like that. Chalk it up to experience. Glad you found it.

TobiSGD 04-18-2015 03:44 AM

Moved: This thread is more suitable in <Distributions - Linux From Scratch> and has been moved accordingly to help your thread/question get the exposure it deserves.


All times are GMT -5. The time now is 07:50 AM.