1
votes

I see the following error when compiling an Ada project with GNAT Studio, using the project dependency "gpr.gpr".

Error: error

Here is my project source code:

with "gpr.gpr";
project Default is
    for Soure_Dirs use ("src");
    for Object_Dir use "obj";
    for Main use ("main.adb")
end Default;

There is a line within gpr.gpr that is causing the error: error-on-line

If I were to reference another dependency, such as "aws.gpr", everything works fine. However, "gpr.gpr" and any project that references it does not compile.

Output to: gprbuild -vP2 -P default.gpr

Process tree, phase 1
  Value_Of (library_type) is default "static"
  Value_Of (xmlada_build) is default "static"
  Value_Of (library_type) is default "static"
  Value_Of (xmlada_build) is default "static"
  Value_Of (library_type) is default "static"
  Value_Of (xmlada_build) is default "static"
  Value_Of (library_type) is default "static"
  Value_Of (xmlada_build) is default "static"
  Value_Of (library_type) is default "static"
  Value_Of (xmlada_build) is default "static"
  Value_Of (library_type) is default "static"
  Value_Of (gpr_build) is "C:\GNAT\2020\bin"
  ERROR: value %% is illegal for typed string %%
Done Process tree, phase 1, Success=FALSE
gpr.gpr:11:04: value "C:\GNAT\2020\bin" is illegal for typed string "build"
gprbuild: "default.gpr" processing failed
1
Can you confirm that no environment variable named GPR_BUILD or LIBRARY_TYPE has been set? Such an environment variable may, in this case, interfere with your build. - DeeDee
I confirm no environmental variable has been set with those names. - John Malone
Just to confirm from my side: when I try to compile a project based on the given project source code it compiles without problems on GNAT CE 2020 (both on Windows and Linux). - DeeDee
You might want to try to compile from the command line using gprbuild -vP2 -P default.gpr to further isolate the problem (look for lines containing Value_Of and C:\GNAT\2020\bin). - DeeDee
Thanks for the tip! I have placed the lines with Value_Of into the question. Please let me know if you would like the rest of the output or anything else. - John Malone

1 Answers

1
votes

Based on the comments to the original question, it appeared that an environment variable named GPR_BUILD was set while a scenario variable named GPR_BUILD is used by the project gpr.gpr. The error could be reproduced given the project file source and by executing on the Windows command line

> set GPR_BUILD=C:\GNAT\2020\bin

and then

> gprbuild -P default.gpr
gpr.gpr:11:04: value "C:\GNAT\2020\bin" is illegal for typed string "build"
gprbuild: "default.gpr" processing failed

For more info on scenario variables, see the GPRbuild user's guide, section 2.4.