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 5232

Summary: SDL2 configure script detects Apple Silicon Macs as iPhones; fails to build due to missing components
Product: SDL Reporter: jackmacwindowslinux
Component: *don't know*Assignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: major    
Priority: P2    
Version: 2.0.12   
Hardware: ARM   
OS: macOS 10.15   

Description jackmacwindowslinux 2020-07-15 05:05:13 UTC
I'm testing my application that uses SDL2 on the new Apple Silicon Macs. I set up the SDL 2.0.12 source code from the website and tried to build it. The first issue I ran into was that it was always building OpenGL ES, even if --disable-video-opengles was passed to configure. OpenGL ES headers do not seem to be present on the Apple Silicon macOS SDK, except for the iOS SDK headers. Then I had problems with the joystick driver, where some classes used on iOS were not available on macOS.

After looking through the configure.ac script a bit, I found that iOS targets are selected when the build host matches "arm*-apple-darwin*". Clang on macOS 11.0 on arm64 reports the host as "arm64-apple-darwin20.0.0", which matches the iOS target. This means that ARM Mac compilation will always be detected as iOS. Unfortunately, there doesn't seem to be an easy way to detect Mac vs. iOS targets, since they now both use the same triplet & compiler for building.

I'm not sure what the best way to fix this is, but maybe there could be an additional target flag to specify whether to build for macOS or iOS? This might break compatibility, though: with this approach, either all old scripts that used configure to build for iOS fail, or all new builds on macOS without a flag fail (silently?).

If you need any more info on the Apple Silicon platform, I'm happy to run a few commands for you :).
Comment 1 Sam Lantinga 2020-07-15 17:53:48 UTC
Have you tried building with Xcode?
Comment 2 Sam Lantinga 2020-07-15 23:15:10 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL/rev/af22dd6c0787