Ada 路径查询——这次是用 gnatmake
Ada path query -- this time with gnatmake
正在尝试构建 ada-util
中的示例代码。所以我 运行
gnatmake json.adb
在 ada-util/samples/
目录中。
但是我收到以下错误:
gnatmake json.adb
gcc -c json.adb
json.adb:21:06: file "util.ads" not found
json.adb:23:06: file "util.ads" not found
json.adb:23:06: "Json (body)" depends on "Mapping (spec)"
json.adb:23:06: "Mapping (spec)" depends on "Util (spec)"
json.adb:24:06: file "util.ads" not found
json.adb:25:06: file "util.ads" not found
json.adb:26:06: file "util.ads" not found
gnatmake: "json.adb" compilation error
所以我的路径显然有问题,因为我已经安装了 ada-util
并且我可以确认 util.ads
在安装目录中。现在,很明显这里出了点问题,因为这不是我最近遇到的 Ada 的第一个 PATH 问题。它应该安装在哪里?目前它位于 GNAT
安装所在的 /opt/GNAT/2020/include/utilada_core.static/util.ads
下。
问题:
- 不在这里应该在哪里?
- 我是否必须告诉
gnatmake
它在哪里,如果是的话如何 - 在文档中看不到
- 如果是这样,为什么我必须告诉
gnatmake
我按照安装说明给出的位置 -- 这是安装过程中的错误还是其他原因?
找我,好像图书馆就在合适的地方。
如你所料,你必须告诉它图书馆的位置。据我所知,在项目的根目录中,有文件samples.gpr
。因此,如果要构建示例,则必须在项目的根目录下执行:
gnatmake -P samples.gpr
或者,如果您在样本目录中(如您的示例):
gnatmake -P ../samples.gpr
这应该构建所有样本。
默认情况下,gnatmake
无法找到所需的库,就像 GCC 无法为 C/C++ 项目找到额外的库一样。它通常由 GNAT 项目文件(这些文件带有 .gpr
扩展名,简单的方法)或通过编译标志(困难的方法)或 Makefiles 完成。 Ada编译过程类似于C/C++。它还需要很多标志、设置,有时,对于一个不能开箱即用的更大项目。 :)
正在尝试构建 ada-util
中的示例代码。所以我 运行
gnatmake json.adb
在 ada-util/samples/
目录中。
但是我收到以下错误:
gnatmake json.adb
gcc -c json.adb
json.adb:21:06: file "util.ads" not found
json.adb:23:06: file "util.ads" not found
json.adb:23:06: "Json (body)" depends on "Mapping (spec)"
json.adb:23:06: "Mapping (spec)" depends on "Util (spec)"
json.adb:24:06: file "util.ads" not found
json.adb:25:06: file "util.ads" not found
json.adb:26:06: file "util.ads" not found
gnatmake: "json.adb" compilation error
所以我的路径显然有问题,因为我已经安装了 ada-util
并且我可以确认 util.ads
在安装目录中。现在,很明显这里出了点问题,因为这不是我最近遇到的 Ada 的第一个 PATH 问题。它应该安装在哪里?目前它位于 GNAT
安装所在的 /opt/GNAT/2020/include/utilada_core.static/util.ads
下。
问题:
- 不在这里应该在哪里?
- 我是否必须告诉
gnatmake
它在哪里,如果是的话如何 - 在文档中看不到 - 如果是这样,为什么我必须告诉
gnatmake
我按照安装说明给出的位置 -- 这是安装过程中的错误还是其他原因?
找我,好像图书馆就在合适的地方。
如你所料,你必须告诉它图书馆的位置。据我所知,在项目的根目录中,有文件
samples.gpr
。因此,如果要构建示例,则必须在项目的根目录下执行:gnatmake -P samples.gpr
或者,如果您在样本目录中(如您的示例):
gnatmake -P ../samples.gpr
这应该构建所有样本。
默认情况下,
gnatmake
无法找到所需的库,就像 GCC 无法为 C/C++ 项目找到额外的库一样。它通常由 GNAT 项目文件(这些文件带有.gpr
扩展名,简单的方法)或通过编译标志(困难的方法)或 Makefiles 完成。 Ada编译过程类似于C/C++。它还需要很多标志、设置,有时,对于一个不能开箱即用的更大项目。 :)