Hi Paul,

> On 25 Nov 2022, at 20:13, Andrew Pinski via Gcc <gcc@gcc.gnu.org> wrote:
> 
> On Fri, Nov 25, 2022 at 12:08 PM Paul Koning <paulkon...@comcast.net> wrote:
>> 
>>> On Nov 25, 2022, at 3:03 PM, Andrew Pinski <pins...@gmail.com> wrote:
>>> 
>>> On Fri, Nov 25, 2022 at 11:59 AM Paul Koning via Gcc <gcc@gcc.gnu.org> 
>>> wrote:
>>>> 
>>>> I'm trying to use fairly recent GCC sources (the gcc-darwin branch to be 
>>>> precise) to build Ada, starting with the latest (2020) release of Gnat 
>>>> from Adacore.
>>> 
>>> Are you building a cross compiler or a native compiler?
>>> If you are building a cross, you need to bootstrap a native compiler first.
>> 
>> I'm not sure.  The installed Gnat is x86_64-darwin; I want to build 
>> aarch64-darwin.
> 
> You have to build a x86_64-darwin compiler first with the same sources
> as you are building for aarch64-darwin.

So .. 
1/ if you are on arm64 Darwin, 
  - the first step is to bootstrap the compiler using Rosetta 2 and the 
available x86_64 gnat.

2/ if you are on x86_64 Darwin…
  - the first step is to bootstrap the compiler using the available x86-64 gnat.

then...
  - then you can build a cross to aarch64 using that just-build compiler.
  - then you can do a native cross (target==host!=build) using that, which will 
give you a usable native compiler for arm64 ..

(2 is what I was doing all the way through the development - until I recently 
got an arm64 machine)..

I know that Rosetta 2 bootstrap worked a few days ago …

BTW: the final step “native cross” can be a bit tricky in terms of configure 
line - since some configure steps cannot (in general) run the tools on the 
“foreign” host - so that you might need to specify the linker version (we don’t 
have the option to do —with-ld64=NN.MM yet, but there is code that cares about 
the version of ld64.. so)

>> But in any case, how does that relate to the error messages I got?  They 
>> don't seem to have anything to do with missing compilers, but rather with 
>> the use of language features too new for the available (downloadable) Gnat.
> 
> From https://gcc.gnu.org/install/prerequisites.html:
> "In order to build a cross compiler, it is strongly recommended to
> install the new compiler as native first, and then use it to build the
> cross compiler. Other native compiler versions may work but this is
> not guaranteed and *****will typically fail with hard to understand
> compilation errors during the build.****"
> 
> I added the emphasis but yes this is all documented correctly.

thanks for the reminder!

cheers
Iain

Reply via email to