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

HI,

Thank you for your suggestions.  I've tried the CFLAGS with fixed paths,
and am still not successful.

I think I am trying to do what you describe at the end - I want to produce
a GCC that only depends on artifacts found in my /bootstrap tree.  If I
move this whole tree to a new environment, I'd like to still be able to use
this compiler to build arbitrary software.

> 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.

On Tue, Mar 15, 2022 at 3:19 AM Xi Ruoyao <xry111@mengyan1223.wang> wrote:

> 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-16 16:06 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 [this message]
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=CAH9OHLL1_iqFY1a59ZdRAt11nxxmSFJC6u+XSOE_doTnhN0bbg@mail.gmail.com \
    --to=ben@tangram.dev \
    --cc=gcc-help@gcc.gnu.org \
    --cc=xry111@mengyan1223.wang \
    /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).