public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Can't build Ada
@ 2022-11-25 19:57 Paul Koning
  2022-11-25 20:03 ` Andrew Pinski
  0 siblings, 1 reply; 17+ messages in thread
From: Paul Koning @ 2022-11-25 19:57 UTC (permalink / raw)
  To: GCC Development

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.

It fails for several reasons.  One is that two source files use [ ] for array initializer brackets when ( ) is apparently supposed to be used instead.  Once I fix that, I get a pile of messages I don't know what to do about:

s-imagei.ads:95:11: declare_expression is an Ada 2020 feature
s-valueu.ads:152:09: declare_expression is an Ada 2020 feature
s-valueu.ads:160:09: declare_expression is an Ada 2020 feature
s-valueu.ads:184:06: "Subprogram_Variant" is not a valid aspect identifier
s-valuei.ads:80:11: declare_expression is an Ada 2020 feature
s-valuei.ads:95:08: declare_expression is an Ada 2020 feature
s-valuei.ads:141:06: "Subprogram_Variant" is not a valid aspect identifier
s-widthu.ads:84:09: declare_expression is an Ada 2020 feature
s-widthu.ads:93:11: run-time library configuration error
s-widthu.ads:93:11: file s-imgint.ads had parser errors
s-widthu.ads:93:11: entity "System.Img_Int.Image_Integer" not available
compilation abandoned
make[2]: *** [ada/contracts.o] Error 1

Given that the current open source Gnat is from 2020, so (apparently) it doesn't support Ada 2020 features, how is someone supposed to build the current GCC?  I looked in the prerequisites listing on the webpage, but it says that the Gnat that is built on GCC 5.1 is sufficient.  That seems to be wrong; the GCC in Gnat 2020 is 8.4.1 and it is apparently too old to work.

	paul


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Can't build Ada
  2022-11-25 19:57 Can't build Ada Paul Koning
@ 2022-11-25 20:03 ` Andrew Pinski
  2022-11-25 20:08   ` Paul Koning
  0 siblings, 1 reply; 17+ messages in thread
From: Andrew Pinski @ 2022-11-25 20:03 UTC (permalink / raw)
  To: Paul Koning; +Cc: GCC Development

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.

Thanks,
Andrew Pinski

>
> It fails for several reasons.  One is that two source files use [ ] for array initializer brackets when ( ) is apparently supposed to be used instead.  Once I fix that, I get a pile of messages I don't know what to do about:
>
> s-imagei.ads:95:11: declare_expression is an Ada 2020 feature
> s-valueu.ads:152:09: declare_expression is an Ada 2020 feature
> s-valueu.ads:160:09: declare_expression is an Ada 2020 feature
> s-valueu.ads:184:06: "Subprogram_Variant" is not a valid aspect identifier
> s-valuei.ads:80:11: declare_expression is an Ada 2020 feature
> s-valuei.ads:95:08: declare_expression is an Ada 2020 feature
> s-valuei.ads:141:06: "Subprogram_Variant" is not a valid aspect identifier
> s-widthu.ads:84:09: declare_expression is an Ada 2020 feature
> s-widthu.ads:93:11: run-time library configuration error
> s-widthu.ads:93:11: file s-imgint.ads had parser errors
> s-widthu.ads:93:11: entity "System.Img_Int.Image_Integer" not available
> compilation abandoned
> make[2]: *** [ada/contracts.o] Error 1
>
> Given that the current open source Gnat is from 2020, so (apparently) it doesn't support Ada 2020 features, how is someone supposed to build the current GCC?  I looked in the prerequisites listing on the webpage, but it says that the Gnat that is built on GCC 5.1 is sufficient.  That seems to be wrong; the GCC in Gnat 2020 is 8.4.1 and it is apparently too old to work.
>
>         paul
>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Can't build Ada
  2022-11-25 20:03 ` Andrew Pinski
@ 2022-11-25 20:08   ` Paul Koning
  2022-11-25 20:13     ` Andrew Pinski
                       ` (3 more replies)
  0 siblings, 4 replies; 17+ messages in thread
From: Paul Koning @ 2022-11-25 20:08 UTC (permalink / raw)
  To: Andrew Pinski; +Cc: GCC Development



> On Nov 25, 2022, at 3:03 PM, Andrew Pinski <pinskia@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.

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.

	paul



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Can't build Ada
  2022-11-25 20:08   ` Paul Koning
