问题
I installed Ada and AWS on a Macbook for the first time tonight.
Everything seemed successful with the installation, but I'm getting the feeling that AWS didn't install to the right directory.
GNAT is in /usr/local/gnat.
The AWS makefile.conf said,
AWS will be installed under $(prefix). Update this variable to point to
the install directory. By default, it is set to the current GNAT root
directory to have AWS project files automatically available.
So I didn't change the target.
But when I try to compile hello_world from anywhere on the system except the AWS demos folder, I get this error:
~/projects/ada:gnatmake hello.adb
gcc -c hello.adb
hello.adb:1:06: file "aws.ads" not found
hello.adb:2:06: file "aws.ads" not found
hello.adb:3:06: file "aws.ads" not found
hello.adb:4:06: file "aws.ads" not found
gnatmake: "hello.adb" compilation error
How can I make sure AWS was installed properly, or move it if it wasn't?
回答1:
The answer (well, more of a hint to those in the know) lies in the words "to have AWS project files automatically available".
In the GNAT context, "project file" means a file of type .gpr
which tells the builder (gnatmake
or gprbuild
) where to find the source files, how to compile them, and where to find any libraries that "this" project depends on.
Create hello.gpr
:
with "aws";
project Hello is
for Main use ("hello.adb");
end Hello;
(which is very minimal) then
with AWS;
with Ada.Text_IO;
procedure Hello is
begin
Ada.Text_IO.Put_Line ("AWS version is " & AWS.Version);
end Hello;
compiled with
gprbuild -P hello.gpr
outputs
AWS version is 2.10.0w
There is on-line information on gprbuild and gnatmake (gnatmake
has been superseded by gprbuild
); there is probably information in your installed GNAT at (subdirectories of) ${prefix}/share/doc
.
来源:https://stackoverflow.com/questions/8063468/installation-issue-with-aws-for-ada