使用 "GPR" 依赖项编译时出错

Error when compiling with the "GPR" dependency

我在使用项目依赖项“gpr.gpr”使用 GNAT Studio 编译 Ada 项目时看到以下错误。

错误: error

这是我的项目源代码:

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

gpr.gpr 中有一行导致错误: error-on-line

如果我要引用另一个依赖项,例如“aws.gpr”,一切正常。但是,“gpr.gpr”和任何引用它的项目都不会编译。

输出到: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:\GNAT20\bin"
  ERROR: value %% is illegal for typed string %%
Done Process tree, phase 1, Success=FALSE
gpr.gpr:11:04: value "C:\GNAT20\bin" is illegal for typed string "build"
gprbuild: "default.gpr" processing failed

根据对原始问题的评论,似乎设置了一个名为 GPR_BUILD 的环境变量,而项目 gpr.gpr 使用了一个名为 GPR_BUILD 的场景变量。给定项目文件源并通过在 Windows 命令行

上执行可以重现该错误
> set GPR_BUILD=C:\GNAT20\bin

然后

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

有关场景变量的更多信息,请参阅 GPRbuild 用户指南,section 2.4