When the GNAT driver is invoked to bind a main of a project file, and
there are externally built library projects in the closure of the main
project file, the invocation of gnatbind may fail if the object directory
does not contain any ALI files.

Tested on x86_64-pc-linux-gnu, committed on trunk

2014-02-19  Vincent Celier  <cel...@adacore.com>

        * gnatcmd.adb (GNATCmd): Always replace the object dirs of
        imported library projects with the library ALI dirs, when setting
        the object paths.
        * prj-env.ads (Ada_Objects_Path): Correct comments about
        argument Including_Libraries.

Index: gnatcmd.adb
===================================================================
--- gnatcmd.adb (revision 207879)
+++ gnatcmd.adb (working copy)
@@ -1040,6 +1040,7 @@
                 "accept project file switches -vPx, -Pprj and -Xnam=val");
       New_Line;
    end Non_VMS_Usage;
+
    ------------------
    -- Process_Link --
    ------------------
@@ -2106,7 +2107,7 @@
          --  Set up the env vars for project path files
 
          Prj.Env.Set_Ada_Paths
-           (Project, Project_Tree, Including_Libraries => False);
+           (Project, Project_Tree, Including_Libraries => True);
 
          --  For gnatcheck, gnatstub, gnatmetric, gnatpp and gnatelim, create
          --  a configuration pragmas file, if necessary.
Index: prj-env.adb
===================================================================
--- prj-env.adb (revision 207879)
+++ prj-env.adb (working copy)
@@ -1681,8 +1681,6 @@
          Path : Path_Name_Type;
 
       begin
-         --  ??? This is almost the equivalent of For_All_Source_Dirs
-
          if Process_Source_Dirs then
 
             --  Add to path all source directories of this project if there are
Index: prj-env.ads
===================================================================
--- prj-env.ads (revision 207879)
+++ prj-env.ads (working copy)
@@ -92,7 +92,7 @@
       Including_Libraries : Boolean := True) return String_Access;
    --  Get the ADA_OBJECTS_PATH of a Project file. For the first call with the
    --  exact same parameters, compute it and cache it. When Including_Libraries
-   --  is False, the object directory of a library project is replaced with the
+   --  is True, the object directory of a library project is replaced with the
    --  library ALI directory of this project (usually the library directory of
    --  the project, except when attribute Library_ALI_Dir is declared) except
    --  when the library ALI directory does not contain any ALI file.

Reply via email to