I am having trouble making an app run on MacOS. The app builds on py2app, I am using the configurations below to set up the app but has the same result as not using the export lines. I'm trying to do this on Mac M1 2020.
export LDFLAGS="-L/opt/homebrew/opt/libffi/lib"
export CPPFLAGS="-I/opt/homebrew/opt/libffi/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/libffi/lib/pkgconfig"
python setup.py py2app
when I try to run it from the terminal I get the following error:
(base) raphaelpbp@Raphaels-MacBook-Pro PP % dist/test_generator.app/Contents/MacOS/test_generator
Traceback (most recent call last):
File "/Users/raphaelpbp/Desktop/PP/dist/test_generator.app/Contents/Resources/__boot__.py", line 30, in <module>
import ctypes
File "<frozen zipimport>", line 259, in load_module
File "ctypes/__init__.pyc", line 8, in <module>
ImportError: dlopen(/Users/raphaelpbp/Desktop/PP/dist/test_generator.app/Contents/Resources/lib/python3.9/lib-dynload/_ctypes.so, 0x0002): Library not loaded: @rpath/libffi.8.dylib
Referenced from: <B2C5DE79-B6F7-3093-8CB0-401F78887E99> /Users/raphaelpbp/Desktop/PP/dist/test_generator.app/Contents/Resources/lib/python3.9/lib-dynload/_ctypes.so
Reason: tried: '/Users/raphaelpbp/Desktop/PP/dist/test_generator.app/Contents/Resources/lib/python3.9/lib-dynload/../../libffi.8.dylib' (no such file), '/Users/raphaelpbp/Desktop/PP/dist/test_generator.app/Contents/Resources/lib/python3.9/lib-dynload/../../libffi.8.dylib' (no such file), '/Users/raphaelpbp/Desktop/PP/dist/test_generator.app/Contents/Frameworks/libffi.8.dylib' (no such file), '/usr/local/lib/libffi.8.dylib' (no such file), '/usr/lib/libffi.8.dylib' (no such file, not in dyld cache)
2023-12-13 18:50:35.455 test_generator[4584:36103] Launch error
2023-12-13 18:50:35.455 test_generator[4584:36103] Launch error
See the py2app website for debugging launch issues
Please help me find a solution, I've tried many things in the last 3 weeks.
I've tried reinstalling libffi, putting the file manually in the folders, entered recovery mode to try accessing the files through
Built the app asking to find the libffi package in the setup.py file (was dumb) I've uninstalled conda and reinstalled it. I ran out of solutions, tried pretty much everything on the web.