如何在构建时显式链接到OS X框架?

huangapple go评论134阅读模式
英文:

Go: How to explicitly link to OS X frameworks when building?

问题

在尝试在OS X 10.10.3上使用go get bitbucket.org/liamstask/goose/cmd/goose获取和构建goose时,我遇到了以下错误:

Undefined symbols for architecture x86_64:
"_SecKeychainItemExport", referenced from:
  _FetchPEMRoots in 000001.o
"_SecTrustCopyAnchorCertificates", referenced from:
  _FetchPEMRoots in 000001.o
ld: symbol(s) not found for architecture x86_64

我认为这个错误是由于OS X中的Security框架未链接导致的。可能与此相关的一些信息可以在这里找到:https://github.com/golang/go/issues/11258

那么,我该如何显式链接到这个库呢?或者还有其他我忽略的东西吗?

感谢帮助!

英文:

When trying to get and build goose on OS X 10.10.3 using go get bitbucket.org/liamstask/goose/cmd/goose I get this error:

Undefined symbols for architecture x86_64:
"_SecKeychainItemExport", referenced from:
  _FetchPEMRoots in 000001.o
"_SecTrustCopyAnchorCertificates", referenced from:
  _FetchPEMRoots in 000001.o
ld: symbol(s) not found for architecture x86_64

I figure this error being due to the Security framework in OS X not being linked. Some possibly related info here: https://github.com/golang/go/issues/11258

So, how can I link to this library explicitly? Or is there something else I am missing?

Thankful for help!

答案1

得分: 2

你可以将go build的标志传递给go get。所以:

go get -f -u -ldflags "-framework Security" bitbucket.org/liamstask/goose/cmd/goose

将强制下载并链接到Security框架。

英文:

You can pass go build flags to go get. So:

go get -f -u -ldflags "-framework Security" bitbucket.org/liamstask/goose/cmd/goose

will force the download and link against Security framework.

huangapple
  • 本文由 发表于 2015年7月30日 00:39:39
  • 转载请务必保留本文链接:https://go.coder-hub.com/31706329.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定