alexzielenski / Mousecape

Cursor Manager for OSX
http://www.alexzielenski.com
Other
1.32k stars 165 forks source link

Animated cursor does not work in an arm64 native build #225

Open i0ntempest opened 4 months ago

i0ntempest commented 4 months ago

So I managed to build this app on my M2 Mac as a native arm64 app, and created some animated cursor sprite sheets from .ani cursors. Weirdly these cursors will not animate: they seems to be stuck on the first frame. However if I cross compile it to x86_64 then run it with Rosetta translation, then everything works fine. I don't even know how it's possible for code behavior to change depending on compiled architecture. Anyone can help me with this? If I get this problem fixed I will publish this to MacPorts so everyone can easily install Mousecape running natively on their machine. There're similar issues like https://github.com/alexzielenski/Mousecape/issues/215 and https://github.com/alexzielenski/Mousecape/issues/192 but I don't know if they're truely related.

xhruso00 commented 1 week ago

@i0ntempest you can try to compile with older versions of Xcode. MacOS check at runtime the version it has been build against and enables legacy code paths. You might be able to see those flags with Hopper App when you dissasemble AppKit. It's hard to run old Xcode on recent macOS so the only choice might be a virtual machine with Big Sur.

i0ntempest commented 1 week ago

@i0ntempest you can try to compile with older versions of Xcode. MacOS check at runtime the version it has been build against and enables legacy code paths. You might be able to see those flags with Hopper App when you dissasemble AppKit. It's hard to run old Xcode on recent macOS so the only choice might be a virtual machine with Big Sur.

Thanks for the pointer. So I should try an older SDK? Or set deployment target to an older OS? Any specific version I should try?

xhruso00 commented 1 week ago

Yes older SDK is the solution. 10 years ago the Xcode wasn't tied with SDK and you could choose any. Nowadays xcode and sdks are tied together (doable to change but unsupported and can have some negative effects, I wouldn't recommend this path). Deployment target just means the macOS version that you allow your code to run on (beware as Xcode 15 had issue when the min macOS was 10.13 - it crashed at runtime). I would suggest min macOS deployment target as 11.0. The author of the app has shipped it working with 10.15. Those people can grab that archive. Be warned that raising minimum deployment target brings up depreciation warnings (can just ignore them at the time, just they are annoying).

Xcode 12.1 should be the solution to try https://developer.apple.com/support/xcode/

i0ntempest commented 1 week ago

@xhruso00 I just tried putting 10.15 SDK into current Xcode, and the app built fine... but it's x86_64. I don't think 10.15 SDK can build arm64, and building x86_64 with current SDK works fine (animated cursors and stuff). The ultimate goal is a working arm64 build, is that even possible?

xhruso00 commented 1 week ago

@i0ntempest I would try Xcode 12.2. According to the picture it has 11.0 SDK image

xhruso00 commented 1 week ago

Make sure the VALID_ARCHS is not overridden by user defined constants and contains x86_64 and arm64 https://forums.developer.apple.com/forums/thread/695362

xhruso00 commented 1 week ago

@i0ntempest My apologies. There is no such thing as 10.15 Arm SDK -> cannot produce the arm64. Must use min 11.0 SDK.

i0ntempest commented 1 week ago

Tried building arm64 with 11.0 SDK - same thing, cursor still won't animate. ¯\(ツ)