public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Xi Ruoyao <xry111@mengyan1223.wang>
To: Benjamin Lovy <ben@tangram.dev>, gcc-help@gcc.gnu.org
Subject: Re: Compile GCC using only tools isolated from host environment
Date: Tue, 15 Mar 2022 15:19:09 +0800	[thread overview]
Message-ID: <344e771c8f8317ad4ee6994db89cba1779df149f.camel@mengyan1223.wang> (raw)
In-Reply-To: <CAH9OHLJ_EnbTA6Ga8w77tGEijjHYadB8s_1dk4TLUH5oCGS5Ew@mail.gmail.com>

On Mon, 2022-03-14 at 18:43 -0400, Benjamin Lovy wrote:

/* snip */

> 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:
> 
> /build/gcc-11.2.0/configure \
> CFLAGS="-Wl,-dynamic-linker=/lib/ld-linux-x86-64.so.2 -Wl,-rpath,/lib
> -I/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include -I/usr/include
> -I/usr/include/linux -I/lib/gcc/x86_64-pc-linux-gnu/11.2.0/include-
> fixed
> -B/bin" \

I think these FLAGS are mistaken.  --sysroot won't expand -I/usr/include
to search $SYSROOT/usr/include for example.

And, Without "-O2" your GCC will be built without optimization, which
will make a stupidly slow compiler.

>   --prefix=/bootstrap/gcc \
> --host=x86_64-pc-linux-gnu \
> --with-sysroot=/bootstrap \

You need --with-build-sysroot instead of --with-sysroot.  Read
https://gcc.gnu.org/install/configure.html for their difference.

Please note --sysroot is mostly for cross-compilation.  If you are not
building a GCC which is meant to run in a new OS tree (chroot or
container, or even reboot into a new OS tree), it's likely you shouldn't
use sysroot at all.
-- 
Xi Ruoyao <xry111@mengyan1223.wang>
School of Aerospace Science and Technology, Xidian University

  reply	other threads:[~2022-03-15  7:19 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 [this message]
2022-03-16 16:06   ` Benjamin Lovy
2022-03-15  8:46 ` Jonathan Wakely
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=344e771c8f8317ad4ee6994db89cba1779df149f.camel@mengyan1223.wang \
    --to=xry111@mengyan1223.wang \
    --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).