首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >获取clang:错误:链接器命令失败,退出代码1

获取clang:错误:链接器命令失败,退出代码1
EN

Stack Overflow用户
提问于 2019-03-08 00:30:47
回答 1查看 1.5K关注 0票数 2

我在努力构建我的代码。当我尝试执行:go build时,我得到以下错误:

代码语言:javascript
复制
/usr/local/opt/go/libexec/pkg/tool/darwin_amd64/link: running clang failed: exit status 1
ld: warning: text-based stub file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation.tbd and library file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//Security.framework/Security.tbd and library file /System/Library/Frameworks//Security.framework/Security are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation.tbd and library file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//Security.framework/Security.tbd and library file /System/Library/Frameworks//Security.framework/Security are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation.tbd and library file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//Security.framework/Security.tbd and library file /System/Library/Frameworks//Security.framework/Security are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation.tbd and library file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//Security.framework/Security.tbd and library file /System/Library/Frameworks//Security.framework/Security are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation.tbd and library file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//Security.framework/Security.tbd and library file /System/Library/Frameworks//Security.framework/Security are out of sync. Falling back to library file for linking.
ld: warning: text-based stub file /System/Library/Frameworks//IOKit.framework/Versions/A/IOKit.tbd and library file /System/Library/Frameworks//IOKit.framework/Versions/A/IOKit are out of sync. Falling back to library file for linking.
duplicate symbol _FetchPEMRootsCTX509_MountainLion in:
    /var/folders/v8/94mqr56n2yqd9pcj8rd21cyr0000gp/T/go-link-418396971/000033.o
    /var/folders/v8/94mqr56n2yqd9pcj8rd21cyr0000gp/T/go-link-418396971/000036.o
duplicate symbol _FetchPEMRootsCTX509 in:
    /var/folders/v8/94mqr56n2yqd9pcj8rd21cyr0000gp/T/go-link-418396971/000033.o
    /var/folders/v8/94mqr56n2yqd9pcj8rd21cyr0000gp/T/go-link-418396971/000036.o
duplicate symbol _useOldCodeCTX509 in:
    /var/folders/v8/94mqr56n2yqd9pcj8rd21cyr0000gp/T/go-link-418396971/000033.o
    /var/folders/v8/94mqr56n2yqd9pcj8rd21cyr0000gp/T/go-link-418396971/000036.o
ld: 3 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

试图寻找这个问题,但没有发现任何确凿的东西。有人能帮我一下吗?

  1. 这个错误是关于什么的?因为我的程序运行得很好,就像在go run中一样完美。
  2. 如何调试它?在这里,是否有更多的标志,我可以使用,将给我额外的日志?我尝试了go build -v,输出结果是一样的。
EN

回答 1

Stack Overflow用户

发布于 2020-08-06 19:22:06

出现此错误的原因之一是因为您正在运行同一个包的函数以及包名。示例:

代码语言:javascript
复制
package server

...

server.functionOfSamePackage()

因此,将其更新为:

代码语言:javascript
复制
package server

...

functionOfSamePackage()
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55055018

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档