编译libgit2静态库时链接器错误

时间:2016-09-19 21:46:20

标签: c++ libgit2

我已成功为OSX构建了一个跨平台的静态库,其步骤如下:

mkdir build
cd build
cmake -DBUILD_SHARED_LIBS=OFF "-DCMAKE_OSX_ARCHITECTURES=x86_64;i386" ..
cmake --build .

我还大部分成功地将该库链接到我自己的项目中,但是现在我在XCode 5.1.1中遇到了大量关于缺少符号的链接器错误:

Undefined symbols for architecture x86_64:
"_SSLClose", referenced from:
  _stransport_close in libVAST.a(stransport_stream.c.o)
"_SSLCopyPeerTrust", referenced from:
  _stransport_connect in libVAST.a(stransport_stream.c.o)
  _stransport_certificate in libVAST.a(stransport_stream.c.o)
"_SSLCreateContext", referenced from:
  _git_stransport_stream_new in libVAST.a(stransport_stream.c.o)
"_SSLHandshake", referenced from:
  _stransport_connect in libVAST.a(stransport_stream.c.o)
"_SSLRead", referenced from:
  _stransport_read in libVAST.a(stransport_stream.c.o)
"_SSLSetConnection", referenced from:
  _git_stransport_stream_new in libVAST.a(stransport_stream.c.o)
"_SSLSetIOFuncs", referenced from:
  _git_stransport_stream_new in libVAST.a(stransport_stream.c.o)
"_SSLSetPeerDomainName", referenced from:
  _git_stransport_stream_new in libVAST.a(stransport_stream.c.o)
"_SSLSetProtocolVersionMax", referenced from:
  _git_stransport_stream_new in libVAST.a(stransport_stream.c.o)
"_SSLSetProtocolVersionMin", referenced from:
  _git_stransport_stream_new in libVAST.a(stransport_stream.c.o)
"_SSLSetSessionOption", referenced from:
  _git_stransport_stream_new in libVAST.a(stransport_stream.c.o)
"_SSLWrite", referenced from:
  _stransport_write in libVAST.a(stransport_stream.c.o)
"_SecCertificateCopyData", referenced from:
  _stransport_certificate in libVAST.a(stransport_stream.c.o)
"_SecCopyErrorMessageString", referenced from:
  _stransport_error in libVAST.a(stransport_stream.c.o)
"_SecTrustEvaluate", referenced from:
  _stransport_connect in libVAST.a(stransport_stream.c.o)
"  _SecTrustGetCertificateAtIndex", referenced from:
  _stransport_certificate in libVAST.a(stransport_stream.c.o)
...
...

等等。

我想在那里我有一个额外的步骤或依赖,我错过了,我得到了一些提示,鉴于这个git-hub线程生锈,它并非完全没有先例(https://github.com/rust-lang/cargo/issues/2295)但我不完全确定如何继续。想法?

1 个答案:

答案 0 :(得分:0)

最可能的原因是旧版本的OSX和libgit2。某些版本的libgit2假设OSX / macOS上的安全框架始终提供SecureTransport(提供您缺少的加密/ TLS符号的库)。

旧的操作系统不是这种情况。这是在2015年末修复的,修复版本包含在v0.24版本系列以及v0.23.2中。