Re: Compile GCC using only tools isolated from host environment

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 14 Mar 2022, 22:44 Benjamin Lovy, <ben@xxxxxxxxxxx> wrote:

> Hello,
>
> I am attempting to build GCC 11.2.0 in an isolated environment.  First, I
> grabbed the Linux headers:
>
> make headers_install \
> ARCH=x86_64 \
> INSTALL_HDR_PATH=/bootstrap/usr
>
> Then, I built binutils:
>
> mkdir binutils-build && \
>   cd binutils-build &&
>   /build/binutils-2.38/configure \
> --prefix=/bootstrap \
> --with-sysroot=/bootstrap \
> --disable-nls \
> --disable-werror && \
> make -j16 && \
> make install
>
> Then, I built GCC using the host toolchain:
>
> mkdir /build/gcc-build && \
>   cd gcc-build &&
>   /build/gcc-11.2.0/configure \
> --prefix=/bootstrap/ \
> --host=x86_64-pc-linux-gnu \
> --enable-languages=c,c++ \
> --disable-bootstrap \
> --disable-decimal-float \
> --disable-fixed-point \
> --disable-libatomic \
> --disable-libgomp \
> --disable-libitm \
> --disable-libmpx \
> --disable-libquadmath \
> --disable-libsanitizer \
> --disable-libssp \
> --disable-libvtv \
> --disable-lto \
> --disable-multilib \
> --disable-nls && \
> make -j16 && \
> make install
>
> Then, I built glibc using this GCC:
>
> mkdir glibc-build && \
>   cd glibc-build && \
>   /build/glibc-2.34/configure \
> CC=/bootstrap/bin/gcc \
> CFLAGS="-fno-stack-protector -O2" \
> CPPFLAGS="-U_FORTIFY_SOURCE" \
> --prefix=/bootstrap \
> --with-sysroot=/bootstrap \
> --with-headers=/bootstrap/usr/include &&\
> make -j16 && \
> make install
>
> This all works fine.  I then build the following software:
>
> * GMP 6.21
> * MPFR 4.10
> * MPC 1.21
> * tar 1.34
> * bash 5.16
> * coreutils 9.0
> * curl 7.82
> * zlib 1.2.11
> * gzip 1.11
> * sed 4.8
> * grep 2.28
> * gawk 5.11
> * make 4.3
> * xz 5.25
>
> I use invocations similar to this for each entry on that list:
>
> ./configure \
> CC=/bootstrap/bin/gcc \
> CFLAGS="-Wl,-dynamic-linker=/bootstrap/lib/ld-linux-x86-64.so.2
> -Wl,-rpath,/bootstrap/lib -I/bootstrap/include" \
> --with-sysroot=/bootstrap \
> --prefix=/bootstrap && \
> make -j16 && \
> make check && \
> make install
>
> Now, I would like to build a fresh GCC using the previously build GCC, this
> glib, and the GMP/MPC/MPFR libraries I just built:
>

I recommend you don't do that.

Use the contrib/download_prerequisites script instead, see
https://gcc.gnu.org/wiki/InstallingGCC

This doesn't solve your header path issue, but it's much simpler and
cleaner anyway.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux