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

Mac OS Catalina App crash on app start #4466

Closed
trittsv opened this issue Oct 8, 2019 · 15 comments · Fixed by #8378
Closed

Mac OS Catalina App crash on app start #4466

trittsv opened this issue Oct 8, 2019 · 15 comments · Fixed by #8378

Comments

@trittsv
Copy link

trittsv commented Oct 8, 2019

  1. Create mac os app using PyInstaller build.spec
  2. Set "LSBackgroundOnly" to "false" in "Contents/Info.plist"
  3. Open App... loading.. loading.. crash

build app on mac os Catalina, it crashes when i launch app.
on Mojave everything worked perfectly

Versions:
PyInstaller 3.5
Mac Os Catalina 10.15
Python 3.6.5

2019-10-08 21:48:18.272 SmartPhotoApp[2535:53063] -[__NSCFNumber length]: unrecognized selector sent to instance 0x137
2019-10-08 21:48:18.275 SmartPhotoApp[2535:53063] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFNumber length]: unrecognized selector sent to instance 0x137'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fff346c6783 __exceptionPreprocess + 250
	1   libobjc.A.dylib                     0x00007fff6a6728f3 objc_exception_throw + 48
	2   CoreFoundation                      0x00007fff34750ed5 -[NSObject(NSObject) __retain_OA] + 0
	3   CoreFoundation                      0x00007fff3466cd60 ___forwarding___ + 1427
	4   CoreFoundation                      0x00007fff3466c738 _CF_forwarding_prep_0 + 120
	5   CoreFoundation                      0x00007fff3463ae71 CFStringGetDoubleValue + 44
	6   CoreFoundation                      0x00007fff34634831 ___bundleInfo_block_invoke + 175
	7   libdispatch.dylib                   0x00007fff6b9754de _dispatch_client_callout + 8
	8   libdispatch.dylib                   0x00007fff6b976656 _dispatch_once_callout + 20
	9   CoreFoundation                      0x00007fff3461e4c5 _CFAppVersionCheckLessThan + 135
	10  AppKit                              0x00007fff320a1648 NSColorEnableTaggedPointerColorsDefaultValueFunction + 29
	11  AppKit                              0x00007fff31814d96 _NSGetBoolAppConfig + 175
	12  AppKit                              0x00007fff320a15ee registerTaggedPointerColorsIfNecessary.llvm.17713661276226893231 + 85
	13  AppKit                              0x00007fff320a1315 _NSColorSpaceTaggedPointerColor + 24
	14  AppKit                              0x00007fff318167c0 +[NSColor colorWithColorSpace:components:count:] + 33
	15  AppKit                              0x00007fff31816433 -[NSAppearance _customColor:withTint:] + 51
	16  AppKit                              0x00007fff3181628c _UpdateSystemAppearancesWithAccentColor + 184
	17  AppKit                              0x00007fff3181590a +[NSAppearance _aquaAppearance] + 217
	18  AppKit                              0x00007fff318155b6 +[NSAppearance appearanceNamed:] + 24
	19  AppKit                              0x00007fff318511fb -[NSDynamicSystemColor recacheColor] + 230
	20  AppKit                              0x00007fff31850fe4 -[NSDynamicSystemColor initWithSelector:tintedWithColor:] + 120
	21  AppKit                              0x00007fff31883114 +[NSColor controlTextColor] + 80
	22  libqcocoa.dylib                     0x0000000111d9ca99 qt_plugin_instance + 288217
	23  ???                                 0x000000010cc91635 0x0 + 4509472309
	24  ???                                 0x000000010cc91a5a 0x0 + 4509473370
	25  ???                                 0x000000010cc8c933 0x0 + 4509452595
	26  ???                                 0x000000010cc8b69c 0x0 + 4509447836
	27  ???                                 0x000000010cc8b73c 0x0 + 4509447996
	28  ???                                 0x000000010cc7dd87 0x0 + 4509392263
	29  ???                                 0x000000010cc87767 0x0 + 4509431655
	30  libdyld.dylib                       0x00007fff6b9b5f6f dlopen + 171
	31  QtCore                              0x000000010da5158b _ZN8QLibrary11qt_metacallEN11QMetaObject4CallEiPPv + 7515
	32  QtCore                              0x000000010da4c939 _Z5qHashRK5QUuidj + 2377
	33  QtCore                              0x000000010da4ce42 _Z5qHashRK5QUuidj + 3666
	34  QtCore                              0x000000010da486f5 _ZNK14QFactoryLoader8instanceEi + 101
	35  QtGui                               0x000000010d33fd1d _ZN27QPlatformIntegrationFactory6createERK7QStringRK11QStringListRiPPcS2_ + 157
	36  QtGui                               0x000000010d34c4d3 _ZN22QGuiApplicationPrivate25createPlatformIntegrationEv + 2403
	37  QtGui                               0x000000010d34d7bb _ZN22QGuiApplicationPrivate21createEventDispatcherEv + 27
	38  QtCore                              0x000000010da578bf _ZN23QCoreApplicationPrivate4initEv + 1567
	39  QtGui                               0x000000010d348aa9 _ZN22QGuiApplicationPrivate4initEv + 57
	40  QtWidgets                           0x000000010cd83d3a _ZN19QApplicationPrivate4initEv + 26
	41  QtWidgets.so                        0x000000010c71f818 _ZL22init_type_QApplicationP17_sipSimpleWrapperP7_objectS2_PS2_S3_S3_ + 168
	42  sip.so                              0x000000010cb51b41 sipSimpleWrapper_init + 185
	43  Python                              0x000000010bf793f5 type_call + 184
	44  Python                              0x000000010bf3058f _PyObject_FastCallDict + 151
	45  Python                              0x000000010bfd092a call_function + 451
	46  Python                              0x000000010bfcd61d _PyEval_EvalFrameDefault + 23919
	47  Python                              0x000000010bfd1a66 _PyFunction_FastCall + 116
	48  Python                              0x000000010bfd0931 call_function + 458
	49  Python                              0x000000010bfcd61d _PyEval_EvalFrameDefault + 23919
	50  Python                              0x000000010bfd10e8 _PyEval_EvalCodeWithName + 1757
	51  Python                              0x000000010bfc7815 PyEval_EvalCode + 56
	52  SmartPhotoApp                       0x000000010bd1b3a9 SmartPhotoApp + 9129
	53  SmartPhotoApp                       0x000000010bd1b93a SmartPhotoApp + 10554
	54  SmartPhotoApp                       0x000000010bd1a0b4 SmartPhotoApp + 4276
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Abort trap: 6
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.

@trittsv trittsv changed the title Mac OS Catalina App crash Mac OS Catalina App crash on app start Oct 8, 2019
@rilian
Copy link

rilian commented Oct 17, 2019

we also have the same issue, compiled app crashes the Mac session

@mworion
Copy link

mworion commented Oct 18, 2019

Same problem to me. Stack trace looks very similar:

2019-10-18 19:31:26.507 MountWizzard4[2608:39660] -[__NSCFNumber length]: unrecognized selector sent to instance 0x437
2019-10-18 19:31:26.510 MountWizzard4[2608:39660] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFNumber length]: unrecognized selector sent to instance 0x437'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff32314783 __exceptionPreprocess + 250
1 libobjc.A.dylib 0x00007fff681278f3 objc_exception_throw + 48
2 CoreFoundation 0x00007fff3239eed5 -[NSObject(NSObject) __retain_OA] + 0
3 CoreFoundation 0x00007fff322bad60 forwarding + 1427
4 CoreFoundation 0x00007fff322ba738 _CF_forwarding_prep_0 + 120
5 CoreFoundation 0x00007fff32288e71 CFStringGetDoubleValue + 44
6 CoreFoundation 0x00007fff32282831 ___bundleInfo_block_invoke + 175
7 libdispatch.dylib 0x00007fff6942a4de _dispatch_client_callout + 8
8 libdispatch.dylib 0x00007fff6942b656 _dispatch_once_callout + 20
9 CoreFoundation 0x00007fff3226c4c5 _CFAppVersionCheckLessThan + 135
10 AppKit 0x00007fff2fcef648 NSColorEnableTaggedPointerColorsDefaultValueFunction + 29
11 AppKit 0x00007fff2f462d96 _NSGetBoolAppConfig + 175
12 AppKit 0x00007fff2fcef5ee registerTaggedPointerColorsIfNecessary.llvm.17713661276226893231 + 85
13 AppKit 0x00007fff2fcef315 _NSColorSpaceTaggedPointerColor + 24
14 AppKit 0x00007fff2f4647c0 +[NSColor colorWithColorSpace:components:count:] + 33
15 AppKit 0x00007fff2f464433 -[NSAppearance _customColor:withTint:] + 51
16 AppKit 0x00007fff2f46428c _UpdateSystemAppearancesWithAccentColor + 184
17 AppKit 0x00007fff2f46390a +[NSAppearance _aquaAppearance] + 217
18 AppKit 0x00007fff2f4635b6 +[NSAppearance appearanceNamed:] + 24
19 AppKit 0x00007fff2f49f1fb -[NSDynamicSystemColor recacheColor] + 230
20 AppKit 0x00007fff2f49efe4 -[NSDynamicSystemColor initWithSelector:tintedWithColor:] + 120
21 AppKit 0x00007fff2f4d1114 +[NSColor controlTextColor] + 80
22 libqcocoa.dylib 0x0000000122751a99 qt_plugin_instance + 288217
23 ??? 0x0000000118221635 0x0 + 4699854389
24 ??? 0x0000000118221a5a 0x0 + 4699855450
25 ??? 0x000000011821c933 0x0 + 4699834675
26 ??? 0x000000011821b69c 0x0 + 4699829916
27 ??? 0x000000011821b73c 0x0 + 4699830076
28 ??? 0x000000011820dd87 0x0 + 4699774343
29 ??? 0x0000000118217767 0x0 + 4699813735
30 libdyld.dylib 0x00007fff6946af6f dlopen + 171
31 QtCore 0x0000000117c7e58b _ZN8QLibrary11qt_metacallEN11QMetaObject4CallEiPPv + 7515
32 QtCore 0x0000000117c79939 _Z5qHashRK5QUuidj + 2377
33 QtCore 0x0000000117c79e42 _Z5qHashRK5QUuidj + 3666
34 QtCore 0x0000000117c756f5 _ZNK14QFactoryLoader8instanceEi + 101
35 QtGui 0x000000011eb1fd1d ZN27QPlatformIntegrationFactory6createERK7QStringRK11QStringListRiPPcS2 + 157
36 QtGui 0x000000011eb2c4d3 _ZN22QGuiApplicationPrivate25createPlatformIntegrationEv + 2403
37 QtGui 0x000000011eb2d7bb _ZN22QGuiApplicationPrivate21createEventDispatcherEv + 27
38 QtCore 0x0000000117c848bf _ZN23QCoreApplicationPrivate4initEv + 1567
39 QtGui 0x000000011eb28aa9 _ZN22QGuiApplicationPrivate4initEv + 57
40 QtWidgets 0x000000011e563d3a _ZN19QApplicationPrivate4initEv + 26
41 QtWidgets.so 0x000000011e138818 ZL22init_type_QApplicationP17_sipSimpleWrapperP7_objectS2_PS2_S3_S3 + 168
42 sip.cpython-37m-darwin.so 0x00000001180eaac5 sipSimpleWrapper_init + 181
43 .Python 0x0000000113682699 type_call + 297
44 .Python 0x00000001136373d1 _PyObject_FastCallKeywords + 433
45 .Python 0x00000001136f66d4 call_function + 420
46 .Python 0x00000001136f37dd _PyEval_EvalFrameDefault + 25181
47 .Python 0x00000001136379f0 function_code_fastcall + 128
48 .Python 0x00000001136f6812 call_function + 738
49 .Python 0x00000001136f387e _PyEval_EvalFrameDefault + 25342
50 .Python 0x00000001136f7363 _PyEval_EvalCodeWithName + 2467
51 .Python 0x00000001136ed4a4 PyEval_EvalCode + 100
52 MountWizzard4 0x000000010ffbbfa9 MountWizzard4 + 8105
53 MountWizzard4 0x000000010ffbc55a MountWizzard4 + 9562
54 MountWizzard4 0x000000010ffbacb4 MountWizzard4 + 3252
55 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Abort trap: 6

@cswinslow
Copy link

This... is unfortunate. Anyone ever find a resolution as of yet? My trace:

0:241: execution error: 2019-10-30 08:02:04.393 fcpsToolchain[3777:69186] -[__NSCFConstantString objectAtIndex:]: unrecognized selector sent to instance 0x7fff8eb7b210
2019-10-30 08:02:04.394 fcpsToolchain[3777:69186] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFConstantString objectAtIndex:]: unrecognized selector sent to instance 0x7fff8eb7b210'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fff35f07f53 __exceptionPreprocess + 250
	1   libobjc.A.dylib                     0x00007fff6bfcd835 objc_exception_throw + 48
	2   CoreFoundation                      0x00007fff35f92106 -[NSObject(NSObject) __retain_OA] + 0
	3   CoreFoundation                      0x00007fff35eae6cb ___forwarding___ + 1427
	4   CoreFoundation                      0x00007fff35eae0a8 _CF_forwarding_prep_0 + 120
	5   CoreFoundation                      0x00007fff35e4812e CFArrayContainsValue + 197
	6   HIServices                          0x00007fff340c5b79 TransformProcessType + 927
	7   fcpsToolchain                       0x0000000109583284 fcpsToolchain + 8836
	8   fcpsToolchain                       0x00000001095835cc fcpsToolchain + 9676
	9   fcpsToolchain                       0x0000000109581cb4 fcpsToolchain + 3252
	10  ???                                 0x0000000000000002 0x0 + 2
)
libc++abi.dylib: terminating with uncaught exception of type NSException
 (1006)

