【问题标题】:Linking xerces static library for Mac OS X为 Mac OS X 链接 xerces 静态库
【发布时间】:2016-05-11 14:19:59
【问题描述】:

我正在尝试将 xerces 链接为静态库,但我遇到了一些问题...

Undefined symbols for architecture x86_64:
  "_CFRelease", referenced from:
      xercesc_3_1::MacOSUnicodeConverter::upperCase(unsigned short*) in libxerces-c.a(MacOSUnicodeConverter.o)
      xercesc_3_1::MacOSUnicodeConverter::lowerCase(unsigned short*) in libxerces-c.a(MacOSUnicodeConverter.o)
  "_CFStringCreateMutableWithExternalCharactersNoCopy", referenced from:
      xercesc_3_1::MacOSUnicodeConverter::upperCase(unsigned short*) in libxerces-c.a(MacOSUnicodeConverter.o)
      xercesc_3_1::MacOSUnicodeConverter::lowerCase(unsigned short*) in libxerces-c.a(MacOSUnicodeConverter.o)
  "_CFStringLowercase", referenced from:
      xercesc_3_1::MacOSUnicodeConverter::lowerCase(unsigned short*) in libxerces-c.a(MacOSUnicodeConverter.o)
  "_CFStringUppercase", referenced from:
      xercesc_3_1::MacOSUnicodeConverter::upperCase(unsigned short*) in libxerces-c.a(MacOSUnicodeConverter.o)
  "_CreateTextEncoding", referenced from:
      xercesc_3_1::MacOSUnicodeConverter::discoverLCPEncoding() in libxerces-c.a(MacOSUnicodeConverter.o)
      xercesc_3_1::MacOSUnicodeConverter::makeNewXMLTranscoder(unsigned short const*, xercesc_3_1::XMLTransService::Codes&, unsigned long, unsigned int, xercesc_3_1::MemoryManager*) in libxerces-c.a(MacOSUnicodeConverter.o)
   ...

我尝试使用不同的选项运行 configure,但所有尝试都无济于事。

有人遇到过同样的问题吗?

【问题讨论】:

  • 可能是由这个引起的:xerces.apache.org/xerces-c/build-3.html 如果您将应用程序链接到静态 Xerces-C++ 库,那么您将需要使用按顺序定义的 XERCES_STATIC_LIBRARY 预处理器宏编译您的应用程序关闭 DLL 导入/导出机制。

标签: macos static-libraries osx-elcapitan xerces-c


【解决方案1】:

我在构建 xalan 时遇到了这个问题。我通过将-framework CoreServices -framework CoreFoundation -lcurl 传递给链接器来修复它。

xalanMakefile.incl的第76行:

XERCES_LIB = -L$(XERCESCROOT)/lib -lxerces-c -framework CoreServices -framework CoreFoundation -lcurl

【讨论】:

  • 谢谢。这为我节省了很多故障排除。对我来说,添加-framework CoreServices -lcurl 就足够了。您是如何发现这是问题所在? clang's website 的文档对 -framework 的作用不是很清楚。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-03-27
  • 2014-02-03
  • 2014-01-05
  • 2013-01-17
相关资源
最近更新 更多