【问题标题】:crc32() missing when building libzip on OSX 10.9在 OSX 10.9 上构建 libzip 时缺少 crc32()
【发布时间】:2013-12-23 19:36:09
【问题描述】:

我已经下载了最新版本的 libzip,目前正在尝试在 OSX 上构建它,但失败了:

Linking C shared library libzip.dylib
Undefined symbols for architecture x86_64:
  "_crc32", referenced from:
      __zip_filerange_crc in zip_filerange_crc.o
      _crc_read in zip_source_crc.o
      _decrypt in zip_source_pkware.o
      __zip_string_crc32 in zip_string.o
     (maybe you meant: __zip_string_crc32)
  "_deflate", referenced from:
      _compress_read in zip_source_deflate.o
     (maybe you meant: _zip_source_deflate)
  "_deflateEnd", referenced from:
      _deflate_compress in zip_source_deflate.o
  "_deflateInit2_", referenced from:
      _deflate_compress in zip_source_deflate.o
  "_inflate", referenced from:
      _decompress_read in zip_source_deflate.o
  "_inflateEnd", referenced from:
      _deflate_decompress in zip_source_deflate.o
  "_inflateInit2_", referenced from:
      _deflate_decompress in zip_source_deflate.o
  "_zError", referenced from:
      __zip_error_strerror in zip_error_strerror.o
      _zip_error_to_str in zip_error_to_str.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [libzip.3.0.dylib] Error 1
make[2]: *** [CMakeFiles/zip.dir/all] Error 2
make[1]: *** [CMakeFiles/zip.dir/rule] Error 2
make: *** [zip] Error 2

它需要一个 crc32 函数,但它不包含一个,也似乎没有链接到其他任何东西。有没有人能够在 OSX 10.9 上构建 libzip?

【问题讨论】:

  • 使用 macports、homebrew 或 fink 等打包系统来构建 portes 将解决依赖关系的库可能更容易
  • 请按照链接器的建议进行操作:use -v to see invocation 然后在此处显示后者。
  • @Mark - 我正在链接到它。

标签: c osx-mavericks linker-errors undefined-reference libz


【解决方案1】:

您似乎缺少将 a 链接到 libz

在某处获取 zlib 的开发人员文件并将-lz 添加到链接命令(命令行的末尾)。

【讨论】:

  • libz 已经在 /usr/lib/libz.dylib 中,所以 -lz 应该足够了
  • @user15101:确保在调用编译器/链接器时将其添加到命令行末尾。
猜你喜欢
  • 2014-02-26
  • 2012-07-02
  • 2013-11-03
  • 2014-05-10
  • 1970-01-01
  • 2012-02-05
  • 1970-01-01
  • 1970-01-01
  • 2014-08-23
相关资源
最近更新 更多