You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I encountered a strange behavior while resolving an issue with a library. I have provided an example program below for reference:
withAda.Command_Line; use Ada.Command_Line;
withAda.Environment_Variables;
withAda.Text_IO;
withAda.Exceptions;
withGPR2.Project.View;
withGPR2.Project.Tree;
withGPR2.Project.Attribute.Set;
withGPR2.Context;
withGPR2.Message;
withGPR2.Log;
procedureMainisuse Ada;
use GPR2;
use GPR2.Project;
procedureDisplay (Prj : Project.View.Object);
procedureDisplay (Att : Project.Attribute.Object);
--------------- Display ---------------procedureDisplay (Att : Project.Attribute.Object) isbegin
Text_IO.Put ("" & String (Image (Att.Name.Id.Attr)));
if Att.Has_Index then
Text_IO.Put (" (" & Att.Index.Value & ")");
endif;
Text_IO.Put (" -> ");
for V of Att.Values loop
Text_IO.Put (V.Text & "");
endloop;
Text_IO.New_Line;
endDisplay;
procedureDisplay (Prj : Project.View.Object) isuse GPR2.Project.Attribute.Set;
Is_First : Boolean := True;
beginif Prj.Has_Imports thenfor W of Prj.Imports loop
Ada.Text_IO.Put_Line (String (W.Path_Name.Name));
endloop;
endif;
Text_IO.Put_Line (Prj.Kind'Img);
endDisplay;
Prj : Project.Tree.Object;
Ctx : Context.Object;
procedurePrint_Messagesisbeginif Prj.Has_Messages thenfor C in Prj.Log_Messages.Iterate (False, True, True, True, True) loop
Ada.Text_IO.Put_Line (GPR2.Log.Element (C).Format);
endloop;
endif;
endPrint_Messages;
begin-- Check if an argument is providedif Argument_Count = 0then-- No argument provided
Ada.Text_IO.Put_Line ("You need to specify the GPR file to process!");
return;
endif;
Text_IO.Put_Line (Ada.Environment_Variables.Value ("GPR_PROJECT_PATH"));
declare
Arg : Filename_Type := Filename_Type (Argument (1));
begin
Project.Tree.Load
(Self => Prj, Filename => Create (Arg), Context => Ctx);
end;
Display (Prj.Root_Project);
exceptionwhen Ex : others =>
Text_IO.Put_Line (Ada.Exceptions.Exception_Message (Ex));
Print_Messages;
raise;
endMain;
The program produces a gpr2withlist bin file. To reproduce the issue, follow the steps below:
Run the command alr get -b lace_opengl to obtain the Lace_OpenGL project and build it using Alire.
Navigate to the lace_opengl_0.1.0_672a6415/library directory.
Execute the command gpr2withlist opengl.gpr.
The following error occurs:
/tmp/lace_opengl_0.1.0_672a6415/library/opengl.gpr: fatal error, cannot load the project tree
gl.gpr:2:06: error: imported project file "lace_shared.gpr" not found
raised GPR2.PROJECT_ERROR : /tmp/lace_opengl_0.1.0_672a6415/library/opengl.gpr: fatal error, cannot load the project tree
[/workspaces/bench-source/gpr_to_source_dirs/bin/gpr_with_extract]
0x564f753a0304 gpr2__project__tree__load__2 at ???
0x564f753a06d8 gpr2__project__tree__load at ???
0x564f7507552c Main at gpr_with_extract.adb:109
0x564f75078fd3 Main at b__gpr_with_extract.adb:2384
[/lib/x86_64-linux-gnu/libc.so.6]
0x7f3870df0188
0x7f3870df0243
[/workspaces/bench-source/gpr_to_source_dirs/bin/gpr_with_extract]
0x564f750746af _start at ???
0xfffffffffffffffe
As you can see, the error states that the imported project file "lace_shared.gpr" is not found, which is an "expected" behavior, since none of the project and these dependencies are in resolution path (e.g. GPR_PROJECT_PATH).
However, when I perform the following steps, the error changes:
Navigate to the /tmp/lace_opengl_0.1.0_672a6415 directory.
Run the command eval `alr printenv` to retrieve the source environment from Alire.
Navigate to the sub-directory library
Execute the command gpr2withlist opengl.gpr.
The new error is as follows:
/tmp/lace_opengl_0.1.0_672a6415/alire/cache/dependencies/lace_collada_0.1.0_99d5bbb7/library:/tmp/lace_opengl_0.1.0_672a6415/alire/cache/dependencies/lace_math_0.1.0_3ab67197/library:/tmp/lace_opengl_0.1.0_672a6415/alire/cache/dependencies/lace_shared_0.1.0_bc8f1534:/tmp/lace_opengl_0.1.0_672a6415/alire/cache/dependencies/lace_xml_0.1.0_b6aa904a/library:/tmp/lace_opengl_0.1.0_672a6415/library:.:/tmp/Comps:/tmp/Asiscomps:
/tmp/lace_opengl_0.1.0_672a6415/library/opengl.gpr semantic error
opengl_core.gpr:34:20: error: undefined project "Lace_shared"
raised GPR2.PROJECT_ERROR : /tmp/lace_opengl_0.1
.0_672a6415/library/opengl.gpr semantic error
[/workspaces/bench-source/gpr_to_source_dirs/bin/gpr_with_extract]
0x55ce0f42bec8 gpr2__project__tree__set_context__2 at ???
0x55ce0f42c497 gpr2__project__tree__set_context at ???
0x55ce0f42e407 gpr2__project__tree__load__2 at ???
0x55ce0f42f6d8 gpr2__project__tree__load at ???
0x55ce0f10452c Main at gpr_with_extract.adb:109
0x55ce0f107fd3 Main at b__gpr_with_extract.adb:2384
[/lib/x86_64-linux-gnu/libc.so.6]
0x7f8c78d91188
0x7f8c78d91243
[/workspaces/bench-source/gpr_to_source_dirs/bin/gpr_with_extract]
0x55ce0f1036af _start at ???
0xfffffffffffffffe
Now, the error message states that the project "Lace_shared" is undefined, even though lace_shared.gpr can be resolved.
To work around this issue, it is necessary to edit all .gpr files and move the abstract project to the first imported project.
The text was updated successfully, but these errors were encountered:
I encountered a strange behavior while resolving an issue with a library. I have provided an example program below for reference:
The program produces a
gpr2withlist
bin file. To reproduce the issue, follow the steps below:alr get -b lace_opengl
to obtain the Lace_OpenGL project and build it using Alire.lace_opengl_0.1.0_672a6415/library
directory.gpr2withlist opengl.gpr
.The following error occurs:
As you can see, the error states that the imported project file "lace_shared.gpr" is not found, which is an "expected" behavior, since none of the project and these dependencies are in resolution path (e.g.
GPR_PROJECT_PATH
).However, when I perform the following steps, the error changes:
/tmp/lace_opengl_0.1.0_672a6415
directory.eval `alr printenv`
to retrieve the source environment from Alire.library
gpr2withlist opengl.gpr
.The new error is as follows:
Now, the error message states that the project "Lace_shared" is undefined, even though
lace_shared.gpr
can be resolved.To work around this issue, it is necessary to edit all
.gpr
files and move the abstract project to the first imported project.The text was updated successfully, but these errors were encountered: