- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我正在尝试将 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
中的库所需的 header 。这些 header 包含在 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
脑袋疼,求助!
最佳答案
抱歉,我不太确定您的 PodSpec 发生了什么。这可能与您如何解决 math.h 头文件冲突有关 - 在 pod 规范中正确解决这个问题非常棘手。
我刚刚创建了一个 CocoaPod for MuPDF ,并创建了一个 example application based on that pod ,一切似乎都正常。
此处供引用的是我的 pod 规范(请注意,它现在已过时;请参阅 published mupdf pod spec 以获得与最新版本的 mupdf 和最新 CocoaPods 兼容的规范):
# podspec for MuPDF
#
# Copyright (C) 2015 Joseph Heenan <joseph@heenan.me.uk>
Pod::Spec.new do |s|
s.name = "MuPDF"
s.version = "1.7"
s.summary = "A lightweight PDF and XPS viewer."
s.description = <<-DESC
MuPDF is a small, fast, and yet complete PDF viewer.
It supports PDF 1.7 with transparency, encryption,
hyperlinks, annotations, searching and more. It also
reads XPS and OpenXPS documents.
DESC
s.homepage = "http://www.mupdf.com/"
s.license = { :type => "Affero GNU GPL v3", :file => 'COPYING' }
s.author = "Artifex Software Inc"
s.source = { :git => "https://github.com/ArtifexSoftware/mupdf.git", :tag => s.version.to_s }
s.platform = :ios, '6.1'
s.requires_arc = false
s.source_files = 'platform/ios/Classes/**/*.[mh]', 'platform/ios/common.[mh]'
s.resources = 'platform/ios/*.png', 'platform/android/res/drawable-ldpi/*.png'
s.public_header_files = "platform/ios/Classes/**/*.h", "platform/ios/common.h"
# See https://github.com/CocoaPods/CocoaPods/issues/1437
s.preserve_paths = "include/*", "include/**/*"
s.prepare_command = <<-CMD
# I tried --depth 1 here but it failed with git error "fatal: reference is not a tree:"
git submodule update --init
cd platform/ios
# build the various .a files
# release armv7 + arm64
xcodebuild -scheme MuPDF -configuration Release CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
# release i386 + x86_64
xcodebuild -scheme MuPDF -configuration Release -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
# combine into fat libraries
cd ../../build/
for i in curl freetype jbig2dec jpeg mujs mupdf openjpeg z; do
LIB=lib${i}.a
lipo -create -output $LIB release-ios-i386-x86_64/$LIB release-ios-armv7-arm64/$LIB
done
CMD
s.vendored_libraries = "build/*.a"
s.xcconfig = {
# we have a math.h which conflicts with the system math.h unless
# we disable header maps
'USE_HEADERMAP' => 'NO',
'HEADER_SEARCH_PATHS' => '"$(PODS_ROOT)/Target Support Files/Pods"',
'USER_HEADER_SEARCH_PATHS' => '"${PODS_ROOT}/MuPDF/include"',
'ALWAYS_SEARCH_USER_PATHS' => 'NO'
}
end
关于ios - Cocoapod "error: could not build module ' UIKit'",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30637231/
Xcode 4 中的以下操作有什么作用? 为测试而构建 为运行而构建 为分析而构建 为存档而构建 我不确定何时使用这些(或是否使用其中任何一个)。 最佳答案 Running 用于运行您的应用(在 Ma
工具: Jenkins 版1.470 Maven 2 颠覆 环境 假设我的构建有许多项目 A-D。如图所示,依赖关系图存在。也就是说:B 依赖于 A 中的类,C 依赖于 B 中的类,D 依赖于 A 中
我正在创建一个软件项目,我想使用 autotools 为我生成 makefile 等脚本,我手动创建了 Makefile.am 和 configure.in 文件,我正在使用 autogen.sh 脚
什么yarn build命令做什么? 是 yarn build和 npm build相同?如果不是有什么区别? 最佳答案 yarn build和 npm build默认情况下不是现有的命令。我想你是说
如果我有一个包含许多相互依赖的项目的大型代码库,例如,projects/A、projects/B 和 projects/C ,其中 A 需要 B,B 需要 C,每个项目都有一个Cake 构建脚本,例如
我正在尝试使用 Wix/Detox 来测试我的 react-native 应用程序(iOS 版本)。我已成功遵循 https://github.com/wix/detox/blob/master/do
我们有许多编译 .NET 代码的 Nant 脚本。这些构建需要 5 到 10 分钟才能运行,我想找到一种方法来加速它们。 我们的 Nant 脚本看起来像
你好 当我在 windows 下使用 gnu 构建 ffmpeg-3.4.1 时,谁能帮我解决这个错误: /tmp/9747a756ee05ef34cc3fcf51eabde826/sysroot/u
构建解决方案/项目/程序意味着什么?我想确保我的定义是正确的(所以我在交谈时听起来不像个白痴)。在 IDE 中,您可以(如果我错了,请纠正我)编译源代码/编程代码为计算机可读的机器代码。您可以调试程序
为什么 Eclipse 在构建 Android 项目时会陷入无限循环,用于构建工作区...和(重新)构建工作区...和(重新)构建工作区... 这是一个已知的错误吗? 摆脱这个循环的正确方法是什么?
我的 Angular 项目是 @Angular4.3.3 ng build -prod 构建需要 77 秒 ng build --prod --build-optimizer=true 构建需要 19
所以我刚刚使用命令创建了一个 React Native 项目 react-native init "项目名称" 我进入应用程序级别的 build.gradle 以连接 firebase,但出现错误提示
我想弄清楚 TFS Online 2017 中的两个预定义变量之间是否存在差异:$(Build.Repository.LocalPath)和 $(Build.SourcesDirectory) .我有
编译项目时,当系统用户名匹配时,此脚本应将 Xcode 项目的构建版本递增 1。请记住,这些只是 Target->Build Phases->Run Script in Xcode 中脚本(不是 Ap
是否有一种工具可以在给定 MS Build 项目文件的情况下构建一个视觉对象,显示将在何时以及从哪个导入文件执行哪个目标? 如果给定一个解决方案文件,它会构建项目构建顺序的视觉效果? 最佳答案 是的,
我正在尝试使用 Bazel 进行以下设置。通过调用“bazel build”,Python 脚本应该生成未知数量的具有随机名称的 *.cc 文件,然后将这些文件编译成单个静态库(.a 文件),所有这些
我正在将我的 Cmake 项目迁移到 Bazel。我项目的根目录是 build我用来运行 Cmake 的文件夹。 迁移到 Bazel ,我需要创建一个 BUILD我的项目根目录下的文件。但是,在 ma
关闭。这个问题是opinion-based 。目前不接受答案。 想要改进这个问题吗?更新问题,以便 editing this post 可以用事实和引文来回答它。 . 已关闭 5 年前。 此帖子已于
当我的Dockerfile如下所示时,它运行良好。 ... RUN pip install git+https://user_name:my_password@github.com/repo_name
当前的自动构建功能集是否可以从存储库中添加新标签并标记生成的图像?还是我需要3party服务将新标签自动推送到Docker Registry? 最佳答案 目前不行。 当前(2014年10月)尚无Doc
我是一名优秀的程序员,十分优秀!