[gps-devel] RE: [gps-devel]Problems building gps-1.4.0-academic on FreeBSD 5.1 using gnat 3.15p

Ludovic Brenta ludovic.brenta@insalien.org
28 Nov 2003 14:35:00 +0100


Arnaud Charlet <charlet@ACT-Europe.FR> writes:

> > I downloaded g-heasor.ads and g-heasor.adb from gcc.gnu.org's CVS
> > repository and continued the build.
> 
> Right, that's fine.
> 
> > The final error I had was:
> 
> The version of GNAT you are using is apparently misconfigured and/or misbuilt.
> 
> My suggestion would be to use a GCC 3.4 snapshot that contains a more recent
> version of GNAT.
> 
> Alternatively, it may be possible to find a work around by tweaking the code
> around commands-external.adb:179:57

Alternatively, port the patch I included in the Debian build in GPS
1.2.2.  When I made this, I had to patch the upstream sources quite
heavily so I could use the latest official release of GNAT by ACT.

I'll use your tips about s-casutil.ad[bs] (the point that I reached
yesterday) and s-casutil.ad[bs].  Thanks for that.  I hope you can
move forward with the patch below.

-- 
Ludovic Brenta.

--- gnat-gps-1.2.2.orig/kernel/src/commands-external.adb
+++ gnat-gps-1.2.2/kernel/src/commands-external.adb
@@ -152,10 +152,6 @@
       Args      : GNAT.OS_Lib.Argument_List (1 .. Length (Command.Args));
       Real_Args : GNAT.OS_Lib.Argument_List_Access;
 
-      procedure Unchecked_Free is new Ada.Unchecked_Deallocation
-        (GNAT.OS_Lib.Argument_List, GNAT.OS_Lib.Argument_List_Access);
-
-      Exec_Command_Args : GNAT.OS_Lib.Argument_List_Access;
       Temp_Args : List_Node := First (Command.Args);
 
       Old_Dir   : constant Dir_Name_Str := Get_Current_Dir;
@@ -190,35 +186,39 @@
       --  commands should not be system-dependant
 
       if Host = Windows then
-         Exec_Command_Args :=
-           GNAT.OS_Lib.Argument_String_To_List (Exec_Command);
-
-         Real_Args := new GNAT.OS_Lib.Argument_List (1 .. 1);
-
-         Real_Args (1) := new String'(Command.Command.all);
-
-         Non_Blocking_Spawn
-           (Command.Fd,
-            Exec_Command_Args (Exec_Command_Args'First).all,
-            Exec_Command_Args
-              (Exec_Command_Args'First + 1 .. Exec_Command_Args'Last)
-            & Real_Args.all
-            & Args,
-            Err_To_Out => True,
-            Buffer_Size => 0);
-
-         for J in Real_Args'Range loop
-            GNAT.OS_Lib.Free (Real_Args (J));
-         end loop;
-
-         Unchecked_Free (Real_Args);
-
-         for J in Exec_Command_Args'Range loop
-            GNAT.OS_Lib.Free (Exec_Command_Args (J));
-         end loop;
-
-         Unchecked_Free (Exec_Command_Args);
+         declare
+            procedure Unchecked_Free is new Ada.Unchecked_Deallocation
+              (GNAT.OS_Lib.Argument_List, GNAT.OS_Lib.Argument_List_Access);
+            Exec_Command_Args : GNAT.OS_Lib.Argument_List_Access :=
+              GNAT.OS_Lib.Argument_String_To_List (Exec_Command);
+            use type GNAT.OS_Lib.String_List;
+         begin
+            Real_Args := new GNAT.OS_Lib.Argument_List (1 .. 1);
+
+            Real_Args (1) := new String'(Command.Command.all);
+
+            Non_Blocking_Spawn
+              (Command.Fd,
+               Exec_Command_Args (Exec_Command_Args'First).all,
+               Exec_Command_Args
+               (Exec_Command_Args'First + 1 .. Exec_Command_Args'Last)
+               & Real_Args.all
+               & Args,
+               Err_To_Out => True,
+               Buffer_Size => 0);
+
+            for J in Real_Args'Range loop
+               GNAT.OS_Lib.Free (Real_Args (J));
+            end loop;
+
+            Unchecked_Free (Real_Args);
+
+            for J in Exec_Command_Args'Range loop
+               GNAT.OS_Lib.Free (Exec_Command_Args (J));
+            end loop;
 
+            Unchecked_Free (Exec_Command_Args);
+         end;
       else
          Non_Blocking_Spawn
            (Command.Fd,