alire-project / GNAT-FSF-builds

Builds of the GNAT Ada compiler from FSF GCC releases
MIT License
32 stars 9 forks source link

Building GCC 14.1 for aarch64-apple-darwin #67

Open simonjwright opened 3 weeks ago

simonjwright commented 3 weeks ago

The PR Update for GNAT FSF 14.1 failed to build GCC on Apple silicon (using the Github runner macos-14).

The problem was an error where an internal tool (gen_il-main), built during stage 2, failed to run even though what appeared to be exactly the same tool built in stage 1 had run successfully. In both cases, the tool was built using the base (host) GCC 13.2.0 compiler.

The build ran successfully on a local machine. This made diagnosis difficult.

Considerable help was received from one of the GCC maintainers for Apple.

After a lot of failed attempts, we built successfully by

The changes can be seen in the macos-arm branch of this fork, with the successful test run here. Note, I haven't raised a PR because it uses an unofficial GCC 13.3.0 build.

reznikmm commented 3 weeks ago

@simonjwright Do we still need libexec/gcc/aarch64-apple-darwin23.5.0/14.1.0/ld wrapper script, BTW?

simonjwright commented 3 weeks ago

Do we still need libexec/gcc/aarch64-apple-darwin23.5.0/14.1.0/ld wrapper script, BTW?

In earlier releases of GCC 14.1, I found an issue if a compiler built against Xcode 15.(n > 0) attempted to compile (some) C against Xcode 14.n, to do with availability headers not being available (!). I believe (and simple tests appear to confirm) that this has been fixed in the gcc-14.1-darwin-r1 tag.

This would only unavoidably affect users with older Macs stuck on macOS Monterey, who can’t use Xcode later than 14.2.

As to the ld fix script -- now that the compiler handles exceptions properly, it’s only required for people still using Xcode (or Command Line Tools) 15.0. They really need to upgrade.

Of course, this could well impact people who download the compiler "just to try it out".

I see that nothing on the https://ada-lang.io/docs/category/getting-started or https://alire.ada.dev/docs/#alr-on-macos mentions that macOS users absolutely require Xcode (or the Command Line Tools). I can update the former and mention this requirement (and that the version installed must be 15.(n>0). I also see that my https://github.com/simonjwright/distributing-gcc/wiki/InstallingThePackage could do with an overhaul.

I see that Xcode 16 is at release candidate stage! exciting times ...