我正在尝试将 MuPDF 放入 podspec 中。虽然这并不像我想要的那么好......
error: could not build module 'UIKit'
这是我每次尝试时都会遇到的错误pod lib lint
。不过,我有两种口味,具体取决于 podspec 的确切内容。但在此之前,一些背景!
tl;dr:我的大脑无法处理 MuPDF 及其静态库依赖项来制作一个不错的 podspec。你能帮我吗?
文件布局
所以图书馆是MuPDF(http://mupdf.com);我克隆了他们的 git 存储库。它带有一堆.m
文件,但主库是用 C 编写的,并且有几个依赖项。所以我们最终得到了一些静态库(.a
文件)。文件布局如下所示:
mupdf/
# objc files
platform/ios/common.{h,m}
platform/ios/Classes/*.{h,m}
# headers and static libraries
include/**/*.h
platform/ios/thirdparty/*.a
该include
文件夹包含platform/ios/thirdparty
. 这些标头包含在platform/ios/common.h
.
播客规范
我的 podspec 看起来像这样:
Pod::Spec.new do |s|
# <enter usual podspec yada yada here>
s.source_files = "platform/ios/Classes/**/*.{h,m}", "platform/ios/common.{h,m}", "include/**/*.h"
s.public_header_files = "platform/ios/Classes/**/*.h"
s.header_mappings_dir = "include"
s.libraries = "z"
s.vendored_libraries = "platform/ios/thirdparty/*"
end
基于此(以及 podspec 的变体),我得到两个不同的错误。
符号重定义错误
使用这个确切的 podspec 配置,我得到以下错误:
- ERROR | /<path>/mupdf/include/mupdf/fitz/math.h:97:8:
error: redefinition of 'fz_point_s'
- NOTE | /<path>/mupdf/include/mupdf/fitz/math.h:97:8:
note: previous definition is here
- ERROR | /<path>/mupdf/include/mupdf/fitz/math.h:121:8:
error: redefinition of 'fz_rect_s'
- NOTE | /<path>/mupdf/include/mupdf/fitz/math.h:121:8:
note: previous definition is here
# etc. etc.
- NOTE | Target Support Files/Pods-mupdf/Pods-mupdf-prefix.pch:2:9:
fatal error: could not build module 'UIKit'
循环依赖错误
如果我注释掉该s.public_header_files
行,我最终会出现循环依赖错误。太奇怪了!
- NOTE | /privateTarget Support Files/Pods-mupdf/Pods-mupdf-umbrella.h:1:9:
fatal error: cyclic dependency in module 'UIKit':
UIKit -> Foundation -> CoreFoundation -> MuPDF -> UIKit
结论
脑袋疼,求救!