@ 2022-11-25 20:13     ` Andrew Pinski
  2022-11-25 20:46       ` Iain Sandoe
  2022-11-25 20:17     ` Iain Sandoe
                       ` (2 subsequent siblings)
  3 siblings, 1 reply; 17+ messages in thread
From: Andrew Pinski @ 2022-11-25 20:13 UTC (permalink / raw)
  To: Paul Koning; +Cc: GCC Development

On Fri, Nov 25, 2022 at 12:08 PM Paul Koning <paulkoning@comcast.net> wrote:
>
>
>
> > On Nov 25, 2022, at 3:03 PM, Andrew Pinski <pinskia@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.

>
> 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,
Andrew Pinski

>
>         paul
>
>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Can't build Ada
  2022-11-25 20:08   ` Paul Koning
  2022-11-25 20:13     ` Andrew Pinski
@ 2022-11-25 20:17     ` Iain Sandoe
  2022-11-25 20:26     ` NightStrike
  2022-11-25 20:45     ` Alexandre Oliva
  3 siblings, 0 replies; 17+ messages in thread
From: Iain Sandoe @ 2022-11-25 20:17 UTC (permalink / raw)
  To: Paul Koning; +Cc: Andrew Pinski, GCC Development

Hi Paul,

> On 25 Nov 2022, at 20:08, Paul Koning via Gcc <gcc@gcc.gnu.org> wrote:
> 
>> On Nov 25, 2022, at 3:03 PM, Andrew Pinski <pinskia@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 are building a cross then.

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

Building a cross GNAT requires that the build compiler is from the same sources as the cross - so, as Andrew says, you need to bootstrap the current sources on x86_64 and then use that compiler to build the cross to aarch64.  I’m not sure exactly where this constraint is mentioned .. but, nevertheless, it is a constraint.

FWIW: I have not done this for a few weeks (using my arm64 prototype branch) but it was working fine then.

Iain


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Can't build Ada
  2022-11-25 20:08   ` Paul Koning
  2022-11-25 20:13     ` Andrew Pinski
  2022-11-25 20:17     ` Iain Sandoe
@ 2022-11-25 20:26     ` NightStrike
  2022-11-25 20:45     ` Alexandre Oliva
  3 siblings, 0 replies; 17+ messages in thread
From: NightStrike @ 2022-11-25 20:26 UTC (permalink / raw)
  To: Paul Koning; +Cc: Andrew Pinski, GCC Development

On Fri, Nov 25, 2022 at 3:09 PM Paul Koning via Gcc <gcc@gcc.gnu.org> wrote:
> 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.

Generally speaking, the reason is that with a normal compiler build,
where build = host = target, gcc can build itself and then run the
newly built self to build the language runtimes.  So if you're using
gcc 5 to build gcc 12, you're actually not using gcc 5 for all that
much.  The new gcc 12 is used to build for instance libX.  With a
cross compiler, it's possible that the build != host, and so you can't
use the newly built GCC in your build environment to build the
language runtimes.  For instance, say your cross compiler is hosted on
Windows, but you are building it on Linux.  You can't run the newly
built gcc 12, so you have to use the original gcc 5 instead.  That's
why you have to start with a new native compiler, and then use that to
build the cross compiler.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Can't build Ada
  2022-11-25 20:08   ` Paul Koning
                       ` (2 preceding siblings ...)
  2022-11-25 20:26     ` NightStrike
@ 2022-11-25 20:45     ` Alexandre Oliva
  3 siblings, 0 replies; 17+ messages in thread
From: Alexandre Oliva @ 2022-11-25 20:45 UTC (permalink / raw)
  To: Paul Koning via Gcc; +Cc: Andrew Pinski, Paul Koning

On Nov 25, 2022, Paul Koning via Gcc <gcc@gcc.gnu.org> wrote:

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

The gnat1 front-end requires some of the Ada runtime (libgnat)
components.  They get built as part of cross builds, so that the
compiler itself uses the features present in the runtime.

For bootstrapping purposes, stage1's gnat builds in a
less-runtime-demanding mode, that gets linked with the runtime of the
compiler used to build stage1, and that is then used to build the
runtime and later stages.

