【问题标题】:Apple Mach-O Linker Error - Objective CApple Mach-O 链接器错误 - Objective C
【发布时间】:2014-05-25 14:13:45
【问题描述】:

我在 XCode 上编译现有项目时遇到此错误。我尝试使用 Google Drive(步骤 3)https://developers.google.com/drive/ios/quickstart 中的快速入门,在完成所有 8 个步骤后,我收到了 4 个 Apple Mach-O 链接器错误。然后我撤消了所有步骤,但更糟糕的是。

Undefined symbols for architecture i386:
      "_initGenericErrorDefaultFunc", referenced from:
          ___23+[DDXMLNode initialize]_block_invoke in DDXMLNode.o
      "_xmlAddChild", referenced from:
          -[DDXMLElement addAttribute:] in DDXMLElement.o
          -[DDXMLElement addChild:] in DDXMLElement.o
          -[DDXMLElement insertChild:atIndex:] in DDXMLElement.o
          _xmpp_xmlStartElement in XMPPParser.o
          _xmpp_xmlCharacters in XMPPParser.o
      "_xmlAddPrevSibling", referenced from:
          -[DDXMLElement insertChild:atIndex:] in DDXMLElement.o
      "_xmlBufferCreate", referenced from:
          -[DDXMLNode XMLStringWithOptions:] in DDXMLNode.o
      "_xmlBufferFree", referenced from:
          -[DDXMLNode XMLStringWithOptions:] in DDXMLNode.o
      "_xmlCopyDoc", referenced from:
          -[DDXMLNode copyWithZone:] in DDXMLNode.o
      "_xmlCopyDtd", referenced from:
          -[DDXMLNode copyWithZone:] in DDXMLNode.o
      "_xmlCopyNamespace", referenced from:
          -[DDXMLNode copyWithZone:] in DDXMLNode.o
      "_xmlCopyNode", referenced from:
          _xmpp_onDidReadRoot in XMPPParser.o
          -[DDXMLNode copyWithZone:] in DDXMLNode.o
      "_xmlCopyProp", referenced from:
          -[DDXMLNode copyWithZone:] in DDXMLNode.o
      "_xmlCreatePushParserCtxt", referenced from:
          -[XMPPParser initWithDelegate:delegateQueue:parserQueue:] in XMPPParser.o
      "_xmlCtxtGetLastError", referenced from:
          ___24-[XMPPParser parseData:]_block_invoke in XMPPParser.o
      "_xmlDocGetRootElement", referenced from:
          -[DDXMLDocument rootElement] in DDXMLDocument.o
          _xmpp_postEndElement in XMPPParser.o
          _xmpp_xmlSearchNs in XMPPParser.o
          _xmpp_postStartElement in XMPPParser.o
      "_xmlDocSetRootElement", referenced from:
          -[DDXMLNode nodesForXPath:error:] in DDXMLNode.o
      "_xmlEncodeSpecialChars", referenced from:
          -[DDXMLNode setStringValue:] in DDXMLNode.o
          -[DDXMLNamespaceNode setStringValue:] in DDXMLNode.o
          -[DDXMLAttributeNode setStringValue:] in DDXMLNode.o
      "_xmlFree", referenced from:
          _xmpp_xmlStartElement in XMPPParser.o
          -[DDXMLNode setStringValue:] in DDXMLNode.o
          -[DDXMLNode stringValue] in DDXMLNode.o
          -[DDXMLNamespaceNode setName:] in DDXMLNode.o
          -[DDXMLNamespaceNode setStringValue:] in DDXMLNode.o
          -[DDXMLAttributeNode setStringValue:] in DDXMLNode.o
          _xmpp_xmlStartElement in XMPPParser.o
          -[DDXMLNode setStringValue:] in DDXMLNode.o
          -[DDXMLNode stringValue] in DDXMLNode.o
          -[DDXMLNamespaceNode setName:] in DDXMLNode.o
          -[DDXMLNamespaceNode setStringValue:] in DDXMLNode.o
          -[DDXMLAttributeNode setStringValue:] in DDXMLNode.o
      "_xmlFreeDoc", referenced from:
          -[XMPPParser dealloc] in XMPPParser.o
          -[DDXMLNode dealloc] in DDXMLNode.o
          -[DDXMLNode nodesForXPath:error:] in DDXMLNode.o
      "_xmlFreeDtd", referenced from:
          -[DDXMLNode dealloc] in DDXMLNode.o
      "_xmlFreeNode", referenced from:
          -[DDXMLNode dealloc] in DDXMLNode.o
          +[DDXMLNode removeChild:] in DDXMLNode.o
          +[DDXMLNode removeAllChildrenFromNode:] in DDXMLNode.o
      "_xmlFreeNs", referenced from:
          -[DDXMLNode dealloc] in DDXMLNode.o
          +[DDXMLNode removeNamespace:fromNode:] in DDXMLNode.o
          +[DDXMLNode removeAllNamespacesFromNode:] in DDXMLNode.o
          -[DDXMLAttributeNode dealloc] in DDXMLNode.o
          -[DDXMLAttributeNode setURI:] in DDXMLNode.o
      "_xmlFreeParserCtxt", referenced from:
          -[XMPPParser dealloc] in XMPPParser.o
      "_xmlFreeProp", referenced from:
          -[DDXMLNode dealloc] in DDXMLNode.o
          +[DDXMLNode removeAttribute:] in DDXMLNode.o
          +[DDXMLNode removeAllAttributesFromNode:] in DDXMLNode.o
      "_xmlIndentTreeOutput", referenced from:
          -[DDXMLNode XMLStringWithOptions:] in DDXMLNode.o
      "_xmlKeepBlanksDefault", referenced from:
          -[DDXMLDocument initWithData:options:error:] in DDXMLDocument.o
          ___23+[DDXMLNode initialize]_block_invoke in DDXMLNode.o
      "_xmlNewComment", referenced from:
          +[DDXMLNode commentWithStringValue:] in DDXMLNode.o
      "_xmlNewDoc", referenced from:
          -[XMPPParser initWithDelegate:delegateQueue:parserQueue:] in XMPPParser.o
          -[DDXMLNode nodesForXPath:error:] in DDXMLNode.o
      "_xmlNewDocNode", referenced from:
          _xmpp_xmlStartElement in XMPPParser.o
      "_xmlNewNode", referenced from:
          -[DDXMLElement initWithName:] in DDXMLElement.o
          -[DDXMLElement initWithName:URI:] in DDXMLElement.o
          -[DDXMLElement initWithName:stringValue:] in DDXMLElement.o
      "_xmlNewNs", referenced from:
          _xmpp_xmlStartElement in XMPPParser.o
          +[DDXMLNode namespaceWithName:stringValue:] in DDXMLNode.o
          -[DDXMLNode setURI:] in DDXMLNode.o
          +[DDXMLNode recursiveMigrateNamespace:to:node:] in DDXMLNode.o
          +[DDXMLNode recursiveFixDefaultNamespacesInNode:withNewRoot:] in DDXMLNode.o
          -[DDXMLAttributeNode detach] in DDXMLNode.o
          -[DDXMLAttributeNode setURI:] in DDXMLNode.o
          ...
      "_xmlNewNsProp", referenced from:
          _xmpp_xmlStartElement in XMPPParser.o
      "_xmlNewPI", referenced from:
          +[DDXMLNode processingInstructionWithName:stringValue:] in DDXMLNode.o
      "_xmlNewProp", referenced from:
          _xmpp_xmlStartElement in XMPPParser.o
          +[DDXMLNode attributeWithName:stringValue:] in DDXMLNode.o
          +[DDXMLNode attributeWithName:URI:stringValue:] in DDXMLNode.o
      "_xmlNewText", referenced from:
          +[DDXMLNode textWithStringValue:] in DDXMLNode.o
          -[DDXMLAttributeNode setStringValue:] in DDXMLNode.o
      "_xmlNewTextLen", referenced from:
          _xmpp_xmlCharacters in XMPPParser.o
      "_xmlNodeDump", referenced from:
          -[DDXMLNode XMLStringWithOptions:] in DDXMLNode.o
      "_xmlNodeGetContent", referenced from:
          -[DDXMLNode stringValue] in DDXMLNode.o
      "_xmlNodeSetContent", referenced from:
          -[DDXMLNode setStringValue:] in DDXMLNode.o
          -[DDXMLAttributeNode setStringValue:] in DDXMLNode.o
      "_xmlNodeSetName", referenced from:
          -[DDXMLNode setName:] in DDXMLNode.o
      "_xmlParseChunk", referenced from:
          ___24-[XMPPParser parseData:]_block_invoke in XMPPParser.o
      "_xmlParseMemory", referenced from:
          -[DDXMLDocument initWithData:options:error:] in DDXMLDocument.o
      "_xmlSaveNoEmptyTags", referenced from:
          -[DDXMLNode XMLStringWithOptions:] in DDXMLNode.o
      "_xmlSearchNs", referenced from:
          -[DDXMLElement elementsForName:] in DDXMLElement.o
          -[DDXMLAttributeNode URI] in DDXMLNode.o
      "_xmlSetStructuredErrorFunc", referenced from:
          ___23+[DDXMLNode initialize]_block_invoke in DDXMLNode.o
      "_xmlStopParser", referenced from:
          _xmpp_xmlAbortDueToMemoryShortage in XMPPParser.o
      "_xmlStrEqual", referenced from:
          -[DDXMLElement _elementsForName:localName:prefix:uri:] in DDXMLElement.o
          -[DDXMLElement _hasAttributeWithName:] in DDXMLElement.o
          -[DDXMLElement _removeAttributeForName:] in DDXMLElement.o
          -[DDXMLElement attributeForName:] in DDXMLElement.o
          -[DDXMLElement _removeNamespaceForPrefix:] in DDXMLElement.o
          -[DDXMLElement namespaceForPrefix:] in DDXMLElement.o
          -[DDXMLElement _recursiveResolveNamespaceForPrefix:atNode:] in DDXMLElement.o
          ...
      "_xmlStrQEqual", referenced from:
          -[DDXMLElement attributeForName:] in DDXMLElement.o
      "_xmlStrdup", referenced from:
          -[DDXMLNamespaceNode setName:] in DDXMLNode.o
      "_xmlStringLenDecodeEntities", referenced from:
          _xmpp_xmlStartElement in XMPPParser.o
      "_xmlUnlinkNode", referenced from:
          -[DDXMLNode nodesForXPath:error:] in DDXMLNode.o
      "_xmlXPathEvalExpression", referenced from:
          -[DDXMLNode nodesForXPath:error:] in DDXMLNode.o
      "_xmlXPathFreeContext", referenced from:
          -[DDXMLNode nodesForXPath:error:] in DDXMLNode.o
      "_xmlXPathFreeObject", referenced from:
          -[DDXMLNode nodesForXPath:error:] in DDXMLNode.o
      "_xmlXPathNewContext", referenced from:
          -[DDXMLNode nodesForXPath:error:] in DDXMLNode.o
      "_xmlXPathRegisterNs", referenced from:
          -[DDXMLNode nodesForXPath:error:] in DDXMLNode.o
    ld: symbol(s) not found for architecture i386
    clang: error: linker command failed with exit code 1 (use -v to see invo

cation)

请帮帮我,我已经卡了 4 天多了 :(

【问题讨论】:

    标签: ios objective-c google-drive-api


    【解决方案1】:

    你需要链接libxml2。在 Xcode 中,添加

    OTHER_LDFLAGS = -lxml2
    HEADER_SEARCH_PATHS = /usr/include/libxml2
    

    更多详情here

    【讨论】:

    • 谢谢,这对我很有帮助。我有一个处理 XML 的框架,不需要在链接器标志中专门定义这个库,但是使用该框架的应用程序确实需要它。
    猜你喜欢
    • 2014-04-06
    • 2023-03-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-25
    • 1970-01-01
    相关资源
    最近更新 更多