问题
I downloaded the GNAT Community 2019 and have installed on my Mac in my home folder "/Users/leon/opt/GNAT"
I run the command "gps" in the directory "/Users/leon/opt/GNAT/2019/bin". And GPS showed up, then I created a project, typed the "Hello World" code. Just as the Wikibook shows.
with Ada.Text_IO;
procedure Hello is
begin
Ada.Text_IO.Put_Line("Hello, world!");
end Hello;
When I clicked the build button, the program just failed to build.
The following is the building output.
gprbuild -d -P/Users/leon/Documents/ada/helloworld.gpr /Users/leon/Documents/ada/src/hello.adb
Compile
[Ada] hello.adb
Bind
[gprbind] hello.bexch
[Ada] hello.ali
Link
[link] hello.adb
ld: library not found for -lSystem
collect2: error: ld returned 1 exit status
gprbuild: link of hello.adb failed
gprbuild: failed command was: /users/leon/opt/gnat/2019/bin/gcc hello.o b__hello.o -L/Users/leon/Documents/ada/obj/ -L/Users/leon/Documents/ada/obj/ -L/users/leon/opt/gnat/2019/lib/gcc/x86_64-apple-darwin17.7.0/8.3.1/adalib/ /users/leon/opt/gnat/2019/lib/gcc/x86_64-apple-darwin17.7.0/8.3.1/adalib/libgnat.a -Wl,-rpath,@executable_path/ -Wl,-rpath,@executable_path/../../..//opt/gnat/2019/lib/gcc/x86_64-apple-darwin17.7.0/8.3.1/adalib -o hello
[2020-02-28 22:36:48] process exited with status 4, elapsed time: 00.79s
Please help. I can't figure out what is wrong with the configuration or something. Thank you in advance.
回答1:
guys. I found the solution myself.
On the program's download's page, above the program's link, there is a README file.
I ignored it at first. Just then I revisited the official site and read the README file and got the solution as following :
== Mac OS: Xcode is now needed ==
On Mac OS, GNAT Community 2019 requires Xcode version 10 or above to be
installed. Once you do have Xcode installed, if you still observe an error
of the form:
ld: library not found for -lSystem
then you might have to execute the following:
xcode-select -s /Applications/Xcode.app/Contents/Developer
I think this has really given me a great lesson. READ THE INSTALLATION MANUAL FIRST.
Thank you guys.
来源:https://stackoverflow.com/questions/60454597/what-should-i-do-to-solve-the-gnat-gps-library-not-found-problem-and-build-my