@severinsimmler
Copy link

Any news on this?

@trittsv
Copy link
Author

trittsv commented Apr 25, 2020

it still crashes with upgraded versions.. PyInstaller 3.6, MacOS Catalina 10.15.4, PyQt5-5.14.2, Python 3.8...

@cswinslow
Copy link

Any news on this?

In my case: the only way that I've found, so far, is to build the UI only using .ui files with Qt Creator or some such, and then reference them inside my code. I cannot, in any way, create a UI purely with Python or else it'll fail to launch with my above trace. After building using referenced .ui files, it launches correctly.

This is fine for me as it's only just a small toolkit for a small company, but for others I'd imagine it's not going to be a simple fix as I had to completely rewrite a feature to work with those .ui files.

@BoboTiG
Copy link
Contributor

BoboTiG commented Oct 22, 2020

Could you share a minimal example, its spec file and the command line used to build the executable, to ease reproduction?

@trittsv
Copy link
Author

trittsv commented Mar 26, 2024

still crashes on mac os Sonoma - did anyone get it work on mac os?

@rokm
Copy link
Member

rokm commented Mar 26, 2024

still crashes on mac os Sonoma - did anyone get it work on mac os?

Can you provide a self-contained example that triggers the issue? And information about build environment that would allow us to reproduce the problem: python version, pyqt version, how python and pyqt were installed (python.org + pypi, homebrew, anaconda)?

FWIW, our CI runs on Monterey, and PySide/PyQt tests pass for the latest PyPI wheels. A basic hello world PyQt5 app also seems to work on my Sonoma arm64 Mac, even if I set "LSBackgroundOnly" to "false" in "Contents/Info.plist", like you mentioned in the original report.

@trittsv
Copy link
Author

trittsv commented Mar 26, 2024

@rokm yes, here is the self-contained example (with build folder and logfiles build_log.log, runtime_log.log):
https://drive.google.com/file/d/1utZs9R1TDQii40rSWIOzu8AEUjE4Ma2r/view?usp=sharing
Here are only sources if you are not allowed to download via gdrive:
pyinst_pyside_crash_only_sources.zip

How i build:

cd pyinst_pyside_crash
pyinstaller main.spec --clean --log-level=DEBUG > build_log.log 2>&1

It crash when i want to execute the dist/pyinst_pyside_crash.app file, it does not crash when i start dist/pyinst_pyside_crash/pyinst_pyside_crash
Screenshot 2024-03-26 at 16 08 22

Build Environment:

  • PyInstaller: 6.5.0, contrib hooks: 2024.3
  • Python: 3.12.2 (Installed via homebrew /opt/homebrew/Cellar/python@3.12, /opt/homebrew/lib/python3.12)
  • Platform: macOS-14.4-arm64-arm-64bit
  • /opt/homebrew/bin/python3 -m pip install pyinstaller
  • /opt/homebrew/bin/python3 -m pip install PySide6
Package                   Version Editable project location
------------------------- ------- ----------------------------------------------------------
altgraph                  0.17.4
click                     8.1.7
cyclonedds                0.11.0  /Users/sventrittler/workspace/thridparty/cyclonedds-python
macholib                  1.16.3
markdown-it-py            3.0.0
mdurl                     0.1.2
packaging                 24.0
pip                       24.0
Pygments                  2.17.2
pyinstaller               6.5.0
pyinstaller-hooks-contrib 2024.3
PySide6                   6.6.2
PySide6_Addons            6.6.2
PySide6_Essentials        6.6.2
pywatchman                2.0.0
rich                      13.7.1
rich-click                1.7.4
setuptools                69.2.0
shiboken6                 6.6.2
typing_extensions         4.10.0
wheel                     0.42.0

@rokm do you need more info or is this sufficient?

@rokm
Copy link
Member

rokm commented Mar 26, 2024

@rokm do you need more info or is this sufficient?

Thanks! I'll check if I can reproduce the problem, and get back to you if I need anything else.

@rokm
Copy link
Member

rokm commented Mar 26, 2024

This particular crash is caused by

app = BUNDLE(coll,
    ...
    version=1
)

in the main.spec, which results in the following entry in Info.plist :

	<key>CFBundleShortVersionString</key>
	<integer>1</integer>

whereas it should be a

	<key>CFBundleShortVersionString</key>
	<string>1</string>

Changing version=1 to version='1' should do the trick. (And we should probably do explicit str(version) when generating this entry, to avoid issues like this).

@rokm
Copy link
Member

rokm commented Mar 26, 2024

And based on the traceback, both the original report and #4466 (comment) had this issue, considering that _CFAppVersionCheckLessThan and CFStringGetDoubleValue appear in there.

@trittsv
Copy link
Author

trittsv commented Mar 26, 2024

@rokm thank you very much, this works 😃 Do we have a explanation why it got broken after MacOS Mojave with MacOS Catalina? Did Apple allowed it to be a integer only until Mojave?

@rokm
Copy link
Member

rokm commented Mar 26, 2024

@rokm thank you very much, this works 😃 Do we have a explanation why it got broken after MacOS Mojave with MacOS Catalina? Did Apple allowed it to be a integer only until Mojave?

Could be that, or that the CFBundleShortVersionString was not queried at all in Mojave and earlier.

Based on its name, I assumed that _CFAppVersionCheckLessThan should be checking the application version, but this seems to imply that it is checking the app bundle identifier and the linked macOS SDK version. So perhaps implementation of _CFAppVersionCheckLessThan under Mojave does not query CFBundleShortVersionString, and under later versions, it does.

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

Successfully merging a pull request may close this issue.

7 participants