Sunday, 3 September 2023

How to code sign "libffi.8.dylib" on MacOS?

I have created a python application that I build into a Unix executable using Pyinstaller. The application runs fine until I attempt to code sign it. After code signing, I get the following error when attempting to run the executable:

rosetta error: /var/db/oah/526469a4f4887ee6ca553807c3196c9533da7ef706c684764b83169e8658f8e2/ba3f613b849de777b4a89fdb1760c3c2343ac52546e2629e28f83fbf530a8f27/libffi.8.dylib.aot: unable to mmap __TEXT: 1

Is it possible to code sign dylib files such as this?

Steps to reproduce the error:

  1. Create conda environment with python v3.9
  2. Activate environment and conda install numpy and pyinstaller
  3. Create python script that imports numpy. Doesn't matter what the python script does, can just be one line as long as it imports numpy.
  4. Use pyinstaller to build a distribution for the python file, with code signing like so:
pyinstaller -y --clean --codesign-identity='<apple-id>' --osx-entitlements-file='<path-to-entitlements.plist-file>' <name-of-python-script>
  1. Run the Unix executable that is produced inside the dist folder.


from How to code sign "libffi.8.dylib" on MacOS?

No comments:

Post a Comment