With this arrangement, the runtime components used by the compiler
itself may rely on language features that the build compiler doesn't
offer, at the cost of requiring cross builds to use a compiler that
supports those features.

-- 
Alexandre Oliva, happy hacker                https://FSFLA.org/blogs/lxo/
   Free Software Activist                       GNU Toolchain Engineer
Disinformation flourishes because many people care deeply about injustice
but very few check the facts.  Ask me about <https://stallmansupport.org>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Can't build Ada
  2022-11-25 20:13     ` Andrew Pinski
@ 2022-11-25 20:46       ` Iain Sandoe
  2022-11-26 15:48         ` Paul Koning
  0 siblings, 1 reply; 17+ messages in thread
From: Iain Sandoe @ 2022-11-25 20:46 UTC (permalink / raw)
  To: Paul Koning; +Cc: GCC Development

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 <paulkoning@comcast.net> wrote:
>> 
>>> On Nov 25, 2022, at 3:03 PM, Andrew Pinski <pinskia@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


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Can't build Ada
  2022-11-25 20:46       ` Iain Sandoe
@ 2022-11-26 15:48         ` Paul Koning
  2022-11-26 15:58           ` Iain Sandoe
  0 siblings, 1 reply; 17+ messages in thread
From: Paul Koning @ 2022-11-26 15:48 UTC (permalink / raw)
  To: Iain Sandoe; +Cc: GCC Development



> On Nov 25, 2022, at 3:46 PM, Iain Sandoe <idsandoe@googlemail.com> wrote:
> 
> 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 <paulkoning@comcast.net> wrote:
>>> 
>>>> On Nov 25, 2022, at 3:03 PM, Andrew Pinski <pinskia@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.

Thanks all.

