I'm trying to fit MuPDF into a podspec. That's not going as good as I want it to though...
error: could not build module 'UIKit'
This is the error I get every time I try to pod lib lint
. I get it in two flavours though, depending on the exact contents of the podspec. But before that, some context!
tl;dr: My brain can't process MuPDF and its static library dependencies to make a nice podspec out of it. Can you help?
File layout
So the library is MuPDF (http://mupdf.com); I cloned their git repository. It comes with a bunch of .m
files, but the main library is written in C and has several dependencies. So we end up with a few static libraries (.a
files). The file layout looks something like this:
mupdf/
# objc files
platform/ios/common.{h,m}
platform/ios/Classes/*.{h,m}
# headers and static libraries
include/**/*.h
platform/ios/thirdparty/*.a
The include
folder contains the headers required by the libraries in platform/ios/thirdparty
. These headers are included by platform/ios/common.h
.
Podspec
And my podspec looks something like this:
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
Based on that (and a variation of the podspec), I get two different errors.
Symbol redefinition error
With this exact podspec configuration, I get the following errors:
- 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'
Circular dependency error
If I comment out the s.public_header_files
line, I end up with a circular dependency error. So weird!
- NOTE | /privateTarget Support Files/Pods-mupdf/Pods-mupdf-umbrella.h:1:9:
fatal error: cyclic dependency in module 'UIKit':
UIKit -> Foundation -> CoreFoundation -> MuPDF -> UIKit
Conclusion
My brain hurts, please help!