我以前在带有嵌入式JRE的代码签名(沙盒)应用程序中遇到此错误(在this tutorial之后):
Library not loaded: /usr/X11/lib/libfreetype.6.dylib
Referenced from: /Game.app/Contents/PlugIns/jdk1.7.0.jdk/Contents/Home/jre/lib/libfontmanager.dylib
我做的是将这些dylib导入libfontmanager所在的目录:
libfreetype.6.dylib
libpng16.16.dylib
libbz2.1.0.dylib
libSystem.B.dylib
libz.1.dylib
然后在libfontmanager / libfreetype.6.dylib上运行这些命令
install_name_tool -change /usr/X11/lib/libfreetype.6.dylib @rpath/libfreetype.6.dylib libfontmanager.dylib
install_name_tool -change /usr/local/lib/libfreetype.6.dylib @rpath/libfreetype.6.dylib libfreetype.6.dylib
install_name_tool -change /usr/lib/libz.1.dylib @rpath/libz.1.dylib libfreetype.6.dylib
install_name_tool -change /usr/lib/libbz2.1.0.dylib @rpath/libbz2.1.0.dylib libfreetype.6.dylib
install_name_tool -change /usr/local/lib/libpng16.16.dylib @rpath/libpng16.16.dylib libfreetype.6.dylib
install_name_tool -change /usr/lib/libSystem.B.dylib @rpath/libSystem.B.dylib libfreetype.6.dylib
然后我对每个dylib / jar +应用程序进行编码
codesign -v --deep --verbose=4 -f -s "3rd Party Mac Developer Application: Company" --verbose --entitlements Game.entitlements Game.app
find Game.app/Contents/ -type f \( -name "*.jar" -or -name "*.dylib" \) -exec codesign --verbose=4 --deep -f -s "3rd Party Mac Developer Application: Company" --entitlements Game.entitlements {} \;
该应用程序即使在经过编码后也能完美运行!
唯一的问题是包装和安装后
productbuild --component Game.app /Applications -s "3rd Party Mac Developer Installer: Company" Game.pkg
sudo installer -store -pkg Game.pkg -target /
应用程序在打开它时会给我这个错误
lsd[346]: LaunchServices: Could not store lsd-identifiers file at /private/var/db/lsd/com.apple.lsdschemes.plist
kernel[0]: CODE SIGNING: cs_invalid_page(0x118113000): p=658[JavaAppLauncher] final status 0x3000200, denying page sending SIGKILL
kernel[0]: CODE SIGNING: process 658[JavaAppLauncher]: rejecting invalid page at address 0x118113000 from offset 0x15000 in file "/Applications/Game.app/Contents/PlugIns/jdk1.7.0.jdk/Contents/Home/jre/lib/libz.1.dylib" (cs_mtime:1476852998.0 == mtime:1476852998.0) (signed:1 validated:1 tainted:1 wpmapped:0 slid:0)
com.apple.xpc.launchd[1]: (com.company.gameOSX.80672[658]) Binary is improperly signed.
造成这种情况的原因是什么?
编辑:我找到了可以回答我问题的内容。我在提取的应用程序上运行这些命令,它完全正常。sudo codesign -f -s - "/Applications/Game.app/Contents/PlugIns/jdk1.7.0.jdk/Contents/Home/jre/lib/libbz2.1.0.dylib"
sudo codesign -f -s - "/Applications/Game.app/Contents/PlugIns/jdk1.7.0.jdk/Contents/Home/jre/lib/libSystem.B.dylib"
sudo codesign -f -s - "/Applications/Game.app/Contents/PlugIns/jdk1.7.0.jdk/Contents/Home/jre/lib/libz.1.dylib"
导致这些dylib在打包后没有正确编码的原因是什么?如何解决?
答案 0 :(得分:0)
我明白了。由于某种原因,在使用我的签名ID对其进行协调处理时,导致崩溃的dylib文件无法正常工作。一切都很好,直到包装和提取奇怪。
我最终删除了导致崩溃的三个dylib文件,我的应用程序即使在解压缩后也能正常工作!