我在签署基于 Qt 的应用程序 un OS X 时遇到问题。我正在使用 Qt 5.3.2.
我已经阅读了包含矛盾信息的各种信息来源。
以下是运行bin/macdeployqt
Qt 实用程序后应用程序包的内容
SimpleHello.app/
Contents/
Info.plist
PkgInfo
Frameworks/
QtCore.framework/
Resources/
Versions/
5/
QtCore
QtGui.framework/ ... same as Qt core
QtPrintSupport.framework/ ... same as Qt core
QtWidgets.framework/ ... same as Qt core
MacOS/
SimpleHello
PlugIns/ ... some plugins
Resources/
empty.lproj
qt.conf
第一:
我试过了:http://successfulsoftware.net/2012/08/30/how-to-sign-your-mac-os-x-app-for-gatekeeper/
但是,它似乎在 OS X 10.10 Yosemite 中无效
第二:
我试过了:签署 OSX 框架 10.9
我能够在没有任何错误的情况下签署整个应用程序。但是,当运行spctl
来验证应用程序的有效性时,我得到了
spctl -a -vvvv SimpleHello.app
SimpleHello.app/: rejected
source=obsolete resource envelope
origin=Developer ID Application: MY CERTIFICATE
另外,在使用 codesign 验证签名时,我得到:
codesign --verify --deep --verbose=4 SimpleHello.app
--prepared:/My/Path/SimpleHello.app/Contents/Frameworks/QtCore.framework
--validated:/My/Path/SimpleHello.app/Contents/Frameworks/QtCore.framework
SimpleHello.app/: embedded framework contains modified or invalid version
In subcomponent: /My/Path/SimpleHello.app/Contents/Frameworks/QtCore.framework
第三:
在代码签名验证中添加--no-strict
选项根据:导出存档时出错
它修复了代码签名验证的问题,但没有解决spctl
问题。
向前:
我在签署框架时尝试添加--no-legacy-signing
选项。但是,在验证捆绑签名时(包括codesign
和spctl
)我收到此错误
codesign --verify --deep --verbose=4 SimpleHello.app
SimpleHello.app/: code has no resources but signature indicates they must be present
第五:
根据以下内容修改框架结构:http://qt-project.org/forums/viewthread/47768和https://gist.github.com/kingcheez/6154462d7734e0c0f3a4
在这种情况下,我在尝试签署框架时遇到此错误
SimpleHello.app/Contents/Frameworks/QtCore.framework: unsealed contents present in the root directory of an embedded framework
SimpleHello.app/Contents/Frameworks/QtGui.framework: unsealed contents present in the root directory of an embedded framework
SimpleHello.app/Contents/Frameworks/QtPrintSupport.framework: unsealed contents present in the root directory of an embedded framework
SimpleHello.app/Contents/Frameworks/QtWidgets.framework: unsealed contents present in the root directory of an embedded framework
编辑:似乎unsealed contents present in the root directory of an embedded framework
的问题是因为其中一个 simlink 格式不正确。它是:
QtCore.framework.framework/Versions/Current -> 5/
代替
QtCore.framework.framework/Versions/Current -> 5
在这个修复之后,我仍然得到与第六相同的结果。
第六:
在为框架调用codesign
时添加了--no-strict
选项。我能够签署所有框架,除了一个
SimpleHello.app//Contents/Frameworks/QtCore.framework: signed bundle with Mach-O thin (x86_64) [.]
SimpleHello.app//Contents/Frameworks/QtGui.framework: signed bundle with Mach-O thin (x86_64) [.]
SimpleHello.app//Contents/Frameworks/QtPrintSupport.framework: code object is not signed at all
In subcomponent: /My/Path/SimpleHello.app/Contents/Frameworks/QtPrintSupport.framework/Versions/Current/QtPrintSupport
SimpleHello.app//Contents/Frameworks/QtWidgets.framework: signed bundle with Mach-O thin (x86_64) [.]
第七:
我发布了这个问题,因为我不知道该找什么
2 回答
在进一步挖掘之后,我弄清楚第七节中的问题是什么:一些 Qt 框架在 Info.plist 文件中包含错误信息(框架名称以_debug 结尾)
我推出了这个修复所有问题的脚本(还有一些硬编码的值可能会通过对脚本的一些改进来处理)
至于调用脚本:
使用此脚本,最终输出为:
我运行 macdeployqt 后运行类似于此的脚本:
之后,我使用:
它工作正常,只需以类似的方式添加缺少的框架。我没有用 qt 5 尝试过,但它可能适用于它。