From: Lance Fredrickson <lancethepants@gmail.com>
To: gcc-help@gcc.gnu.org
Subject: Re: Building a host-isolated gcc without faking cross-compiling
Date: Fri, 10 Sep 2021 11:46:44 -0600 [thread overview]
Message-ID: <86a5dbe8-28c1-3113-b585-4e195c3f6534@gmail.com> (raw)
In-Reply-To: <e2f59101-89e1-e7b2-d4ee-c748a9b633a5@falsifiable.net>
I think you probably want |--with-native-system-header-dir
|
|--with-native-system-header-dir=dirname|
Specifies thatdirnameis the directory that contains native system
header files, rather than/usr/include. This option is most useful if
you are creating a compiler that should be isolated from the system
as much as possible. It is most commonly used with
the--with-sysrootoption and will cause GCC to searchdirnameinside
the system root specified by that option.
Lance
On 9/10/2021 10:54 AM, Anthony de Almeida Lopes via Gcc-help wrote:
> I'd like to build gcc for a chroot on my current system. Linux From
> Scratch uses a method of faking a cross compiler by modifying the vendor
> field of the target string. For example, changing x86_64-pc-linux-gnu to
> x86_64-lfs-linux-gnu. I'd like to know if there's a way of avoiding
> this. While GCC builds fine for my host natively and it builds fine with
> the LFS method, I have so far been unable to build a host isolated copy
> any other way.
>
> I understand the recommended order is to build binutils and gcc first,
> then build glibc with them and finally rebuild gcc against that glibc.
>
> # I built binutils like this
>
> ../configure \
> --prefix=$DISTRO/root/bootstrap \
> --with-sysroot=$DISTRO \
> --disable-nls \
> --disable-werror
>
> && make -j6 && make -j1 install
>
> # Then I tried to build gcc like this
>
> ../configure \
> --prefix=$DISTRO/tools \
> --with-glibc-version=2.11 \
> --with-sysroot=$DISTRO \
> --with-newlib \
> --without-headers \
> --enable-initfini-array \
> --disable-nls \
> --disable-shared \
> --disable-multilib \
> --disable-decimal-float \
> --disable-threads \
> --disable-libatomic \
> --disable-libgomp \
> --disable-libquadmath \
> --disable-libssp \
> --disable-libvtv \
> --disable-libstdcxx \
> --enable-languages=c,c++
>
> && make -j6 && make -j1 install
>
> But this fails with a bunch of undefined references to the ZSTD
> namespace such as ZSTD_getErrorName from gcc/lto-compress.c. I assume
> this means that ./configure has detected that my host system has libzstd
> but it's trying to look for them in the sysroot, where it obviously
> can't find them. This happens even if I use --disable-lto.
>
> Build System (Arch Linux): linux 5.13.13, glibc 2.33, binutils 2.36.1,
> gcc 11.1.0
> Target System: linux 5.13.12, glibc 2.34, binutils 2.37, gcc 11.2.0
>
> So I'd like to know if I should continue like this, and if so how, or if
> there is a better (maybe canonical) way of building a host-isolated
> compiler?
>
> - Anthony
>
>
next prev parent reply other threads:[~2021-09-10 17:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-10 16:54 Anthony de Almeida Lopes
2021-09-10 17:46 ` Lance Fredrickson [this message]
2021-09-10 18:21 ` Anthony de Almeida Lopes
2021-09-10 18:42 ` Lance Fredrickson
2021-09-11 4:55 ` Anthony de Almeida Lopes
2021-09-11 8:32 ` Xi Ruoyao
2021-09-13 14:06 ` Anthony de Almeida Lopes
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=86a5dbe8-28c1-3113-b585-4e195c3f6534@gmail.com \
--to=lancethepants@gmail.com \
--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).