Sunday, December 27, 2020

Chapter 33 : Compile and Install GCC Pass-2 - Cross Compiling Temporary Tools

Hi,

In this chapter we are going to compile and install GCC package again, this is the second pass of the package.

Note :
- Please check the version of the package when you compile and install, at the time of writing the package was at version 10.2.0
- You should be logged in as lfs user, when you perform the actions described here.
- Change directory to the sources folder (/mnt/lfs/sources)

Remove the directory gcc-10.2.0 if it's still exist in sources directory.
$ rm -rf gcc-10.2.0

Unpack the package tarball and change directory.
$ tar -xvf gcc-10.2.0.tar.xz
$ cd gcc-10.2.0

Unpack the packages and move it to the gcc-10.2.0 directory.
$ tar -xf ../mpfr-4.1.0.tar.xz
$ mv -v mpfr-4.1.0 mpfr
$ tar -xf ../gmp-6.2.0.tar.xz
$ mv -v gmp-6.2.0 gmp
$ tar -xf ../mpc-1.1.0.tar.gz
$ mv -v mpc-1.1.0 mpc

If building on x86_64, change the default directory name for 64-bit libraries to “lib”
$ case $(uname -m) in
  x86_64)
    sed -e '/m64=/s/lib64/lib/' -i.orig gcc/config/i386/t-linux64
  ;;
esac

Create the build directory and move into it.
$ mkdir -v build
$ cd build

Create a symlink that allows libgcc to be built with posix threads support
$ mkdir -pv $LFS_TGT/libgcc
$ ln -s ../../../libgcc/gthr-posix.h $LFS_TGT/libgcc/gthr-default.h

Preparing Gcc package for compilation.
../configure                                       \
    --build=$(../config.guess)                     \
    --host=$LFS_TGT                                \
    --prefix=/usr                                  \
    CC_FOR_TARGET=$LFS_TGT-gcc                     \
    --with-build-sysroot=$LFS                      \
    --enable-initfini-array                        \
    --disable-nls                                  \
    --disable-multilib                             \
    --disable-decimal-float                        \
    --disable-libatomic                            \
    --disable-libgomp                              \
    --disable-libquadmath                          \
    --disable-libssp                               \
    --disable-libvtv                               \
    --disable-libstdcxx                            \
    --enable-languages=c,c++

Compiling the package
$ make -j4

Installing the package
$ make DESTDIR=$LFS install

Creating a utility symlink.
$ ln -sv gcc $LFS/usr/bin/cc





No comments:

Post a Comment

Addressing Modes of 8080 / 8085 MicroProcessor

Hi,   In this post I am going to talk about different addressing modes of 8080/8085...without much talking let us get into the topic.   Ther...