2

我安装了clang-10and lld-10,但我不能lld用作链接器。

留言:

[root@mine ~]# ll /usr/local/bin/lld
-rwxr-xr-x 1 root root 79005720 Mar 26 14:26 /usr/local/bin/lld

[root@mine ~]# ll /usr/local/bin/ld.lld
lrwxrwxrwx 1 root root 3 Mar 26 14:51 /usr/local/bin/ld.lld -> lld

[root@mine ~]# lld -v
lld is a generic driver.
Invoke ld.lld (Unix), ld64.lld (macOS), lld-link (Windows), wasm-ld (WebAssembly) instead

[root@mine ~]# ld.lld -v
LLD 10.0.0 (compatible with GNU linkers)

[root@mine ~]# cat main.cpp
int main() {}

[root@mine ~]# clang++ -fuse-ld=lld main.cpp
ld.lld: error: cannot open output file a.out: Function not implemented
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)

为什么不lld-10工作?

如果我使用ld而不是lld

[root@mine ~]# clang++ -fuse-ld=ld main.cpp

那么一切都好!

4

0 回答 0