comp.lang.ada
 help / color / mirror / Atom feed
* Compilation error with GNAT
@ 2004-01-28 19:00 Ben Horowitz
  2004-01-28 21:13 ` Simon Wright
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Ben Horowitz @ 2004-01-28 19:00 UTC (permalink / raw)


Hi,

I'm trying to sort through a compilation problem that I'm having with
Gnat.  I have a large set of source files, some of which are spec
only, and some of which have both spec and body.  The file that is
giving me a problem has only a spec.  I am using the XXX.1.ada and
XXX.2.ada naming convention.

I first try to compile this file using gnatmake and the project file
below.  Gnat complains that the file has only a spec, so it can't
generate code.  Later, it reports a compilation error.  The output of
gnatmake and the project file I used are given below.

I thought at first that the problem might be that I needed to use the
-gnatc option to gnat/gcc for the troublesome file.  I tried this (see
the second compilation run below).  Gnatmake now warns that an ALI or
object file is missing after compile.  Gnatmake nonethess goes on,
ending up by reporting a compilation error that seems quite similar to
the first.

What might be causing this problem?  What are the possible fixes?

Of course, one solution would be to give the troublesome file a (more
or less) empty body.  However, I wish to avoid this, as it requires a
large amount of manual labor.

Thanks,
Ben



--------------------------------------------------------------------------------

N:\code\Support\Abstract_Data_Types.ss\reynolds.OIS2.4.3.sol.ada.4.x.x.wrk>gnatmake
-d -Pn:\code\support\abstract_data_types.ss\reynolds.ois2.4.3.sol.ada.4.x.x.wrk\adts_win.gpr
-u
completed 1 out of 1 (100%)...
completed 1 out of 1 (100%)...
completed 1 out of 1 (100%)...
completed 1 out of 1 (100%)...
gcc -c -g -gnatf -gnatv -o
n:\code\support\abstract_data_types.ss\reynolds.ois2.4.3.sol.ada.4.x.x.wrk\obj\win\map_simple_cached_multiple_unbounded_managed_iterator.1.o
-gnatec=n:\code\support\abstract_data_types.ss\reynolds.ois2.4.3.sol.ada.4.x.x.wrk\obj\win\GNAT-TEMP-000005.TMP
-gnato -fstack-check -gnatE -g -gnatf -gnatv -I- -gnatA -x ada
n:\code\support\abstract_data_types.ss\reynolds.ois2.4.3.sol.ada.4.x.x.wrk\booch_83\maps\map_simple_cached_multiple_unbounded_managed_iterator.1.ada

GNAT Pro 3.16a1 (20030610) Copyright 1992-2002 Free Software
Foundation, Inc.

Compiling: n:\code\support\abstract_data_types.ss\reynolds.ois2.4.3.sol.ada.4.x.x.wrk\booch_83\maps\map_simple_cached_multiple_unbounded_managed_iterator.1.ada
(source file time stamp: 1998-08-18 19:36:24)
cannot generate code for file
map_simple_cached_multiple_unbounded_managed_iterator.1.ada (package
spec)
to check package spec for errors, use -gnatc
 54 lines: No errors
completed 1 out of 1 (100%)...
[This is repeated many times...]
completed 1 out of 1 (100%)...
gnatmake: "n:\code\support\abstract_data_types.ss\reynolds.ois2.4.3.sol.ada.4.x.x.wrk\booch_83\maps\map_simple_cached_multiple_unbounded_managed_iterator.1.ada"
compilation error


Using the following project file:

project Adts_Win is
 
   for Languages use ("ada");
   for Source_Dirs use (".", "Booch_83\maps\", "Booch_83\queues\",
"Booch_83\sorting\", "Booch_83\stacks\", "Booch_83\trees\",
"Booch_83\utilities\", "Booch_95\", "Booch_95\demo\",
"Booch_95\test\", "hash\", "lists\", "queues\", "sets\", "stacks\",
"State_Map_Machine\", "State_Map_Machine\Template\",
"State_Map_Machine\Tests\", "strings\", "test\");
   for Object_Dir use
"N:\code\Support\Abstract_Data_Types.ss\reynolds.OIS2.4.3.sol.ada.4.x.x.wrk\obj\win";
 
   package Naming is
      for Specification_Suffix ("ada") use ".1.ada";
      for Implementation_Suffix ("ada") use ".2.ada";
      for Separate_Suffix use ".2.ada";
      for Casing use "lowercase";
      for Dot_Replacement use ".";
   end Naming;
 
   package Builder is
      for Default_Switches ("ada") use ("-s", "-k", "-g", "-gnatf",
"-gnatv");
   end Builder;
 
   package Compiler is
      for Default_Switches ("ada") use ("-gnato", "-fstack-check",
"-gnatE", "-g", "-gnatf", "-gnatv");
      for Default_Switches ("c") use ("");
      for Default_Switches ("c++") use ("");
   end Compiler;
 
   package Binder is
      for Default_Switches ("ada") use ("-E", "-static");
   end Binder;
 
   package Linker is
      for Default_Switches ("ada") use ("-g");
   end Linker;
 
   package Pretty_Printer is
      for Default_Switches ("ada") use ("");
   end Pretty_Printer;
 
end Adts_Win;


--------------------------------------------------------------------------------



N:\code\Support\Abstract_Data_Types.ss\reynolds.OIS2.4.3.sol.ada.4.x.x.wrk>gnatmake
-d -Pn:\code\support\abstract_data_types.ss\reynolds.ois2.4.3.sol.ada.4.x.x.wrk\adts_win.gpr
-u
Warning: using Builder'Default_Switches("Ada"), as there are several
mains
completed 1 out of 1 (100%)...
completed 1 out of 1 (100%)...
completed 1 out of 1 (100%)...
completed 1 out of 1 (100%)...
gcc -c -g -gnatf -gnatv -o
n:\code\support\abstract_data_types.ss\reynolds.ois2.4.3.sol.ada.4.x.x.wrk\obj\win\map_simple_cached_multiple_unbounded_managed_iterator.1.o
-gnatec=n:\code\support\abstract_data_types.ss\reynolds.ois2.4.3.sol.ada.4.x.x.wrk\obj\win\GNAT-TEMP-000005.TMP
-gnato -fstack-check -gnatE -g -gnatc -I- -gnatA -x ada
n:\code\support\abstract_data_types.ss\reynolds.ois2.4.3.sol.ada.4.x.x.wrk\booch_83\maps\map_simple_cached_multiple_unbounded_managed_iterator.1.ada

GNAT Pro 3.16a1 (20030610) Copyright 1992-2002 Free Software
Foundation, Inc.

Checking: n:\code\support\abstract_data_types.ss\reynolds.ois2.4.3.sol.ada.4.x.x.wrk\booch_83\maps\map_simple_cached_multiple_unbounded_managed_iterator.1.ada
(source file time stamp: 1998-08-18 19:36:24)
 54 lines: No errors
gnatmake: "map_simple_cached_multiple_unbounded_managed_iterator.1.ali"
WARNING: ALI or object file not found after compile

completed 1 out of 1 (100%)...
[This is repeated many times...]
completed 1 out of 1 (100%)...

gnatmake: "n:\code\support\abstract_data_types.ss\reynolds.ois2.4.3.sol.ada.4.x.x.wrk\booch_83\maps\map_simple_cached_multiple_unbounded_managed_iterator.1.ada"
compilation error


Using the following project file:

project Adts_Win is
 
   for Languages use ("ada");
   for Source_Dirs use (".", "Booch_83\maps\", "Booch_83\queues\",
"Booch_83\sorting\", "Booch_83\stacks\", "Booch_83\trees\",
"Booch_83\utilities\", "Booch_95\", "Booch_95\demo\",
"Booch_95\test\", "hash\", "lists\", "queues\", "sets\", "stacks\",
"State_Map_Machine\", "State_Map_Machine\Template\",
"State_Map_Machine\Tests\", "strings\", "test\");
   for Object_Dir use
"N:\code\Support\Abstract_Data_Types.ss\reynolds.OIS2.4.3.sol.ada.4.x.x.wrk\obj\win";
 
   package Naming is
      for Specification_Suffix ("ada") use ".1.ada";
      for Implementation_Suffix ("ada") use ".2.ada";
      for Separate_Suffix use ".2.ada";
      for Casing use "lowercase";
      for Dot_Replacement use ".";
   end Naming;
 
   package Builder is
      for Default_Switches ("ada") use ("-s", "-k", "-g", "-gnatf",
"-gnatv");
      for Switches ("map_simple_cached_multiple_unbounded_managed_iterator.1.ada")
use ("-s", "-k", "-g", "-gnatc");
   end Builder;
 
   package Compiler is
      for Default_Switches ("ada") use ("-gnato", "-fstack-check",
"-gnatE", "-g", "-gnatf", "-gnatv");
      for Default_Switches ("c") use ("");
      for Default_Switches ("c++") use ("");
      for Switches ("map_simple_cached_multiple_unbounded_managed_iterator.1.ada")
use ("-gnato", "-fstack-check", "-gnatE", "-g", "-gnatc");
   end Compiler;
 
   package Binder is
      for Default_Switches ("ada") use ("-E", "-static");
   end Binder;
 
   package Linker is
      for Default_Switches ("ada") use ("-g");
   end Linker;
 
   package Pretty_Printer is
      for Default_Switches ("ada") use ("");
   end Pretty_Printer;
 
end Adts_Win;



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Compilation error with GNAT
  2004-01-28 19:00 Compilation error with GNAT Ben Horowitz
@ 2004-01-28 21:13 ` Simon Wright
  2004-01-28 23:07 ` Dan Eilers
  2004-01-29  5:56 ` Per Sandberg
  2 siblings, 0 replies; 5+ messages in thread
