We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 5357

Summary: SDL2 won't compile for Apple Silicon on macOS Big Sur
Product: SDL Reporter: Tom Kidd <tomkidd>
Component: atomicAssignee: Sam Lantinga <slouken>
Status: RESOLVED INVALID QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2    
Version: 2.0.12   
Hardware: x86   
OS: Other   

Description Tom Kidd 2020-11-19 04:22:40 UTC
This is not a completely immediate concern since for the time being Apple Silicon running Big Sur can still run x86_64 code, but when I try and build a version of SDL 2.0.12 for "Any Mac (Apple Silicon, Intel)" the build fails. 

The line failing is in SDL_Spinlock.c, line 107, because it can't find the function named OSAtomicCompareAndSwap32Barrier.

My guess is that since this function was deprecated a few versions back, when they made the Apple Silicon version of Big Sur they just didn't bother implementing deprecated methods. The header file says something about using std::atomic_compare_exchange_strong but I'm not versed enough to know how to just drop that in. 

Anyway, thought you guys might like to know.
Comment 1 Sam Lantinga 2020-11-24 05:23:07 UTC
Is this fixed in the latest snapshot?
http://www.libsdl.org/SDL-2.0.zip
Comment 2 Tom Kidd 2020-11-25 22:41:18 UTC
My mistake - despite my best efforts to keep everything situated, somehow I was using a 2.0.10 source code snapshot instead of 2.0.12. 

It compiles correctly in 2.0.12 as well as the latest snapshot.
Comment 3 Sam Lantinga 2020-11-26 01:58:02 UTC
Glad to hear it. :)