public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: Thomas Sobczynski <tsobczynski@werfen.com>
Cc: Xi Ruoyao <xry111@mengyan1223.wang>,
	"gcc-help@gcc.gnu.org" <gcc-help@gcc.gnu.org>
Subject: Re: [EXTERNAL] Re: Compiling GCC 11 for Windows targeting ARM on Linux
Date: Tue, 11 Jan 2022 11:14:13 +0000	[thread overview]
Message-ID: <CAH6eHdTMOFMd=pw8A3pym-yEG0X_Z3nmc6QaS5VbW4F15wcSOQ@mail.gmail.com> (raw)
In-Reply-To: <VI1PR0402MB3853B4A7317F2739E490DB2ACD519@VI1PR0402MB3853.eurprd04.prod.outlook.com>

On Tue, 11 Jan 2022 at 03:45, Thomas Sobczynski via Gcc-help
<gcc-help@gcc.gnu.org> wrote:
>
> Update: I kept peering at the configure scripts and their embedded comments, and concluded that it's at least worth trying to add "--with-newlib" to the configure script parameters. That may not be the right move, but it did get me further into the build process. However, although its configure script finished, the GCC build seems unable to compile libstdc++ (tail end of output below).
>
> Am I barking up the wrong tree with "--with-newlib"?
>
> Does it make sense that the build is supplying include search directories from the GCC v11 build tree (compiler being compiled) to the native cross compiler which is GCC v9.x?

Yes. You are compiling the libstdc++ from GCC 11, so it has to look at
the headers for the GCC 11 version of libstdc++.

You can't use GCC 9 to compile libstdc++ from GCC 11, because GCC 9
doesn't support all the C++ features used in the GCC 11 lirbary (this
is nothing to do with cross compilation, you can never use a
mismatching version of GCC, newer or older, to compile libstdc++, it
just doesn't usually happen unless cross compiling like this).

You need a newer arm cross compiler (ideally it should exactly match
the version of GCC you are trying to build).



> I already misunderstood the build/host/target config earlier. Is it perhaps not _a_ GCC cross toolchain that I need, but perhaps I need to build _the_ compiler (v11) and then turn around and use it to build for the non-native Host?

No.


This might help, it's a script I used last week to build a build!=host
compiler. You'll need to adjust the flags for your own case:

#!/bin/bash

gcc_common_args='--enable-languages=c++ --disable-nls --without-isl
--disable-libcc1 --disable-libgomp --disable-libsanitizer
--disable-libitm --without-lto --disable-multilib'

# Native GCC compiler
mkdir -p ~/build-canada/gcc-native
cd ~/build-canada/gcc-native
$skip1 ~/src/gcc/configure --prefix=$HOME/gcc/12 $gcc_common_args
--disable-bootstrap
make -j10 && make install

# Use the new native GCC
PATH=$HOME/gcc/12/bin:$PATH

# Cross binutils
mkdir -p ~/build-canada/binutils
cd ~/build-canada/binutils
$skip2 ~/src/binutils-gdb/configure --prefix=$HOME/gcc/aarch64
--disable-gdb --disable-sim --disable-werror \
--target=aarch64-none-linux-gnu \
--build=x86_64-pc-linux-gnu \
--with-sysroot=/home/iains/cross-roots/aarch64-none-linux-gnu
make -j10 && make install

# Cross GCC
mkdir -p ~/build-canada/gcc-cross
cd ~/build-canada/gcc-cross
$skip3 ~/src/gcc/configure --prefix=$HOME/gcc/aarch64 $gcc_common_args \
--target=aarch64-none-linux-gnu \
--build=x86_64-pc-linux-gnu \
--with-sysroot=/home/iains/cross-roots/aarch64-none-linux-gnu
make -j10 && make install

# Use new aarch64-none-linux-gnu-ld and aarc64-none-linux-gnu-g++ etc
PATH=$PATH:$HOME/gcc/aarch64/bin

# "Native cross" GCC
mkdir -p ~/build-canada/gcc-native-cross
cd ~/build-canada/gcc-native-cross
$skip4 ~/src/gcc/configure --prefix=/not/going/to/install $gcc_common_args \
--target=aarch64-none-linux-gnu \
--host=aarch64-none-linux-gnu \
--build=x86_64-pc-linux-gnu \
--with-sysroot=/home/iains/cross-roots/aarch64-none-linux-gnu
make -j10
#!/bin/bash

  parent reply	other threads:[~2022-01-11 11:14 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-10 16:47 Thomas Sobczynski
2022-01-10 17:16 ` Xi Ruoyao
2022-01-11  2:49   ` [EXTERNAL] " Thomas Sobczynski
2022-01-11  3:44     ` Thomas Sobczynski
2022-01-11  6:53       ` Xi Ruoyao
2022-01-11 11:19         ` Jonathan Wakely
2022-01-11 11:14       ` Jonathan Wakely [this message]
2022-01-12 18:39         ` Thomas Sobczynski
2022-01-12 19:09           ` Jonathan Wakely
2022-01-11 11:09     ` Jonathan Wakely
2022-01-10 17:24 ` Jonathan Wakely
2022-01-11  0:27   ` [EXTERNAL] " Thomas Sobczynski

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='CAH6eHdTMOFMd=pw8A3pym-yEG0X_Z3nmc6QaS5VbW4F15wcSOQ@mail.gmail.com' \
    --to=jwakely.gcc@gmail.com \
    --cc=gcc-help@gcc.gnu.org \
    --cc=tsobczynski@werfen.com \
    --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).