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

2 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

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