Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code-sign breaks on macOS with python 3.11 #1861

Closed
Willy-JL opened this issue Apr 3, 2023 · 4 comments · Fixed by #2107
Closed

Code-sign breaks on macOS with python 3.11 #1861

Willy-JL opened this issue Apr 3, 2023 · 4 comments · Fixed by #2107

Comments

@Willy-JL
Copy link

Willy-JL commented Apr 3, 2023

Describe the bug
Code-signing breaks apps bundled with cx_Freeze for macOS on python 3.11.x. The build process goes smoothly, same for the code-sign, but then at runtime macOS complains about signatures:

dyld[85476]: Library not loaded: @executable_path/lib/Python


  Referenced from: <6D889B96-A78E-3AB4-A084-5077D2A0B1B1> /Applications/F95Checker.app/Contents/MacOS/F95Checker


  Reason: tried: '/Applications/F95Checker.app/Contents/MacOS/lib/Python' (code signature invalid in <24670B23-D78A-3EAA-BCA8-22FAF877F190> '/Applications/F95Checker.app/Contents/MacOS/lib/Python' (errno=1) sliceOffset=0x00004000, codeBlobOffset=0x006BFF40, codeBlobSize=0x0001AA20), '/System/Volumes/Preboot/Cryptexes/OS@executable_path/lib/Python' (no such file), '/Applications/F95Checker.app/Contents/MacOS/lib/Python' (code signature invalid in <24670B23-D78A-3EAA-BCA8-22FAF877F190> '/Applications/F95Checker.app/Contents/MacOS/lib/Python' (errno=1) sliceOffset=0x00004000, codeBlobOffset=0x006BFF40, codeBlobSize=0x0001AA20), '/usr/local/lib/Python' (no such file), '/usr/lib/Python' (no such file, not in dyld cache)

Users have reported this issue ever since python 3.11.0 came out and I updated my app to it. For the time being I had downgraded to python 3.10 for macOS in hopes that cx_Freeze 6.14's official support for python 3.11 would fix it. I only got around now to making a new release of my app, and users still report this issue with cx_Freeze 6.14.7 and python 3.11.2.

To Reproduce
I don't have access to a macOS machine so I can't test to get a minimal working example of the issue, however (judging from the error message) I would argue that it most likely boils down to:

  • Use python 3.11.x on macOS
  • Install any recent version of cx_Freeze from source (can confirm 6.14.x and 6.13.x are affected, up to 6.14.7)
  • Bundle app with cx_Freeze
  • Code-sign the resulting .app folder
  • Attempt to run the app

Repeating the same steps on python 3.10.x instead works flawlessly

Expected behavior
App code-signs properly and can be run without issues.

Desktop (please complete the following information):

  • Platform information: macOS 11.7.4
  • OS architecture: amd64
  • cx_Freeze version: 6.14.x
  • Python version: 3.11.x
@marcelotduarte
Copy link
Owner

Release 6.15.3 is out!

Can you test it and give me feedback?

@marcelotduarte
Copy link
Owner

A recent PR #2025 maybe fixes this. Can you test?

You can test the patch in the latest development build:
pip install --upgrade --pre --extra-index-url https://marcelotduarte.github.io/packages/ cx_Freeze
For conda-forge the command is:
conda install -y --no-channel-priority -S -c https://marcelotduarte.github.io/packages/conda cx_Freeze

@marcelotduarte
Copy link
Owner

To document, I found that before the runtime error, there are multiple warnings:
install_name_tool: warning: changes being made to the file will invalidate the code signature in: [filename]

@marcelotduarte
Copy link
Owner

Release 6.15.10 is out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants