lfscript-revision20170513 gcc build error

Asked by Mykola

Have some sort of problem with building lfscript-revision20170513

Command to execute:
./lfscript -Bx "wget nano os-prober" -i /mnt/install_root

But, on lfs book there is no error

Screenshot of error
https://postimg.cc/4KHSrY0y
I dunno where is logs to see where is the source of error...

Wait for help

Question information

Language:
English Edit question
Status:
Solved
For:
LFScript Edit question
Assignee:
No assignee Edit question
Solved by:
Mykola
Solved:
Last query:
Last reply:
Revision history for this message
fakı (afyonluenes) said :
#1

please error log.

Revision history for this message
Mykola (mykola-kikets) said :
#2
Revision history for this message
fakı (afyonluenes) said :
#3

WGETLIST="http://ftp.gnu.org/gnu/gcc/gcc-6.3.0/gcc-6.3.0.tar.bz2
          http://ftp.gnu.org/gnu/gmp/gmp-6.1.2.tar.xz
          http://www.mpfr.org/mpfr-3.1.5/mpfr-3.1.5.tar.xz
          http://www.multiprecision.org/mpc/download/mpc-1.0.3.tar.gz"
MD5SUMLIST="677a7623c7ef6ab99881bc4e048debb6
            f58fa8001d60c4c77595fbbb62b63c1d
            c4ac246cf9795a4491e7766002cd528f
            d6a1d5f8ddea3abd2cc3e98f58352d26"

###############################################
installation() { # INSTALLING SYSTEM SOFTWARE #
###############################################

case $(uname -m) in
  x86_64)
    sed -e '/m64=/s/lib64/lib/' \
        -i.orig gcc/config/i386/t-linux64
  ;;
esac

mkdir -v build
cd build

SED=sed \
../configure --prefix=/usr \
             --enable-languages=c,c++ \
             --disable-multilib \
             --disable-bootstrap \
             --with-system-zlib

make

make DESTDIR=${FAKEROOT} install

ln -sv ../usr/bin/cpp ${FAKEROOT}/lib

ln -sv gcc ${FAKEROOT}/usr/bin/cc

install -v -dm755 ${FAKEROOT}/usr/lib/bfd-plugins
ln -sfv ../../libexec/gcc/$(gcc -dumpmachine)/6.3.0/liblto_plugin.so \
        ${FAKEROOT}/usr/lib/bfd-plugins/

mkdir -pv ${FAKEROOT}/usr/share/gdb/auto-load/usr/lib
mv -v ${FAKEROOT}/usr/lib/*gdb.py ${FAKEROOT}/usr/share/gdb/auto-load/usr/lib

#####################################################################
}; preparation_pass1() { # CONSTRUCTING A TEMPORARY SYSTEM (PASS 1) #
#####################################################################

tar -xf ../mpfr-3.1.5.tar.xz
mv -v mpfr-3.1.5 mpfr
tar -xf ../gmp-6.1.2.tar.xz
mv -v gmp-6.1.2 gmp
tar -xf ../mpc-1.0.3.tar.gz
mv -v mpc-1.0.3 mpc

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

case $(uname -m) in
  x86_64)
    sed -e '/m64=/s/lib64/lib/' \
        -i.orig gcc/config/i386/t-linux64
 ;;
esac

mkdir -v build
cd build

../configure \
    --target=$LFS_TGT \
    --prefix=/tools \
    --with-glibc-version=2.11 \
    --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-libmpx \
    --disable-libquadmath \
    --disable-libssp \
    --disable-libvtv \
    --disable-libstdcxx \
    --enable-languages=c,c++

make

make install

#########################################################################
}; preparation_pass2() { # CONSTRUCTING A THE TEMPORARY SYSTEM (PASS 2) #
#########################################################################

cat gcc/limitx.h gcc/glimits.h gcc/limity.h > \
  `dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/include-fixed/limits.h

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

case $(uname -m) in
  x86_64)
    sed -e '/m64=/s/lib64/lib/' \
        -i.orig gcc/config/i386/t-linux64
  ;;
esac

tar -xf ../mpfr-3.1.5.tar.xz
mv -v mpfr-3.1.5 mpfr
tar -xf ../gmp-6.1.2.tar.xz
mv -v gmp-6.1.2 gmp
tar -xf ../mpc-1.0.3.tar.gz
mv -v mpc-1.0.3 mpc

mkdir -v build
cd build

CC=$LFS_TGT-gcc \
CXX=$LFS_TGT-g++ \
AR=$LFS_TGT-ar \
RANLIB=$LFS_TGT-ranlib \
../configure \
    --prefix=/tools \
    --with-local-prefix=/tools \
    --with-native-system-header-dir=/tools/include \
    --enable-languages=c,c++ \
    --disable-libstdcxx-pch \
    --disable-multilib \
    --disable-bootstrap \
    --disable-libgomp

make

make install

ln -sv gcc /tools/bin/cc

#########################################################################
}; preparation() { # CONSTRUCTING A TEMPORARY SYSTEM (SCRIPT DELEGATOR) #
#########################################################################

if [ "${GCC_PASS1}" != "completed" ]; then
    preparation_pass1
    GCC_PASS1="completed"
else
    preparation_pass2
fi

#################
} # END OF FILE #
#################

Revision history for this message
fakı (afyonluenes) said :
#4

this script please

Revision history for this message
Mykola (mykola-kikets) said :
#5

same error

Revision history for this message
Mykola (mykola-kikets) said :
#6

Ok... I solved this problem by myself....

Next is little solve history:

So... The main reason "why this thing didn`t compile" is that gcc-6.3.0 CAN`T BE COMPILED FROM SOURCE...

in gcc-6.3.0 we have next error:

../../gcc/ubsan.c:1474:23: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
       || xloc.file == '\0' || xloc.file[0] == '\xff'
                       ^~~~
Makefile:1085: recipe for target 'ubsan.o' failed

that means "I CAN`T"...

But, this doesn`t mean that you can`t compile it
There is 2 ways for solving that:

    1) The first one is "change the code":
        You need to "untar" the archive and find file "gcc-6.3.0/gcc/ubsan.c"

        In gcc in file "gcc/ubsan.c" on line 1473 we have next 4 lines:
                     if (xloc.file == NULL || strncmp (xloc.file, "\1", 2) == 0
                           || xloc.file == '\0' || xloc.file[0] == '\xff'
                           || xloc.file[1] == '\xff')
                         return false;
         You need to change the " xloc.file == '\0' " to " xloc.file[0] == '\0' "
         than archive it back and change in "gcc" and "libstdc++" scripts md5sum hash to new one (u can get by "md5sum" command)
         and after that its gonna work (i made this way)
     2) The second is "change the link source":
          If you don`t need to make "way #1" every time you can make this:
               you need to change link and md5sum in "gcc" and "libstdc++" to (at least) gcc with version 6.4.0
          This way you can use only 1 time and feel free from problems...

Little message to lfscript developers:
  when will be next revision of lfscript? last release in 2019.01.27 is 20170513???