The main difference between this article and the previous one is that there is no use of system GMP, MPFR, MPC, Cloog, etc., but using source code to compile.
1. Compile binutils:
Unzip the BINUTLS code into the SRC directory and create the Binutil directory in the build directory.
Execute in the Build/binutils directory:
.. /.. /src/binutils-2.25/configure--prefix=/home/charles/code/build_toolchain/toolchain--with-sysroot=/home/charles/ Code/build_toolchain/toolchain/arm-linux-gnueabi/sysroot--target=arm-linux-gnueabi
Make-j10-i-K Make
Install
2. Install kernel header file
Unzip the kernel code into the SRC directory, then go to the kernel code directory and execute:
Make Mrproper make
arch=arm vexpress_defconfig make arch=arm headers_check make Arch=arm
Install_hdr_path =/home/charles/code/build_toolchain/toolchain/arm-linux-gnueabi/sysroot/usr Headers_install Find
. /.. /toolchain/arm-linux-gnueabi/sysroot/usr/include/-name ". Install"-or-name ". Install.cmd "| Xargs RM-FV
We also need to add the location of this library to the Ld_library_path.
3. Enter the directory sequentially:
gmp-6.0.0 mpc-1.0.2 mpfr-3.1.2 ppl-1.1 cloog-0.18.1
Perform:
./configure--prefix=/home/charles/code/build_toolchain/toolchain make make
install
4. Create Bootstrap GCC
Create directory Build/gcc_first and enter into this directory to execute:
.. /.. /src/gcc-4.8.2/configure--build=i686-pc-linux-gnu --target=arm-linux-gnueabi--prefix=/home/charles/code/ Build_toolchain/toolchain--with-sysroot=/home/charles/code/build_toolchain/toolchain/arm-linux-gnueabi/sysroot --with-newlib--without-headers--disable-threads --enable-__cxa_atexit--disable-libmudflap-- Disable-libgomp--DISABLE-LIBSSP--disable-nls --disable-shared --disable-decimal-float -- With-gnu-ld --with-gnu-as--with-arch=armv7-a--with-mode=arm --with-float=softfp--with-fpu=vfpv3 -- Enable-languages=c --with-gmp=/home/charles/code/build_toolchain/toolchain--with-mpfr=/home/charles/code/ Build_toolchain/toolchain--with-ppl=/home/charles/code/build_toolchain/toolchain--with-cloog=/home/charles/ Code/build_toolchain/toolchain
Make All-gcc-j10-i-K make
INSTALL-GCC make
all-target-libgcc make
INSTALL-TARGET-LIBGCC
5. Compile GLIBC
First Execute:
Export path= $PATH:/home/charles/code/build_toolchain/toolchain/bin
Create directory BUILD/GLIBC, enter this directory, execute:
CC=ARM-LINUX-GNUEABI-GCC Ar=arm-linux-gnueabi-ar ranlib=arm-linux-gnueabi-ranlib. /.. /src/glibc-2.21/configure --build=i686-pc-linux-gnu --host=arm-linux-gnueabi--prefix=/usr -- With-headers=/home/charles/code/build_toolchain/toolchain/arm-linux-gnueabi/sysroot/usr/include -- Enable-add-ons--with-mode=arm
If you report an error similar to the following:
No rule to make target '/root/glibc-2.14-build/dlfcn/libdl.so.2 '
Execute make all first, and then
6. Compile the final gcc:
Create directory Build/gcc_final, execute:
.. /.. /src/gcc-4.8.2/configure--build=i686-pc-linux-gnu--target=arm-linux-gnueabi--prefix=/home/charles/code/build_ Toolchain/toolchain--with-sysroot=/home/charles/code/build_toolchain/toolchain/arm-linux-gnueabi/sysroot-- Disable-libmudflap--DISABLE-LIBSSP--disable-nls--disable-libstdcxx-pch--with-interwork--with-mode=arm-- With-fpu=vfpv3--with-arch=armv7-a--WITH-FLOAT=SOFTFP--enable-libgomp--enable-poison-system-directories-- Enable-symvers=gnu--enable-long-long--enable-threads--enable-languages=c,c++--enable-shared--enable-lto-- Enable-__cxa_atexit--with-gnu-as--with-gnu-ld--enable-__cxa_atexit --with-gmp=/home/charles/code/build_ Toolchain/toolchain--with-mpfr=/home/charles/code/build_toolchain/toolchain--with-ppl=/home/charles/code/build _toolchain/toolchain--with-cloog=/home/charles/code/build_toolchain/toolchain make all make
install
The resulting tool chain is as follows:
$./bin/arm-linux-gnueabi-gcc-v Using Built-in specs. COLLECT_GCC=./BIN/ARM-LINUX-GNUEABI-GCC collect_lto_wrapper=/home/charles/code/build_toolchain/toolchain/ Libexec/gcc/arm-linux-gnueabi/4.8.2/lto-wrapper Target:arm-linux-gnueabi configured with:. /.. /src/gcc-4.8.2/configure--build=i686-pc-linux-gnu--target=arm-linux-gnueabi--prefix=/home/charles/code/build_ Toolchain/toolchain--with-sysroot=/home/charles/code/build_toolchain/toolchain/arm-linux-gnueabi/sysroot-- Disable-libmudflap--DISABLE-LIBSSP--disable-nls--disable-libstdcxx-pch--with-interwork--with-mode=arm-- With-fpu=vfpv3--with-arch=armv7-a--WITH-FLOAT=SOFTFP--enable-libgomp--enable-poison-system-directories-- Enable-symvers=gnu--enable-long-long--enable-threads--enable-languages=c,c++--enable-shared--enable-lto-- Enable-__cxa_atexit--with-gnu-as--with-gnu-ld--enable-__cxa_atexit--with-gmp=/home/charles/code/build_ Toolchain/toolchain--with-mpfr=/home/charles/code/build_toolchain/toolchain--with-ppl=/Home/charles/code/build_toolchain/toolchain--with-cloog=/home/charles/code/build_toolchain/toolchain Thread
Model:posix gcc version 4.8.2 (GCC)
P. S.
1) at the beginning, with the GCC version is 4.9.2, in the 4th step, there is a similar "-meabi=5 not found" error, never found a solution, and finally had to switch to 4.8.2 version.
2 these several gmp-6.0.0 mpc-1.0.2 mpfr-3.1.2 ppl-1.1 cloog-0.18.1 module's dynamic library, only uses
Export Ld_library_path=/home/charles/code/build_toolchain/toolchain/lib
To use, or use the system.
3 You can use the script in the GCC code./contrib/download_prerequisites automatically downloads several of the above modules, also can go to their respective official website to download.
4): PPL code: Http://bugseng.com/products/ppl/download