iPhone libxml2 未定义符号(带有 gdata、kissxml、touchxml 等)

Posted

技术标签:

【中文标题】iPhone libxml2 未定义符号(带有 gdata、kissxml、touchxml 等)【英文标题】:iPhone libxml2 undefined symbols (with gdata, kissxml, touchxml, etc.) 【发布时间】:2011-12-23 09:47:01 【问题描述】:

我正在尝试使用任何一个基于 libxml 的第 3 方 XML 解析器,但我不能,因为我认为我遇到了某种 libxml2 问题

我将其他链接器标志设置为 -lxml2

和标题搜索路径 /usr/include/libxml2

但是当我尝试编译时,我仍然得到大量未定义的符号。以下错误是尝试编译 TouchXML 的结果。

Undefined symbols:
  "_xmlDocDumpFormatMemory", referenced from:
      -[CXMLDocument description] in CXMLDocument.o
  "_xmlXPathNewContext", referenced from:
      -[CXMLNode nodesForXPath:error:] in CXMLNode.o
      -[CXMLNode(CXMLNode_NamespaceExtensions) nodesForXPath:namespaceMappings:error:] in CXMLNode_XPathExtensions.o
  "_xmlOutputBufferFlush", referenced from:
      -[CXMLNode XMLStringWithOptions:] in CXMLNode.o
  "_xmlNodeListGetString", referenced from:
      -[CXMLNode stringValue] in CXMLNode.o
  "_xmlFree", referenced from:
      _xmlFree$non_lazy_ptr in CXMLDocument.o
      _xmlFree$non_lazy_ptr in CXMLNode.o
     (maybe you meant: _xmlFree$non_lazy_ptr)
  "_xmlXPathFreeContext", referenced from:
      -[CXMLNode nodesForXPath:error:] in CXMLNode.o
      -[CXMLNode(CXMLNode_NamespaceExtensions) nodesForXPath:namespaceMappings:error:] in CXMLNode_XPathExtensions.o
  "_xmlNodeDumpOutput", referenced from:
      -[CXMLNode XMLStringWithOptions:] in CXMLNode.o
  "_xmlAddChild", referenced from:
      -[CXMLDocument(CXMLDocument_CreationExtensions) addChild:] in CXMLDocument_CreationExtensions.o
      -[CXMLElement(CXMLElement_CreationExtensions) addChild:] in CXMLElement_CreationExtensions.o
      -[CXMLElement(CXMLElement_CreationExtensions) setStringValue:] in CXMLElement_CreationExtensions.o
  "_xmlDocSetRootElement", referenced from:
      +[CXMLNode(CXMLNode_CreationExtensions) documentWithRootElement:] in CXMLNode_CreationExtensions.o
  "_xmlFreeNode", referenced from:
      -[CXMLNode dealloc] in CXMLNode.o
  "_xmlXPathEvalExpression", referenced from:
      -[CXMLNode nodesForXPath:error:] in CXMLNode.o
      -[CXMLNode(CXMLNode_NamespaceExtensions) nodesForXPath:namespaceMappings:error:] in CXMLNode_XPathExtensions.o
  "_xmlStrcmp", referenced from:
      -[CXMLElement elementsForName:] in CXMLElement.o
      -[CXMLElement attributeForName:] in CXMLElement.o
  "_xmlParseDoc", referenced from:
      -[CXMLDocument initWithXMLString:options:error:] in CXMLDocument.o
  "_xmlCopyNode", referenced from:
      -[CXMLNode copyWithZone:] in CXMLNode.o
  "_xmlOutputBufferClose", referenced from:
      -[CXMLNode XMLStringWithOptions:] in CXMLNode.o
  "_xmlAddPrevSibling", referenced from:
      -[CXMLDocument(CXMLDocument_CreationExtensions) insertChild:atIndex:] in CXMLDocument_CreationExtensions.o
  "_xmlDocDumpMemory", referenced from:
      -[CXMLDocument XMLDataWithOptions:] in CXMLDocument.o
  "_xmlNewDoc", referenced from:
      +[CXMLNode(CXMLNode_CreationExtensions) document] in CXMLNode_CreationExtensions.o
      +[CXMLNode(CXMLNode_CreationExtensions) documentWithRootElement:] in CXMLNode_CreationExtensions.o
  "_xmlNewText", referenced from:
      -[CXMLElement(CXMLElement_CreationExtensions) setStringValue:] in CXMLElement_CreationExtensions.o
  "_xmlXPathFreeObject", referenced from:
      -[CXMLNode nodesForXPath:error:] in CXMLNode.o
      -[CXMLNode(CXMLNode_NamespaceExtensions) nodesForXPath:namespaceMappings:error:] in CXMLNode_XPathExtensions.o
  "_xmlGetLastError", referenced from:
      -[CXMLDocument initWithXMLString:options:error:] in CXMLDocument.o
  "_xmlNewPI", referenced from:
      +[CXMLNode(CXMLNode_CreationExtensions) processingInstructionWithName:stringValue:] in CXMLNode_CreationExtensions.o
  "_xmlSetNs", referenced from:
      -[CXMLElement(CXMLElement_CreationExtensions) addNamespace:] in CXMLElement_CreationExtensions.o
  "_xmlReadMemory", referenced from:
      -[CXMLDocument initWithData:encoding:options:error:] in CXMLDocument.o
  "_xmlNewNs", referenced from:
      +[CXMLNode(CXMLNode_CreationExtensions) elementWithName:URI:] in CXMLNode_CreationExtensions.o
      +[CXMLNode(CXMLNode_CreationExtensions) namespaceWithName:stringValue:] in CXMLNode_CreationExtensions.o
  "_xmlResetLastError", referenced from:
      -[CXMLDocument initWithXMLString:options:error:] in CXMLDocument.o
  "_xmlOutputBufferCreateIO", referenced from:
      -[CXMLNode XMLStringWithOptions:] in CXMLNode.o
  "_xmlNewNode", referenced from:
      +[CXMLNode(CXMLNode_CreationExtensions) elementWithName:] in CXMLNode_CreationExtensions.o
      +[CXMLNode(CXMLNode_CreationExtensions) elementWithName:URI:] in CXMLNode_CreationExtensions.o
      +[CXMLNode(CXMLNode_CreationExtensions) elementWithName:stringValue:] in CXMLNode_CreationExtensions.o
  "_xmlDocGetRootElement", referenced from:
      -[CXMLDocument rootElement] in CXMLDocument.o
  "_xmlXPathRegisterNs", referenced from:
      -[CXMLNode(CXMLNode_NamespaceExtensions) nodesForXPath:namespaceMappings:error:] in CXMLNode_XPathExtensions.o
  "_xmlFreeDoc", referenced from:
      -[CXMLDocument dealloc] in CXMLDocument.o
ld: symbol(s) not found

【问题讨论】:

【参考方案1】:

我遇到了同样的问题。当我将二进制文件与库链接时,它就消失了。

转到目标 -> 构建阶段 -> 将二进制文件与库链接,单击加号并添加“libxml2.dylib”

【讨论】:

我已经删除了 pod,然后手动拖动框架错误,这导致了这个错误,但您的解决方案非常完美。谢谢 2019,仍然是完美的答案,拯救我的一天:)

以上是关于iPhone libxml2 未定义符号(带有 gdata、kissxml、touchxml 等)的主要内容,如果未能解决你的问题,请参考以下文章

未定义符号:glib 中的 g_task_set_name

使用 g++ 时 HDF5 的未定义符号

带有 emscripten docker 图像的未定义导出符号

带有 Python OpenCV 的 ImportError(未定义符号)

使用 jni 和 OpenCV 创建的带有 lib 的未定义符号

体系结构 i386 iOS 的未定义符号