-
Notifications
You must be signed in to change notification settings - Fork 19
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
SIGSEGV (Address boundary error) on Apple Silicon M1, Big Sur 11.5.2 #12
Comments
Thanks for narrowing this down. Could you try the code I just pushed in https://github.com/albertosottile/darkdetect/tree/cfunctype and check if it works on your M1 Mac? EDIT: I did not realize you also had a fix to avoid passing |
Works for both light and dark! |
It's not a problem! I was just hacking at it to see how/why. Your solution seems much more elegant! |
Ok, I will then proceed with tests (for what I can run, though, as I still do not own a M1 Mac :( ) and release this fix as soon as possible. Once again, thanks for finding and debugging this issue. I wonder how this code had worked with x86_64 up to now... |
Fixed in 0.5.0. |
Yup! And live on
|
See albertosottile/darkdetect#12 for reference
This is related to:
#11
I reported crashes on Big Sur, but it seems my issue wasn't related to Big Sur per se, but to architecture (arm64, Apple Silicon M1). In fact the version detection added in 0.4 doesn't seem to be needed in my environment (Big Sur 11.5.2, python 3.9.6/7)
I've narrowed down the fault to the mismatch in args between:
darkdetect/darkdetect/_mac_detect.py
Line 27 in e6d1db5
and
darkdetect/darkdetect/_mac_detect.py
Lines 52 to 53 in e6d1db5
I believe this is due to arch changes, based on:
https://developer.apple.com/documentation/apple-silicon/addressing-architectural-differences-in-your-macos-code
As a simple test, add at line 41: (after C is defined)
with:
objc.objc_msgSend.argtypes = [void_p, void_p]
this crashes.with:
objc.objc_msgSend.argtypes = [void_p, void_p, void_p]
this runs.As such, I was able to patch this locally by changing the number of argtypes and args for all
msg
. I can do a PR, but it will for sure need some extra testing/review.Edit: I have a more elegant fix, where just the
.argtypes
is changed just for the 3 argmsg
lines.The text was updated successfully, but these errors were encountered: