1

I am trying to get started with Ada programming and would like to compile a file without using GPR Studio

I have installed gnat community with the provided .dmg at $HOME/GNAT/

All the binaries are found at $HOME/GNAT/bin/ and I have added this bin to my path such that they all appear correctly when I type which gps or another binary in that folder.

Also if I run gps and run a file in it everything works fine.

However here is my problem if i create file hello.abd:

with Ada.Text_IO; use Ada.Text_IO;
procedure Hello is
begin
   Put_Line ("Hello World!");
end Hello;

and then run gnatmake hello.abd

I get:

gcc -c hello.adb
gnatbind -x hello.ali
gnatlink hello.ali
ld: library not found for -lSystem
collect2: error: ld returned 1 exit status
gnatlink: error when calling /Users/powers/GNAT/bin/gcc
gnatmake: *** link failed.

Any ideas why it is failing to link?

Joshua
  • 19
  • 3
  • 1
    Does this answer the question? https://stackoverflow.com/questions/60454597/what-should-i-do-to-solve-the-gnat-gps-library-not-found-problem-and-build-my –  Apr 06 '20 at 17:29
  • I am going to try this out and see if that fixes it, the only difference between mine and this problem is gps is working fine for me it's just when I try to compile manually that I get a problem. I will install xcode and see, I dislike having to do this and was hoping just the xcode command line tools would be enough. Does anyone happen to know which exact libraries it wants from xcode (presumably some sort of header files) and if there is another way to get them aside from xcode? – Joshua Apr 06 '20 at 17:38
  • 1
    Try [here](https://forward-in-code.blogspot.com/2019/06/macos-software-development-kit-changes.html) – Simon Wright Apr 06 '20 at 20:12
  • @BrianDrummond Installing xcode fixed the problem and the above post helped explain why and how I might go about getting around it without xcode. Thanks. – Joshua Apr 06 '20 at 21:55
  • @Joshua: You can [answer your own question](http://meta.stackoverflow.com/q/17463/163188). – trashgod Apr 07 '20 at 17:37

1 Answers1

0

Simply installing xcode (and agreeing to the license) fixed this issue for me

Joshua
  • 19
  • 3