GNAT toolchain now broken after OS upgrade to MacOS 26 (Tahoe), arm64

Hi;

I think that there is a problem with the current GNAT tool chain for MacOS arm64:


gnatmake -v ./shift_left.adb

GNATMAKE 15.0.1 20250418 (prerelease)
Copyright (C) 1992-2025, Free Software Foundation, Inc.
“shift_left.ali” being checked …
→ “shift_left.ali” missing.
gcc -c -I./ -I- ./shift_left.adb
clang: warning: overriding deployment version from ‘16.0’ to ‘26.0’ [-Woverriding-deployment-version]
End of compilation
gnatbind -x shift_left.ali
gnatlink shift_left.ali
clang: warning: overriding deployment version from ‘16.0’ to ‘26.0’ [-Woverriding-deployment-version]
ld: library not found for -lSystem
collect2: error: ld returned 1 exit status
gnatlink: error when calling /opt/gnat-aarch64-darwin-15.1.0-2/bin/gcc
gnatmake: *** link failed.


The Ada code is from Rosetta Code:

Thanks,

RBE

Same here. I haven’t even upgraded Mac OS to 26 - I’ve just updated to 15.7 (from 15.6.1) and this has caused the Alr (2.1.0) build to fail with similar message. To keep it brief, this appears to be the key content:

ld: library not found for -lSystem
collect2: error: ld returned 1 exit status

Thanks for any help

Darce

And, I should have mentioned - I’m on an Intel Mac

Success.

I uninstalled the Xcode Command Line tools and reinstalled them and the alr build and alr run worked fine.

The instructions for this are on the Alire page under Getting Started / MacOS / Alire and, in summary:

‘If you suspect your copy of the Command Line Tools is old, you can delete it by

sudo rm -rf /Library/Developer/CommandLineTools

and re-install.”

This worked for my Intel Mac. I hope it works for your Apple silicon Mac.

Darce

3 Likes

Not successful for me, but thanks for the tip.

RBE

This was posted as a solution in the Alire Matrix chat channel:


Adding …

package Linker is
for Leading_Switches ("Ada") use ("-Wl,-syslibroot," & external ("SDKROOT", ""));
end Linker;

… to the .gpr file and then setting the appropriate SDKROOT via …

export SDKROOT="$(xcrun --sdk macosx --show-sdk-path)"

… seemed to do the trick.


By Rebecca.

I hope this helps,
Fer

3 Likes

Hi Fer;

Thanks for sharing this info.

Could someone assist me in translating this to what I should use when calling gnatmake directly, no Alire, no gpr…?

Thanks,

RBE

Probably something like

gnatmake XXX.adb -something -something -something -largs -Wl,-syslibroot,$(xcrun --sdk macosx --show-sdk-path)

Notice the part -largs ... that is how you pass linker arguments in gnatmake. Maybe you need to quote the shell invocation $(...) but lets see.

I hope this helps,
Fer

Ok, thanks, I’ll work on that idea.

Thanks,

RBE

Hi All;

Please provide more details on how to translate this to a form that I can use with gnatmake. I’ve not had much sucess with my attempts. Later, I’ll be gratefully using this in the form originally presented, but not yet.

SDKROOT="$(xcrun --sdk macosx --show-sdk-path)" gnatmake -v ./shift_left.adb -largs -Wl,-syslibroot,${SDKROOT}

GNATMAKE 15.0.1 20250418 (prerelease)
Copyright (C) 1992-2025, Free Software Foundation, Inc.
  "shift_left.ali" being checked ...
  -> "shift_left.ali" missing.
gcc -c -I./ -I- ./shift_left.adb
clang: warning: overriding deployment version from '16.0' to '26.0' [-Woverriding-deployment-version]
End of compilation
gnatbind -x shift_left.ali
gnatlink shift_left.ali -Wl,-syslibroot,
clang: warning: overriding deployment version from '16.0' to '26.0' [-Woverriding-deployment-version]
ld: -syslibroot missing argument
collect2: error: ld returned 1 exit status
gnatlink: error when calling /opt/gnat-aarch64-darwin-15.1.0-2/bin/gcc
gnatmake: *** link failed.

Thanks,

RBE

The SDKROOT="$(xcrun --sdk macosx --show-sdk-path)" line is returning an empty variable. Do you have Xcode or the Apple developer tools installed (I am no Apple user, so I do not know the correct terminology or setups to get a toolchain running). The command xcrun has to return the requested value, not an empty string.

Also, this line GNATMAKE 15.0.1 20250418 (prerelease) indicates that you are running a beta version of the compiler. Please, update your Ada toolchain to the latest GCC, which is currently v15.2. That may also help.

Best regards,
Fer

Hi Fer;