I tried that (#1) and got the same failure.  The trouble seems to be that the current sources have Ada2020 constructs in them and the available Gnat doesn't support that version.  The commit that introduces these (or some of them at least) is 91d68769419b from Feb 4, 2022.

So I'm guessing I'll have to do this in two parts, first build a newer but not-latest Gnat from a release that doesn't include the problematic constructs, then follow that by using the intermediate to build the current sources.

I wonder if this incompatibility was intentional.  If not it would be good for the Ada maintainers to fix these and ensure that the current code can still be built with the most recent public release of Gnat.  Conversely, if it is intentional, the documentation should be updated to explain how to build the current code.

	paul



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Can't build Ada
  2022-11-26 15:48         ` Paul Koning
@ 2022-11-26 15:58           ` Iain Sandoe
  2022-11-26 16:27             ` Paul Koning
  0 siblings, 1 reply; 17+ messages in thread
From: Iain Sandoe @ 2022-11-26 15:58 UTC (permalink / raw)
  To: Paul Koning; +Cc: GCC Development

Hi Paul,

> On 26 Nov 2022, at 15:48, Paul Koning via Gcc <gcc@gcc.gnu.org> wrote:

>> On Nov 25, 2022, at 3:46 PM, Iain Sandoe <idsandoe@googlemail.com> wrote:
>> 

>>> 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 <paulkoning@comcast.net> wrote:
>>>> 
>>>>> On Nov 25, 2022, at 3:03 PM, Andrew Pinski <pinskia@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.
> 
> Thanks all.
> 
> I tried that (#1) and got the same failure.  The trouble seems to be that the current sources have Ada2020 constructs in them and the available Gnat doesn't support that version.  The commit that introduces these (or some of them at least) is 91d68769419b from Feb 4, 2022.

I am part way through the exercise on both macOS 11 (X86) and 12 (Arm64).

** However, I am using gcc-7.5 as the bootstrap compiler, not gcc-5.1.

You might find problems unless you actually start a Rosetta 2 shell - so 
“ arch -x86_64 bash “ 
and then go from there (this seems to ensure that sub-processes are started as x86_64)

(with this, bootstrap succeeded for both x86_64 Rosetta 2  and rebased Arm64 branch native - r13-4309-g309e2d95e3b9)

I will push the rebased arm64 branch when testing is done.

> So I'm guessing I'll have to do this in two parts, first build a newer but not-latest Gnat from a release that doesn't include the problematic constructs, then follow that by using the intermediate to build the current sources.
> 
> I wonder if this incompatibility was intentional.  If not it would be good for the Ada maintainers to fix these and ensure that the current code can still be built with the most recent public release of Gnat.  Conversely, if it is intentional, the documentation should be updated to explain how to build the current code.

The current statement  (https://gcc.gnu.org/install/prerequisites.html) is:

GNAT
In order to build GNAT, the Ada compiler, you need a working GNAT compiler (GCC version 5.1 or later).

so, if 5.1 is not working, then perhaps a PR is in order.

cheers
Iain


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Can't build Ada
  2022-11-26 15:58           ` Iain Sandoe
@ 2022-11-26 16:27             ` Paul Koning
  2022-11-26 16:42               ` Arnaud Charlet
  0 siblings, 1 reply; 17+ messages in thread
From: Paul Koning @ 2022-11-26 16:27 UTC (permalink / raw)
  To: Iain Sandoe; +Cc: GCC Development



> On Nov 26, 2022, at 10:58 AM, Iain Sandoe <idsandoe@googlemail.com> wrote:
> 
> Hi Paul,
> 
> I am part way through the exercise on both macOS 11 (X86) and 12 (Arm64).
> 
> ** However, I am using gcc-7.5 as the bootstrap compiler, not gcc-5.1.

I'm not using 5.1 -- I only quoted that version number because the install documentation mentions it.  The actual bootstrap compiler is 8.4.1:

pkoning:gcc-darwin-x86 pkoning$ /usr/local/gnat/bin/gcc --version
gcc (GCC) 8.4.1 20200430 (for GNAT Community 2020 20200818)

> You might find problems unless you actually start a Rosetta 2 shell - so 
> “ arch -x86_64 bash “ 
> and then go from there (this seems to ensure that sub-processes are started as x86_64)
> 
> (with this, bootstrap succeeded for both x86_64 Rosetta 2  and rebased Arm64 branch native - r13-4309-g309e2d95e3b9)
> 
> I will push the rebased arm64 branch when testing is done.
> 
>> So I'm guessing I'll have to do this in two parts, first build a newer but not-latest Gnat from a release that doesn't include the problematic constructs, then follow that by using the intermediate to build the current sources.
>> 
>> I wonder if this incompatibility was intentional.  If not it would be good for the Ada maintainers to fix these and ensure that the current code can still be built with the most recent public release of Gnat.  Conversely, if it is intentional, the documentation should be updated to explain how to build the current code.
> 
> The current statement  (https://gcc.gnu.org/install/prerequisites.html) is:
> 
> GNAT
> In order to build GNAT, the Ada compiler, you need a working GNAT compiler (GCC version 5.1 or later).
> 
> so, if 5.1 is not working, then perhaps a PR is in order.

I will do that, if the "shell in Rosetta" thing doesn't cure the problem.

	paul



^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Can't build Ada
  2022-11-26 16:27             ` Paul Koning
@ 2022-11-26 16:42               ` Arnaud Charlet
  2022-11-26 16:52                 ` Iain Sandoe
  2022-11-26 18:06                 ` Paul Koning
  0 siblings, 2 replies; 17+ messages in thread
From: Arnaud Charlet @ 2022-11-26 16:42 UTC (permalink / raw)
  To: Paul Koning; +Cc: Iain Sandoe, GCC Development


>> The current statement  (https://gcc.gnu.org/install/prerequisites.html) is:
>> 
>> GNAT
>> In order to build GNAT, the Ada compiler, you need a working GNAT compiler (GCC version 5.1 or later).
>> 
>> so, if 5.1 is not working, then perhaps a PR is in order.
> 
> I will do that, if the "shell in Rosetta" thing doesn't cure the problem.

You won’t need to, the version of gnat you are using is recent enough, you need to follow Ian’s instructions to the letter. The Ada 2022 code is a red herring and is only problematic when you build a cross with a non matching native, not when building a native compiler.

Arno

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Can't build Ada
  2022-11-26 16:42               ` Arnaud Charlet
@ 2022-11-26 16:52                 ` Iain Sandoe
  2022-11-26 18:02                   ` Paul Koning
  2022-11-26 18:06                 ` Paul Koning
  1 sibling, 1 reply; 17+ messages in thread
From: Iain Sandoe @ 2022-11-26 16:52 UTC (permalink / raw)
  To: Paul Koning; +Cc: GCC Development



> On 26 Nov 2022, at 16:42, Arnaud Charlet <charlet@adacore.com> wrote:
> 
> 
>>> The current statement  (https://gcc.gnu.org/install/prerequisites.html) is:
>>> 
>>> GNAT
>>> In order to build GNAT, the Ada compiler, you need a working GNAT compiler (GCC version 5.1 or later).
>>> 
>>> so, if 5.1 is not working, then perhaps a PR is in order.
>> 
>> I will do that, if the "shell in Rosetta" thing doesn't cure the problem.
> 
> You won’t need to, the version of gnat you are using is recent enough, you need to follow Ian’s instructions to the letter. The Ada 2022 code is a red herring and is only problematic when you build a cross with a non matching native, not when building a native compiler.

One additional question/point - which branch are you trying to build the cross from?

I am sure it will not work from upstream master.

Unfortunately, owing to lack of free time… aarch64-darwin is not yet completely ready to upstream, so folks are using the development branch here: https://github.com/iains/gcc-darwin-arm64 (which I will update later, based on the master version mentioned earlier; if testing goes OK).

Iain.


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Can't build Ada
  2022-11-26 16:52                 ` Iain Sandoe
@ 2022-11-26 18:02                   ` Paul Koning
  0 siblings, 0 replies; 17+ messages in thread
From: Paul Koning @ 2022-11-26 18:02 UTC (permalink / raw)
  To: Iain Sandoe; +Cc: GCC Development



> On Nov 26, 2022, at 11:52 AM, Iain Sandoe <idsandoe@googlemail.com> wrote:
> 
> 
> 
>> On 26 Nov 2022, at 16:42, Arnaud Charlet <charlet@adacore.com> wrote:
>> 
>> 
>>>> The current statement  (https://gcc.gnu.org/install/prerequisites.html) is:
>>>> 
>>>> GNAT
>>>> In order to build GNAT, the Ada compiler, you need a working GNAT compiler (GCC version 5.1 or later).
>>>> 
>>>> so, if 5.1 is not working, then perhaps a PR is in order.
>>> 
>>> I will do that, if the "shell in Rosetta" thing doesn't cure the problem.
>> 
>> You won’t need to, the version of gnat you are using is recent enough, you need to follow Ian’s instructions to the letter. The Ada 2022 code is a red herring and is only problematic when you build a cross with a non matching native, not when building a native compiler.
> 
> One additional question/point - which branch are you trying to build the cross from?
> 
> I am sure it will not work from upstream master.
> 
> Unfortunately, owing to lack of free time… aarch64-darwin is not yet completely ready to upstream, so folks are using the development branch here: https://github.com/iains/gcc-darwin-arm64 (which I will update later, based on the master version mentioned earlier; if testing goes OK).
> 
> Iain.

That's the branch I'm using.

	paul


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Can't build Ada
  2022-11-26 16:42               ` Arnaud Charlet
  2022-11-26 16:52                 ` Iain Sandoe
@ 2022-11-26 18:06                 ` Paul Koning
  2022-11-26 18:15                   ` Iain Sandoe
  2022-11-27 11:54                   ` Iain Sandoe
  1 sibling, 2 replies; 17+ messages in thread
From: Paul Koning @ 2022-11-26 18:06 UTC (permalink / raw)
  To: Arnaud Charlet; +Cc: Iain Sandoe, GCC Development



> On Nov 26, 2022, at 11:42 AM, Arnaud Charlet via Gcc <gcc@gcc.gnu.org> wrote:
> 
> 
>>> The current statement  (https://gcc.gnu.org/install/prerequisites.html) is:
>>> 
>>> GNAT
>>> In order to build GNAT, the Ada compiler, you need a working GNAT compiler (GCC version 5.1 or later).
>>> 
>>> so, if 5.1 is not working, then perhaps a PR is in order.
>> 
>> I will do that, if the "shell in Rosetta" thing doesn't cure the problem.
> 
> You won’t need to, the version of gnat you are using is recent enough, you need to follow Ian’s instructions to the letter. The Ada 2022 code is a red herring and is only problematic when you build a cross with a non matching native, not when building a native compiler.
> 
> Arno

All I can tell you is that I'm pretty sure I'm doing what Iain said, using his branch (up to date), and using the compilers from the Adacore open source release (20200818) which is GCC 8.4.1.  And once again I got that same complaint about Ada2020 constructs:

/usr/local/gnat/bin/gcc -c -g -O2      -gnatpg -gnata -W -Wall -nostdinc -I- -I. -Iada/generated -Iada -I../../../gcc-darwin/gcc/ada -Iada/libgnat -I../../../gcc-darwin/gcc/ada/libgnat -Iada/gcc-interface -I../../../gcc-darwin/gcc/ada/gcc-interface ../../../gcc-darwin/gcc/ada/contracts.adb -o ada/contracts.o
s-imagei.ads:95:11: declare_expression is an Ada 2020 feature
s-valueu.ads:152:09: declare_expression is an Ada 2020 feature
s-valueu.ads:160:09: declare_expression is an Ada 2020 feature
s-valueu.ads:184:06: "Subprogram_Variant" is not a valid aspect identifier
s-valuei.ads:80:11: declare_expression is an Ada 2020 feature
s-valuei.ads:95:08: declare_expression is an Ada 2020 feature
s-valuei.ads:141:06: "Subprogram_Variant" is not a valid aspect identifier
s-widthu.ads:84:09: declare_expression is an Ada 2020 feature
s-widthu.ads:93:11: run-time library configuration error
s-widthu.ads:93:11: file s-imgint.ads had parser errors
s-widthu.ads:93:11: entity "System.Img_Int.Image_Integer" not available
compilation abandoned
make[2]: *** [ada/contracts.o] Error 1

	paul


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Can't build Ada
  2022-11-26 18:06                 ` Paul Koning
@ 2022-11-26 18:15                   ` Iain Sandoe
  2022-11-27 11:54                   ` Iain Sandoe
  1 sibling, 0 replies; 17+ messages in thread
From: Iain Sandoe @ 2022-11-26 18:15 UTC (permalink / raw)
  To: Paul Koning; +Cc: GCC Development



> On 26 Nov 2022, at 18:06, Paul Koning <paulkoning@comcast.net> wrote:
> 
> 
> 
>> On Nov 26, 2022, at 11:42 AM, Arnaud Charlet via Gcc <gcc@gcc.gnu.org> wrote:
>> 
>> 
>>>> The current statement  (https://gcc.gnu.org/install/prerequisites.html) is:
>>>> 
>>>> GNAT
>>>> In order to build GNAT, the Ada compiler, you need a working GNAT compiler (GCC version 5.1 or later).
>>>> 
>>>> so, if 5.1 is not working, then perhaps a PR is in order.
>>> 
>>> I will do that, if the "shell in Rosetta" thing doesn't cure the problem.
>> 
>> You won’t need to, the version of gnat you are using is recent enough, you need to follow Ian’s instructions to the letter. The Ada 2022 code is a red herring and is only problematic when you build a cross with a non matching native, not when building a native compiler.
>> 
>> Arno
> 
> All I can tell you is that I'm pretty sure I'm doing what Iain said, using his branch (up to date), and using the compilers from the Adacore open source release (20200818) which is GCC 8.4.1.  And once again I got that same complaint about Ada2020 constructs:
> 
> /usr/local/gnat/bin/gcc -c -g -O2      -gnatpg -gnata -W -Wall -nostdinc -I- -I. -Iada/generated -Iada -I../../../gcc-darwin/gcc/ada -Iada/libgnat -I../../../gcc-darwin/gcc/ada/libgnat -Iada/gcc-interface -I../../../gcc-darwin/gcc/ada/gcc-interface ../../../gcc-darwin/gcc/ada/contracts.adb -o ada/contracts.o
> s-imagei.ads:95:11: declare_expression is an Ada 2020 feature
> s-valueu.ads:152:09: declare_expression is an Ada 2020 feature
> s-valueu.ads:160:09: declare_expression is an Ada 2020 feature
> s-valueu.ads:184:06: "Subprogram_Variant" is not a valid aspect identifier
> s-valuei.ads:80:11: declare_expression is an Ada 2020 feature
> s-valuei.ads:95:08: declare_expression is an Ada 2020 feature
> s-valuei.ads:141:06: "Subprogram_Variant" is not a valid aspect identifier
> s-widthu.ads:84:09: declare_expression is an Ada 2020 feature
> s-widthu.ads:93:11: run-time library configuration error
> s-widthu.ads:93:11: file s-imgint.ads had parser errors
> s-widthu.ads:93:11: entity "System.Img_Int.Image_Integer" not available
> compilation abandoned
> make[2]: *** [ada/contracts.o] Error 1

1/
For the cross - you have to make sure that the newly-built “native" (Rosetta) compiler is found in the path first - perhaps somehow the original bootstrap compiler is being found (unless you installed into /usr/local .. which I tend to avoid)?

2/ To work around the Xcode “gotcha” of claiming gcc and g++ I find it is safest to be specific about CC and CXX on the command line (so CC=x86_64-apple-darwinNN-gcc, CXX=x86_64-apple-darwinNN-++ … )

otherwise, I can share my configure lines .. but probably best off-list.
Iain


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: Can't build Ada
  2022-11-26 18:06                 ` Paul Koning
  2022-11-26 18:15                   ` Iain Sandoe
@ 2022-11-27 11:54                   ` Iain Sandoe
  1 sibling, 0 replies; 17+ messages in thread
From: Iain Sandoe @ 2022-11-27 11:54 UTC (permalink / raw)
  To: Paul Koning; +Cc: GCC Development, Arnaud Charlet, FX

Hi Paul,

> On 26 Nov 2022, at 18:06, Paul Koning via Gcc <gcc@gcc.gnu.org> wrote:
> 
>> On Nov 26, 2022, at 11:42 AM, Arnaud Charlet via Gcc <gcc@gcc.gnu.org> wrote:
>> 
>>>> The current statement  (https://gcc.gnu.org/install/prerequisites.html) is:
>>>> 
>>>> GNAT
>>>> In order to build GNAT, the Ada compiler, you need a working GNAT compiler (GCC version 5.1 or later).
>>>> 
>>>> so, if 5.1 is not working, then perhaps a PR is in order.
>>> 
>>> I will do that, if the "shell in Rosetta" thing doesn't cure the problem.
>> 
>> You won’t need to, the version of gnat you are using is recent enough, you need to follow Ian’s instructions to the letter. The Ada 2022 code is a red herring and is only problematic when you build a cross with a non matching native, not when building a native compiler.

For the record, I have now pushed an updated development branch (based off upstream r13-4309-g309e2d95e3b9) which builds c-family, fortran and Ada on
 - x86_64 [Darwin20] (with cross and native cross to aarch64), using XC CLT  12.5
 - x86_64 Rosetta 2 [Darwin21] bootstrap and cross, using XC CLT 14.1RC + macOSX12 sdk.
 - aarch64 [Darwin21] native (assuming you have an existing aarch64 darwin GCC bootstrap), using XC CLT 14.1RC + macOSX12 sdk.***

.. I’ve fixed up the DFP and testcases (although clang does not support _DecimalXX on aarch64 Darwin, so maybe it’s of limited use) .. but at least that source of testsuite noise is eliminated.

cheers
Iain

*** note that we have some issues with the macOS13 SDK still to be resolved so make sure you use the 12 version on macOS 12 (at least).


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2022-11-27 11:54 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-25 19:57 Can't build Ada Paul Koning
2022-11-25 20:03 ` Andrew Pinski
2022-11-25 20:08   ` Paul Koning
2022-11-25 20:13     ` Andrew Pinski
2022-11-25 20:46       ` Iain Sandoe
2022-11-26 15:48         ` Paul Koning
2022-11-26 15:58           ` Iain Sandoe
2022-11-26 16:27             ` Paul Koning
2022-11-26 16:42               ` Arnaud Charlet
2022-11-26 16:52                 ` Iain Sandoe
2022-11-26 18:02                   ` Paul Koning
2022-11-26 18:06                 ` Paul Koning
2022-11-26 18:15                   ` Iain Sandoe
2022-11-27 11:54                   ` Iain Sandoe
2022-11-25 20:17     ` Iain Sandoe
2022-11-25 20:26     ` NightStrike
2022-11-25 20:45     ` Alexandre Oliva

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