Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apple Mach-O Linker Error - Objective C

I got this error while compiling my existing project on XCode. I try to use the quickstart from Google Drive (Step 3) https://developers.google.com/drive/ios/quickstart and after completed all of the 8 steps, I got 4 errors of Apple Mach-O linker error. Then I undid all of the steps, but even worse.

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)

Please help me, I've been stuck for more than 4 days :(

like image 341
noobprogrammer Avatar asked May 25 '14 14:05

noobprogrammer


1 Answers

You need to link libxml2. In Xcode, add

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

Xcode configuration

More details here

like image 163
toasted_flakes Avatar answered Nov 07 '22 08:11

toasted_flakes