From: Simon Wright @ 2004-01-28 21:13 UTC (permalink / raw)


Not sure which version you're using, but downloaded the 83 version cos
the 95 version wan't accessible.

Here, I see

map_simple_cached_multiple_unbounded_managed_iterator.1.ada
map_simple_cached_multiple_unbounded_managed_iterator.2.ada

so there _is_ a body.

-- 
Simon Wright                               100% Ada, no bugs.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Compilation error with GNAT
  2004-01-28 19:00 Compilation error with GNAT Ben Horowitz
  2004-01-28 21:13 ` Simon Wright
@ 2004-01-28 23:07 ` Dan Eilers
  2004-01-29  5:56 ` Per Sandberg
  2 siblings, 0 replies; 5+ messages in thread
From: Dan Eilers @ 2004-01-28 23:07 UTC (permalink / raw)


bhorowitdevnull@yahoo.com (Ben Horowitz) wrote in message news:<6c8918f3.0401281100.2a000840@posting.google.com>...

>I'm trying to sort through a compilation problem that I'm having with    
>Gnat.  I have a large set of source files, some of which are spec
>only, and some of which have both spec and body.  The file that is  
>giving me a problem has only a spec.  I am using the XXX.1.ada and
>XXX.2.ada naming convention.                
>
>I first try to compile this file using gnatmake and the project file
>below.  Gnat complains that the file has only a spec, so it can't
>generate code.  Later, it reports a compilation error.  The output of
>gnatmake and the project file I used are given below.                 

map_simple_cached_multiple_unbounded_managed_iterator is a package
that requires a body.  So you should either figure out why you don't
have one, or if you don't actually use this package, you could simply
delete the spec.

The GNAT compiler should really be saying "linking error", rather than
"compilation error", because in Ada95 missing bodies (even of generic
packages) are considered harmless until link time.

     -- Dan Eilers



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Compilation error with GNAT
  2004-01-28 19:00 Compilation error with GNAT Ben Horowitz
  2004-01-28 21:13 ` Simon Wright
  2004-01-28 23:07 ` Dan Eilers
@ 2004-01-29  5:56 ` Per Sandberg
  2004-01-29 17:37   ` Dan Eilers
  2 siblings, 1 reply; 5+ messages in thread
From: Per Sandberg @ 2004-01-29  5:56 UTC (permalink / raw)
  To: Ben Horowitz; +Cc: comp.lang.ada

Start with the basic GNAT complilation model.
GNAT is treating spec/body alternativly spec if the spec does'nt requrie 
a body as a unit for compilation.

Asume the folowing:

package no_body is
end no_body;

package with_body is
   procudere dummy;
end with_body;

package with_body is
   procudere dummy is begin null;end;
end with_body;

Then you will be able to generate code for no_body'spec and 
with_body'spec/with_body'body.
The compiler will compilain when you are trying to generate code from 
with_body'spec since that file wont generate any code.

You will get code from no_body'spec when compiling the source file 
no_body.1.ada and from the pair with_body'spec/with_body'body when 
compiling with_body.2.ada.

It is all explaind in detail in the GNAT documentation
/Per Sandberg



Ben Horowitz wrote:
> Hi,
> 
> I'm trying to sort through a compilation problem that I'm having with
> Gnat.  I have a large set of source files, some of which are spec
> only, and some of which have both spec and body.  The file that is
> giving me a problem has only a spec.  I am using the XXX.1.ada and
> XXX.2.ada naming convention.
> 
> I first try to compile this file using gnatmake and the project file
> below.  Gnat complains that the file has only a spec, so it can't
> generate code.  Later, it reports a compilation error.  The output of
> gnatmake and the project file I used are given below.
> 
> I thought at first that the problem might be that I needed to use the
> -gnatc option to gnat/gcc for the troublesome file.  I tried this (see
> the second compilation run below).  Gnatmake now warns that an ALI or
> object file is missing after compile.  Gnatmake nonethess goes on,
> ending up by reporting a compilation error that seems quite similar to
> the first.
> 
> What might be causing this problem?  What are the possible fixes?
> 
> Of course, one solution would be to give the troublesome file a (more
> or less) empty body.  However, I wish to avoid this, as it requires a
> large amount of manual labor.
> 
> Thanks,
> Ben



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Compilation error with GNAT
  2004-01-29  5:56 ` Per Sandberg
@ 2004-01-29 17:37   ` Dan Eilers
  0 siblings, 0 replies; 5+ messages in thread
From: Dan Eilers @ 2004-01-29 17:37 UTC (permalink / raw)


Per Sandberg <per.sandberg@bredband.net> wrote in message news:<mailman.59.1075355799.2270.comp.lang.ada@ada-france.org>...
> Start with the basic GNAT complilation model.
> GNAT is treating spec/body alternativly spec if the spec does'nt requrie 
> a body as a unit for compilation.
> ... 
> It is all explaind in detail in the GNAT documentation
> /Per Sandberg

But it would be perfectly reasonable for an Ada user to start with the
basic
Ada compilation model, which is explained in detail in the Ada
documentation.
In the Ada model, a package spec is a compilation unit whether or not
it requires a body, and compilation errors do not arise from missing
bodies
or missing subunit stubs.  

One could argue (and it has been argued) that just because the message
might say "compilation error" doesn't really mean that the compiler is
reporting a compilation error.  But such word games are likely to
confuse
the typical user.

	-- Dan Eilers



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-01-29 17:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-28 19:00 Compilation error with GNAT Ben Horowitz
2004-01-28 21:13 ` Simon Wright
2004-01-28 23:07 ` Dan Eilers
2004-01-29  5:56 ` Per Sandberg
2004-01-29 17:37   ` Dan Eilers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox