Error “ld: library not found for语言 - lSystem” with GPS on MacOS



我正在用GPS对ADA进行编程。问题是,当我用GPS编译任何代码时,我会得到这个错误:

ld: library not found for -lSystem collect2: error: ld returned 1 exit status

我已经更新并重新安装了所有东西(xcode、gcc(,重新安装了GPS,并安装了命令行工具。

这就是GPS通过终端向我显示的内容:

gprbuild -d -P/Users/pedromarti/Desktop/helloWorld/default.gpr /Users/pedromarti/Desktop/helloWorld/src/main.adb Bind [gprbind] main.bexch [Ada] main.ali Link [link] main.adb ld: library not found for -lSystem collect2: error: ld returned 1 exit status gprbuild: link of main.adb failed gprbuild: failed command was: /users/pedromarti/opt/gnat/2019/bin/gcc main.o b__main.o -L/Users/pedromarti/Desktop/helloWorld/obj/ -L/Users/pedromarti/Desktop/helloWorld/obj/ -L/users/pedromarti/opt/gnat/2019/lib/gcc/x86_64-apple-darwin17.7.0/8.3.1/adalib/ /users/pedromarti/opt/gnat/2019/lib/gcc/x86_64-apple-darwin17.7.0/8.3.1/adalib/libgnat.a -Wl,-rpath,@executable_path/ -Wl,-rpath,@executable_path/../../..//opt/gnat/2019/lib/gcc/x86_64-apple-darwin17.7.0/8.3.1/adalib -o main [2021-03-18 13:38:56] process exited with status 4, elapsed time: 02.57s

我不知道我还能做什么。如果有人知道解决方案,欢迎你!

您使用的是GNAT社区版2019。我不知道你在哪个操作系统版本上运行,在这种情况下,我认为这没有什么区别。

下载网站上的自述显示

== Mac OS: Xcode is now needed ==
On Mac OS, GNAT Community 2019 requires Xcode version 10 or above to be
installed. Once you do have Xcode installed, if you still observe an error
of the form:
ld: library not found for -lSystem
then you might have to execute the following:
xcode-select -s /Applications/Xcode.app/Contents/Developer

Xcode很大,但免费,从应用商店下载需要一段时间(转到"开发"选项卡(。

如果您的建筑系统有缓存系统,则需要清除缓存。

例如,如果您正在使用cmake,请记住删除cmake构建目录,以避免cmakecache将其带到错误的链接。

最新更新