如何摆脱 Apple Mach-O 链接器错误?

Posted

技术标签:

【中文标题】如何摆脱 Apple Mach-O 链接器错误?【英文标题】:How to get rid of Apple Mach-O Linker Errors? 【发布时间】:2014-08-11 09:33:00 【问题描述】:

首先我有一个Could not build module Foundation

试图通过将Enable Modules (C and Objective-C) 设置为NO 来解决这个问题

在另一个构建之后,我得到了这些奇怪的错误:

Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_EAGLContext", referenced from:
      objc-class-ref in EZAudioPlotGLKViewController-11ED1EEF7D7801BD.o
  "_OBJC_CLASS_$_GLKBaseEffect", referenced from:
      objc-class-ref in EZAudioPlotGLKViewController-11ED1EEF7D7801BD.o
  "_OBJC_CLASS_$_GLKViewController", referenced from:
      _OBJC_CLASS_$_EZAudioPlotGLKViewController in EZAudioPlotGLKViewController-11ED1EEF7D7801BD.o
  "_OBJC_CLASS_$_NSEntityDescription", referenced from:
      objc-class-ref in JSONModel+CoreData.o
  "_OBJC_CLASS_$_NSManagedObject", referenced from:
      l_OBJC_$_CATEGORY_NSManagedObject_$_JSONModel in JSONModel+CoreData.o
      objc-class-ref in JSONModel+CoreData.o
  "_OBJC_METACLASS_$_GLKViewController", referenced from:
      _OBJC_METACLASS_$_EZAudioPlotGLKViewController in EZAudioPlotGLKViewController-11ED1EEF7D7801BD.o
  "_SSLClose", referenced from:
      -[GCDAsyncSocket closeWithError:] in GCDAsyncSocket.o
  "_SSLCopyPeerTrust", referenced from:
      -[GCDAsyncSocket ssl_continueSSLHandshake] in GCDAsyncSocket.o
  "_SSLCreateContext", referenced from:
      -[GCDAsyncSocket ssl_startTLS] in GCDAsyncSocket.o
  "_SSLGetBufferedReadSize", referenced from:
      ___33-[GCDAsyncSocket flushSSLBuffers]_block_invoke in GCDAsyncSocket.o
      -[GCDAsyncSocket doReadData] in GCDAsyncSocket.o
  "_SSLHandshake", referenced from:
      -[GCDAsyncSocket ssl_continueSSLHandshake] in GCDAsyncSocket.o
  "_SSLRead", referenced from:
      -[GCDAsyncSocket flushSSLBuffers] in GCDAsyncSocket.o
      -[GCDAsyncSocket doReadData] in GCDAsyncSocket.o
  "_SSLSetCertificate", referenced from:
      -[GCDAsyncSocket ssl_startTLS] in GCDAsyncSocket.o
  "_SSLSetConnection", referenced from:
      -[GCDAsyncSocket ssl_startTLS] in GCDAsyncSocket.o
  "_SSLSetEnabledCiphers", referenced from:
      -[GCDAsyncSocket ssl_startTLS] in GCDAsyncSocket.o
  "_SSLSetIOFuncs", referenced from:
      -[GCDAsyncSocket ssl_startTLS] in GCDAsyncSocket.o
  "_SSLSetPeerDomainName", referenced from:
      -[GCDAsyncSocket ssl_startTLS] in GCDAsyncSocket.o
  "_SSLSetPeerID", referenced from:
      -[GCDAsyncSocket ssl_startTLS] in GCDAsyncSocket.o
  "_SSLSetProtocolVersionMax", referenced from:
      -[GCDAsyncSocket ssl_startTLS] in GCDAsyncSocket.o
  "_SSLSetProtocolVersionMin", referenced from:
      -[GCDAsyncSocket ssl_startTLS] in GCDAsyncSocket.o
  "_SSLSetSessionOption", referenced from:
      -[GCDAsyncSocket ssl_startTLS] in GCDAsyncSocket.o
  "_SSLWrite", referenced from:
      -[GCDAsyncSocket doWriteData] in GCDAsyncSocket.o
  "_glBindBuffer", referenced from:
      -[EZAudioPlotGLKViewController _updateBufferPlotBufferWithAudioReceived:withBufferSize:] in EZAudioPlotGLKViewController-11ED1EEF7D7801BD.o
      -[EZAudioPlotGLKViewController _updateRollingPlotBufferWithAudioReceived:withBufferSize:] in EZAudioPlotGLKViewController-11ED1EEF7D7801BD.o
      -[EZAudioPlotGLKViewController _drawBufferPlotWithView:drawInRect:] in EZAudioPlotGLKViewController-11ED1EEF7D7801BD.o
      -[EZAudioPlotGLKViewController _drawRollingPlotWithView:drawInRect:] in EZAudioPlotGLKViewController-11ED1EEF7D7801BD.o
  "_glBufferData", referenced from:
      -[EZAudioPlotGLKViewController _updateBufferPlotBufferWithAudioReceived:withBufferSize:] in EZAudioPlotGLKViewController-11ED1EEF7D7801BD.o
      -[EZAudioPlotGLKViewController _updateRollingPlotBufferWithAudioReceived:withBufferSize:] in EZAudioPlotGLKViewController-11ED1EEF7D7801BD.o
  "_glBufferSubData", referenced from:
      -[EZAudioPlotGLKViewController _clearRollingPlot] in EZAudioPlotGLKViewController-11ED1EEF7D7801BD.o
      -[EZAudioPlotGLKViewController _updateBufferPlotBufferWithAudioReceived:withBufferSize:] in EZAudioPlotGLKViewController-11ED1EEF7D7801BD.o
      -[EZAudioPlotGLKViewController _updateRollingPlotBufferWithAudioReceived:withBufferSize:] in EZAudioPlotGLKViewController-11ED1EEF7D7801BD.o
      -[EZAudioPlotGLKViewController _updateRollingPlotDisplay] in EZAudioPlotGLKViewController-11ED1EEF7D7801BD.o
  "_glClear", referenced from:
      -[EZAudioPlotGLKViewController glkView:drawInRect:] in EZAudioPlotGLKViewController-11ED1EEF7D7801BD.o
  "_glClearColor", referenced from:
      -[EZAudioPlotGLKViewController _refreshWithBackgroundColor:] in EZAudioPlotGLKViewController-11ED1EEF7D7801BD.o
  "_glDrawArrays", referenced from:
      -[EZAudioPlotGLKViewController _drawBufferPlotWithView:drawInRect:] in EZAudioPlotGLKViewController-11ED1EEF7D7801BD.o
      -[EZAudioPlotGLKViewController _drawRollingPlotWithView:drawInRect:] in EZAudioPlotGLKViewController-11ED1EEF7D7801BD.o
  "_glEnableVertexAttribArray", referenced from:
      -[EZAudioPlotGLKViewController _drawBufferPlotWithView:drawInRect:] in EZAudioPlotGLKViewController-11ED1EEF7D7801BD.o
      -[EZAudioPlotGLKViewController _drawRollingPlotWithView:drawInRect:] in EZAudioPlotGLKViewController-11ED1EEF7D7801BD.o
  "_glGenBuffers", referenced from:
      -[EZAudioPlotGLKViewController viewDidLoad] in EZAudioPlotGLKViewController-11ED1EEF7D7801BD.o
  "_glLineWidth", referenced from:
      -[EZAudioPlotGLKViewController viewDidLoad] in EZAudioPlotGLKViewController-11ED1EEF7D7801BD.o
  "_glPopMatrix", referenced from:
      -[EZAudioPlotGLKViewController _drawBufferPlotWithView:drawInRect:] in EZAudioPlotGLKViewController-11ED1EEF7D7801BD.o
      -[EZAudioPlotGLKViewController _drawRollingPlotWithView:drawInRect:] in EZAudioPlotGLKViewController-11ED1EEF7D7801BD.o
  "_glPushMatrix", referenced from:
      -[EZAudioPlotGLKViewController _drawBufferPlotWithView:drawInRect:] in EZAudioPlotGLKViewController-11ED1EEF7D7801BD.o
      -[EZAudioPlotGLKViewController _drawRollingPlotWithView:drawInRect:] in EZAudioPlotGLKViewController-11ED1EEF7D7801BD.o
  "_glVertexAttribPointer", referenced from:
      -[EZAudioPlotGLKViewController _drawBufferPlotWithView:drawInRect:] in EZAudioPlotGLKViewController-11ED1EEF7D7801BD.o
      -[EZAudioPlotGLKViewController _drawRollingPlotWithView:drawInRect:] in EZAudioPlotGLKViewController-11ED1EEF7D7801BD.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我一无所知。这发生在我从我们的 SVN 存储库更新此项目之后。

【问题讨论】:

【参考方案1】:

您需要在以下框架中链接:

CoreData.framework
GLKit.framework
Security.framework

这是在以下 Xcode 中完成的:

【讨论】:

@WarrenBurton 错过了。谢谢。 非常感谢。现在工作。此外,在我正在使用的音频框架中,有一些额外的功能,其中包含一些使用 OPENGL 和其他一些额外框架的音频绘图,我现在将其注释掉,因为我根本没有使用它们。 为我工作!谢谢!你救了我几个小时。

以上是关于如何摆脱 Apple Mach-O 链接器错误?的主要内容,如果未能解决你的问题,请参考以下文章

如何修复 xcode 中的 Apple Mach-O 链接器错误组问题?

如何解决 Firebase 中的 Apple Mach-O 链接器错误?

CocoaAsyncSocket Apple Mach-O 链接器错误

Apple Mach-O 链接器错误解析

Apple Mach-O 链接器错误,目标 C

ios- Apple Mach-O 链接器错误 [重复]