Thanks for the tip about upgrading the GNAT compiler.

I visit

I do not see anything for arm64 MacOS; perhaps I’m blind :frowning:

Thanks,

RBE

EDIT: Perhaps the MacOS asset is a universal (contains both x86-64 and arm64 platforms) asset; I haven’t confirmed; but that makes sense.

Oh, strange, there is no v15.2 build for Apple, but there is a 15.1 build… Release gnat-15.1.0-2 · alire-project/GNAT-FSF-builds · GitHub

Try with the v15.1

Hi Fer;

I have not tried the most recent version that has an arm64 MacOS entry.

However, I received the same complaint from MacOS when trying to link a compiled C program on MacOS Tahoe. So, I used Gemini AI (if I had not received useful answers, I would have used ChatGPT) and the clue was a clang option that forces version 26: “-mmacosx-version-min=26.0“. This solved the exact same complaint I was getting when trying to link the Ada object code. So now I just have to figure out how to get gnatmake to force this option through. I hope that I don’t have to do gpr things (yet) to get this to work.

Thanks,

RBE

I tried using “gnat compile” and “gnat link” separately and with verbose and I am still having the same problem. I do not think that updating my gnat tool chain will solve the problem since this is something that came up with the Tahoe release of MacOS, which definitely happened after the most recent release of the gnat tool chain.

The hint from Gemini AI had zero effect on the linking problem from the Ada object code while it solved the linking problem from the C object code.

Thanks,

RBE

Actually it’s probably not empty, it’s just that the order of operations is wrong. SDKROOT=… is setting the variable after ${SDKROOT} has already been expanded. Observe how a command like FOO=hello echo $FOO prints nothing.

You can separate it into two statements:

SDKROOT=$(xcrun --sdk macosx --show-sdk-path)
gnatmake -v ./shift_left.adb -largs -Wl,-syslibroot,"$SDKROOT"

Or you can dispense with the variable and do it as a single command:

gnatmake -v ./shift_left.adb -largs -Wl,-syslibroot,"$(xcrun --sdk macosx --show-sdk-path)"

If you plan to type gnatmake commands a lot, you could make a wrapper script that adds the syslibroot stuff for you. For example, save the following as a new text file:

#!/bin/sh
exec gnatmake "$@" -largs -Wl,-syslibroot,"$(xcrun --sdk macosx --show-sdk-path)"

chmod a+x that file and run that file instead of gnatmake. The fact that gnatmake doesn’t seem to know to use the standard macOS SDK path automatically feels like a bug to me, but this should allow you to work around it.

This is a gcc bug. It computes the default deployment target from the Darwin version. You’re on Darwin 25 and it erroneously thinks that’s macOS 16. The version of gcc you’re using was released before it was known that Apple would change the version numbering scheme and that Darwin 25 would actually be called macOS 26.

If I interpret the message correctly, clang (perhaps being invoked as the linker?) is letting you know it was asked to use the deployment target 16.0 and it has changed it to 26.0 for you. When you specify -mmacosx-version-min=26.0 you’re overriding gcc’s erroneous default and specifying 26.0 directly, which eliminates the warning but otherwise changes nothing.

4 Likes

Hi Ryan;

Thanks for posting here as a reply to my post.

Also, thanks for correcting my incorrect usage when trying to implement the advice given earlier in this thread. That’s useful general knowledge, thanks…

What is not clear to me but reading between the lines is that a new release of the GNAT tool chain will be required for me to be able to proceed with the linkage; is that a correct conclusion? If not, what is the action that I can take? I don’t have an executable created, so it’s more than a warning to me, it’s a failure. Turning off the warning(s) when the problem is not resolved is like driving in really bad weather, ignoring the travel advisories and putting on a blindfold, and hoping for the best.

Thanks,

RBE

The OP showed up two issues:

and:

They have separate causes, respectively:

  1. Upgrade to macOS 26
  2. Upgrade to GNAT FSF 15.1

As it was pointed out, for the first one:

For the second one, I had opened an Alire issue (still open). Workarounds were also been discussed here.

Has anyone tested GNAT FSF 15.2 from Alire?

Alire/GNAT builds just published a prerelease of GCC 16 Release gnat-16.0.0-snapshot · alire-project/GNAT-FSF-builds · GitHub

You may want to try it out and see if that works. It does have the aarch64-darwin release :slight_smile:

Alire, for whatever reason, does not seem to have created the 15.2 artifact… So the latest stable version is v15.1

I believe Simon used to base his macosx toolchain based on some repo like this one GitHub - iains/gcc-darwin-arm64: GCC master branch for Darwin with experimental support for Arm64. Currently GCC-16.0.0 [September 2025] But I do not know if this could help you…