Py2App无法在liblzma.5.dylib上进行MacOS签名

问题描述 投票:0回答:1

我一直在将项目从Python2.7升级到Python3.8,同时处理MacOS Mojave和Catalina上的部署/签名问题。

Python应用程序是使用Py2app构建的,然后进行了签名,但是在签名时恰好有一个文件失败:

codesign --sign "${IDENTITY}"  --entitlements ../entitleme.plist  --deep "demo.app/"          --force    --options runtime
demo.app/: main executable failed strict validation
In subcomponent: /demo.app/Contents/Frameworks/liblzma.5.dylib

并且没有严格的要求:

codesign --sign "${IDENTITY}" --entitlements ../entitleme.plist  --deep "demo.app/" --no-strict --force  --options runtime
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate: the __LINKEDIT segment does not cover the end of the file (can't be processed) in: demo.app/Contents/Frameworks/liblzma.5.dylib
demo.app/: the codesign_allocate helper tool cannot be found or used
In subcomponent: demo.app/Contents/Frameworks/liblzma.5.dylib

[另一个问题here表示PyInstaller或其他系统有类似问题,并且此incomplete solution已修复。但是,实际的解决方案(如果找到)在链接材料的编辑或更改中显得难以理解。另外,我注意到codesign_allocate被列为未找到,但是它在路径中并且可以正常运行,因此我怀疑在__LINKEDIT段错误的文件上使用它是不好的。

看来liblzma来自py2app构建期间库合并的压缩算法,到目前为止,尝试进行更新的尝试是徒劳的-尽管我开始怀疑在最新的MacOS上重新编译源资料是否可以纠正这些错误。

是否有解决此问题的已知方法?

python macos code-signing py2app
1个回答
0
投票
  1. 您需要将exe移至Electron Framework。像这样

    ** Mac os

    MyApp <>

    资源

    [MyAppService <

    完成此操作后,由于Electron框架中的所有代码,您的Electron Application可以被公证成功。而且应用程序大小比以前小30%。

  2. main.js将是这样

if (Arguments.isServiceStarting()) {//TRUE if `MyAppService` running
    process.env.ELECTRON_RUN_AS_NODE = 'true'; //turn off Graphics API, so it can run 
as daemon process even in "RunAtLoad"
    require('./service').Service.start();
}
else {
    app.on('ready', () => {
        require('./client').Client.start();
    });
}
  1. 如果您遇到此问题。 “找不到或使用codesign_allocate帮助程序工具”您最好参考codesign_allocate: error: unable to find utility "codesign_allocate", not a developer tool or in PATH
© www.soinside.com 2019 - 2024. All rights reserved.