ronaldoussoren / py2app

py2app is a Python setuptools command which will allow you to make standalone Mac OS X application bundles and plugins from Python scripts.
Other
340 stars 36 forks source link

Error loading Carbon library in Sonoma #511

Open ccesarcaball opened 10 months ago

ccesarcaball commented 10 months ago

Im using MacOS Sonoma 14.0, I'm able to build the app, but I can't run it, this is the error:

Traceback (most recent call last):
  File "/Users/cccaballero/Projects/services-manager/dist/services_manager.app/Contents/Resources/__boot__.py", line 321, in <module>
    _argv_emulation()
  File "/Users/cccaballero/Projects/services-manager/dist/services_manager.app/Contents/Resources/__boot__.py", line 318, in _argv_emulation
    _run_argvemulator()
  File "/Users/cccaballero/Projects/services-manager/dist/services_manager.app/Contents/Resources/__boot__.py", line 127, in _run_argvemulator
    carbon = _ctypes_setup()
  File "/Users/cccaballero/Projects/services-manager/dist/services_manager.app/Contents/Resources/__boot__.py", line 51, in _ctypes_setup
    carbon = ctypes.CDLL("/System/Library/Carbon.framework/Carbon")
  File "ctypes/__init__.pyc", line 366, in __init__
OSError: dlopen(/System/Library/Carbon.framework/Carbon, 0x0006): tried: '/System/Library/Carbon.framework/Carbon' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/System/Library/Carbon.framework/Carbon' (no such file), '/System/Library/Carbon.framework/Carbon' (no such file, not in dyld cache)
culler commented 10 months ago

This is an Apple bug. They are shipping their Carbon.framework with a broken symlink:

$ file /System/Library/Frameworks/Carbon.framework/Carbon /System/Library/Frameworks/Carbon.framework/Carbon: broken symbolic link to Versions/Current/Carbon

However, this is not new with Sonoma. It was also a broken link in Ventura.

ccesarcaball commented 10 months ago

I don't know why it doesn't surprise me... any workaround?

yesyves commented 7 months ago

I have the same problem in Frescobaldi but I'm not sure the problem is an "Apple bug" first because the dlerror comes from looking in the wrong directory : OSError: dlopen(/System/Library/Carbon.framework/Carbon, 0x0006) While it should be looking in /System/Library/Frameworks/Carbon.framework/Carbon

But also since Carbon framework is deprecated since 10.8 (2012) and has no 64-bits support while macOS supports only 64-bit since 10.15 Catalina.

yesyves commented 7 months ago

any workaround? You can launch the python application from Terminal directly without using the .app wrapper

culler commented 7 months ago

While it should be looking in /System/Library/Frameworks/Carbon.framework/Carbon

There is no such directory. Instead that is the pathname of a broken symlink, and that broken symlink was put there by Apple. The expectation is that Carbon would be a dynamic library that could be opened by dlopen, not a directory.

I don't know of any workaround other than removing dependence on a library which no longer exists.

GautamBose commented 4 months ago

Is this affecting all builds on Ventura? Or only those with a specific dependency?

matagus commented 4 months ago

Just in case it helps, I run into the same issue in this project using rumps + py2app. This workaround worked for me.

GautamBose commented 4 months ago

@matagus Worked for me thanks!