-- hello_world.adb
with Ada.Text_IO;
procedure Hello is
begin
Ada.Text_IO.Put_Line ("Hello, world!");
end Hello;
-- hello_world.gpr
project Hello_World is
for Main use ("hello_world.adb");
for Object_Dir use ".objs";
package Compiler is
for Default_Switches ("Ada") use ("-g");
end Compiler;
end Hello_World;
I found that building on the command line with -largs -no-pie works:
$ gprbuild -P hello_world.gpr -cargs -gnatef -largs -no-pie
Compile
[Ada] hello_world.adb
/Users/kal/Code/ada/hello_world.adb:3:11: warning: file name does not match unit name, should be "hello.adb"
Bind
[gprbind] hello_world.bexch
[Ada] hello_world.ali
Link
[link] hello_world.adb
-macosx_version_min has been renamed to -macos_version_min
$ echo $?
0
$ .objs/hello_world
Hello, world!
Alternatively, you can modify hello_world.gpr:
project Hello_World is
-- ...snip...
package Linker is
-- https://docs.adacore.com/gprbuild-docs/html/gprbuild_ug/gnat_project_manager.html
-- https://developer.apple.com/forums/thread/737707
for Default_Switches ("Ada") use ("-no-pie");
end Linker;
end Hello_World;
This is a known issue.
Try to add -Wl,-ld_classic to linker options or update of the developer toolkit (Xcode, or the much smaller Command Line Tools) to beta version of 15.
In case anyone else has this issue.
From https://developer.apple.com/forums/thread/737707, it sounds like the issue is with the new xcode tools.
I found that building on the command line with
-largs -no-pie
works:Alternatively, you can modify
hello_world.gpr
: