(Forwarding and rephrasing http://bugs.debian.org/559447)

The GNAT project manager has the concepts of "project files" and "library
project file"; a "library project file" is one that has the two attributes
Library_Name and Library_Dir; it can also have additional attributes like
Library_ALI_Dir which is what triggered the bug.

The GNAT project manager also has the concepts of project file "extensions",
"virtual extensions" and the "with" keyword which define two kinds of
relationships between packages (a "virtual extension" creates "extends"
relationahips across an entire project tree).

The documentation is unclear about the interactions between the two kinds of
project files and the two kinds of relationships.

application project "with" application project: OK
application project "with" library project: OK
application project "extends" library project: ERROR (1)
application project "extends" application project: OK
library project "with" application project: ERROR (2)
library project "with" library project: OK
library project "extends" library project: OK (3)
library project "extends" application project: ERROR (4)

(1) unless the application project recompiles the entire library,
without -fPIC, into the executables, which defeats the purpose of a
library entirely

(2) unless the library project recompiles the application sources, with
-fPIC if dynamic library, into its own Object_Dir and Library_ALI_Dir,
which defeats the purpose of the application project

(3) the extension replaces the parent, i.e. it creates a new library that
includes the object files of both the parent and of the extension; the
extension may replace some of the sources, objects and ALI files of the parent
with its own, as well as add new ones. Consequently, the extension has its own
Library_Name, Library_Dir, Object_Dir and Library_ALI_Dir that are necessarily
different from the ones of the parent.  This is incompatible with "extends all"
because "extends all" does not allow redefining these attributes.

(4) unless the library project recompiles all the application's source
files, with -fPIC if dynamic library, into its own Object_Dir, which
defeats the purpose of the application project

I think that GNAT should diagnose the errors (1), (2) and (4) and additionally
the error of applying "extends all" to a library project as in this example:

project Foo is -- library project
   for Library_Name use "foo";
   for Library_Dir use "/usr/bin";
   for Library_Kind use "dynamic";
   for Source_Dirs use ("/usr/share/ada/adainclude/foo");
   for Library_ALI_Dir use "/usr/lib/ada/adalib/foo";
   for Externally_Built use "true";
end Foo;

with "foo";
project Parent is
end Parent;

project Extension extends all "parent"; -- error (3)
end Extension;

Could someone please comment on the above?

There seems to be another, more trivial, bug in the project manager: the
virtual extension of Foo seems to inherit the Library_Dir but not the
Library_ALI_Dir.  Consequently, GNAT looks for the ALI files in /usr/lib
instead of /usr/lib/ada/adalib/foo and fails.


-- 
           Summary: Please clarify the rules regarding relationships between
                    project files
           Product: gcc
           Version: 4.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ludovic at ludovic-brenta dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42342

Reply via email to