Strange behavior with library import resolution (with in GPR files)
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Ambito
- build-system
Direzione di ricerca
Inizia con l’entry point Project.Tree.Load mostrato nell’esempio e riproduci il comportamento usando gpr2withlist su opengl.gpr, sia senza sia dopo eval alr printenv. Confronta la risoluzione di lace_shared.gpr con il successivo errore relativo al progetto non definito "Lace_shared"; il lavoro è completato quando i progetti astratti importati vengono risolti in modo coerente senza richiedere modifiche a ogni file .gpr.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
I encountered a strange behavior while resolving an issue with a library. I have provided an example program below for reference:
with Ada.Command_Line; use Ada.Command_Line;
with Ada.Environment_Variables;
with Ada.Text_IO;
with Ada.Exceptions;
with GPR2.Project.View;
with GPR2.Project.Tree;
with GPR2.Project.Attribute.Set;
with GPR2.Context;
with GPR2.Message;
with GPR2.Log;
procedure Main is
use Ada;
use GPR2;
use GPR2.Project;
procedure Display (Prj : Project.View.Object);
procedure Display (Att : Project.Attribute.Object);
-------------
-- Display --
-------------
procedure Display (Att : Project.Attribute.Object) is
begin
Text_IO.Put (" " & String (Image (Att.Name.Id.Attr)));
if Att.Has_Index then
Text_IO.Put (" (" & Att.Index.Value & ")");
end if;
Text_IO.Put (" -> ");
for V of Att.Values loop
Text_IO.Put (V.Text & " ");
end loop;
Text_IO.New_Line;
end Display;
procedure Display (Prj : Project.View.Object) is
use GPR2.Project.Attribute.Set;
Is_First : Boolean := True;
begin
if Prj.Has_Imports then
for W of Prj.Imports loop
Ada.Text_IO.Put_Line (String (W.Path_Name.Name));
end loop;
end if;
Text_IO.Put_Line (Prj.Kind'Img);
end Display;
Prj : Project.Tree.Object;
Ctx : Context.Object;
procedure Print_Messages is
begin
if Prj.Has_Messages then
for C in Prj.Log_Messages.Iterate (False, True, True, True, True) loop
Ada.Text_IO.Put_Line (GPR2.Log.Element (C).Format);
end loop;
end if;
end Print_Messages;
begin
-- Check if an argument is provided
if Argument_Count = 0 then
-- No argument provided
Ada.Text_IO.Put_Line ("You need to specify the GPR file to process!");
return;
end if;
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);
exception
when Ex : others =>
Text_IO.Put_Line (Ada.Exceptions.Exception_Message (Ex));
Print_Messages;
raise;
end Main;
The program produces a gpr2withlist bin file. To reproduce the issue, follow the steps below:
- Run the command
alr get -b lace_openglto obtain the Lace_OpenGL project and build it using Alire. - Navigate to the
lace_opengl_0.1.0_672a6415/librarydirectory. - 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_672a6415directory. - 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.
- Lingua principale
- Ada
- Stelle
- 21
- Fork
- 12
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di AdaCore/gpr
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 42/100
-
gprconfig crashes with ENCODING_ERROR when environment variables contain non-ASCII charactersAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 38/100
-
Build failure with GNU gnat 13.3.0 and gnatcoll-cor 25.0.0: gpr2-build-signature.adb:78:24: error: no selector "Finalize" for private type "JSON_Value"Forse di nuovo libera @Fabien-Chouteau l’ha presa 541 giorni fa e non c’è nessuna pull request aperta. Aperta
Issue simili
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
HarperFast/harper#2860 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
anthropics/skills#1893 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
pnpm install exits 1: MemoryCore/pnpm-workspace.yaml ships "set this to true or false" placeholdersAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
TencentCloud/TencentDB-Agent-Memory#1544 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
YosysHQ/oss-cad-suite-build#216 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
openwatersio/slackwater.xyz#124 ·
I maintainer di solito rispondono entro 1 giorno