From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: Benjamin Lovy <ben@tangram.dev>
Cc: gcc-help <gcc-help@gcc.gnu.org>
Subject: Re: Compile GCC using only tools isolated from host environment
Date: Tue, 15 Mar 2022 08:46:09 +0000 [thread overview]
Message-ID: <CAH6eHdSvq47pVkteJ9He5Er4NsYh1EbpVHnr0dm4PnHD8BGOUQ@mail.gmail.com> (raw)
In-Reply-To: <CAH9OHLJ_EnbTA6Ga8w77tGEijjHYadB8s_1dk4TLUH5oCGS5Ew@mail.gmail.com>
On Mon, 14 Mar 2022, 22:44 Benjamin Lovy, <ben@tangram.dev> 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.
next prev parent reply other threads:[~2022-03-15 8:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-14 22:43 Benjamin Lovy
2022-03-15 7:19 ` Xi Ruoyao
2022-03-16 16:06 ` Benjamin Lovy
2022-03-15 8:46 ` Jonathan Wakely [this message]
2022-05-03 8:26 ` Question related to -fPIC behaviour across architectures vincent Dupaquis
2022-05-03 10:24 ` Xi Ruoyao
2022-05-03 13:29 ` vincent Dupaquis
2022-05-03 14:29 ` Florian Weimer
2022-05-03 15:45 ` vincent Dupaquis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAH6eHdSvq47pVkteJ9He5Er4NsYh1EbpVHnr0dm4PnHD8BGOUQ@mail.gmail.com \
--to=jwakely.gcc@gmail.com \
--cc=ben@tangram.dev \
--cc=gcc-help@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).