-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
macOS x86_64 link failure #4958
Comments
Oh yeah, that is why we don't use @available. I'll have to look up what the 10.12 compatible way of doing this is. |
You could wrap the |
Can you verify this is fixed by cc094f4? |
Still not fully resolved. i686 build against 10.8 SDK:
x86_64 build against 10.12 SDK:
|
|
Speaking of
So we need fixing |
Is the following OK for diff --git a/src/render/metal/SDL_render_metal.m b/src/render/metal/SDL_render_metal.m
index e4dd590..96f87ae 100644
--- a/src/render/metal/SDL_render_metal.m
+++ b/src/render/metal/SDL_render_metal.m
@@ -35,6 +35,10 @@
#import <AppKit/NSView.h>
#endif
+#ifndef NSAppKitVersionNumber10_13
+#define NSAppKitVersionNumber10_13 1561
+#endif
+
/* Regenerate these with build-metal-shaders.sh */
#ifdef __MACOSX__
#include "SDL_shaders_metal_osx.h"
@@ -1584,7 +1588,7 @@ static int
METAL_SetVSync(SDL_Renderer * renderer, const int vsync)
{
#if (defined(__MACOSX__) && defined(MAC_OS_X_VERSION_10_13)) || TARGET_OS_MACCATALYST
- if (@available(macOS 10.13, *)) {
+ if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_13) {
METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata;
if (vsync) {
data.mtllayer.displaySyncEnabled = YES;
@@ -1855,7 +1859,7 @@ METAL_CreateRenderer(SDL_Window * window, Uint32 flags)
renderer->always_batch = SDL_TRUE;
#if (defined(__MACOSX__) && defined(MAC_OS_X_VERSION_10_13)) || TARGET_OS_MACCATALYST
- if (@available(macOS 10.13, *)) {
+ if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_13) {
data.mtllayer.displaySyncEnabled = (flags & SDL_RENDERER_PRESENTVSYNC) != 0;
if (data.mtllayer.displaySyncEnabled) {
renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC; |
According to the Xcode release notes, the |
Cross-compiling on Linux using clang-5.0.2 or clang-11.1 or clang-12.0.1, and cctools-port (see https://github.com/tpoechtrager/cctools-port, I'm using the latest), against relevant MacOSX SDKs (downloadable from https://github.com/alexey-lysiuk/macos-sdk) |
Does that mean there's a bug in one of those non-standard tools? It's not gonna be very developer-friendly to have to work around upstream issues in non-sanctioned tools when writing macOS code for SDL, if so. |
Don't think so, but I can't be sure, of course. |
Where is the issue coming from then? Given the official 10.13 SDK and Xcode 9+ tools do provide |
As I said, I can't be sure. If it matters, here is how I invoke clang:
|
@slime73: https://jonnyzzz.com/blog/2018/06/05/link-error-2/ provided some insight: Since I'm targeting 10.6 as the minimum, |
|
FWIW, copying the |
With diff --git a/src/joystick/iphoneos/SDL_mfijoystick.m b/src/joystick/iphoneos/SDL_mfijoystick.m
index 08ed418a1..605651f57 100644
--- a/src/joystick/iphoneos/SDL_mfijoystick.m
+++ b/src/joystick/iphoneos/SDL_mfijoystick.m
@@ -1329,38 +1329,40 @@ IOS_JoystickRumbleTriggers(SDL_Joystick *joystick, Uint16 left_rumble, Uint16 ri
static Uint32
IOS_JoystickGetCapabilities(SDL_Joystick *joystick)
{
Uint32 result = 0;
+#if defined(ENABLE_MFI_LIGHT) || defined(ENABLE_MFI_RUMBLE)
@autoreleasepool {
SDL_JoystickDeviceItem *device = joystick->hwdata;
if (device == NULL) {
return 0;
}
if (@available(macos 11.0, iOS 14.0, tvOS 14.0, *)) {
GCController *controller = device->controller;
-#ifdef ENABLE_MFI_LIGHT
+ #ifdef ENABLE_MFI_LIGHT
if (controller.light) {
result |= SDL_JOYCAP_LED;
}
-#endif /* ENABLE_MFI_LIGHT */
+ #endif
-#ifdef ENABLE_MFI_RUMBLE
+ #ifdef ENABLE_MFI_RUMBLE
if (controller.haptics) {
for (GCHapticsLocality locality in controller.haptics.supportedLocalities) {
if ([locality isEqualToString:GCHapticsLocalityHandles]) {
result |= SDL_JOYCAP_RUMBLE;
} else if ([locality isEqualToString:GCHapticsLocalityTriggers]) {
result |= SDL_JOYCAP_RUMBLE_TRIGGERS;
}
}
}
-#endif /* ENABLE_MFI_RUMBLE */
+ #endif
}
}
+#endif /* ENABLE_MFI_LIGHT || ENABLE_MFI_RUMBLE */
return result;
}
static int |
Alpine base image to 3.17.2 osxcross to 6525b2b7d33abc371ad889f205377dc5cf81f23e: it now handles fetching and building many dependencies automatically, and needs much less (but still some) hackery to get it to build in a musl environment (looking at you, pbzx). macOS SDK to 11.3 (from Xcode 12.5.1). Include compiler-rt to fix building more recent SDL versions (see libsdl-org/SDL#4958). Deployment target is now 10.7 due to SDL requirement.
Alpine base image to 3.17.2 osxcross to 6525b2b7d33abc371ad889f205377dc5cf81f23e: it now handles fetching and building many dependencies automatically, and needs much less (but still some) hackery to get it to build in a musl environment (looking at you, pbzx). macOS SDK to 11.3 (from Xcode 12.5.1). Include compiler-rt to fix building more recent SDL versions (see libsdl-org/SDL#4958). Deployment target is now 10.7 due to SDL requirement.
Alpine base image to 3.17.2 osxcross to 6525b2b7d33abc371ad889f205377dc5cf81f23e: it now handles fetching and building many dependencies automatically, and needs much less (but still some) hackery to get it to build in a musl environment (looking at you, pbzx). macOS SDK to 11.3 (from Xcode 12.5.1). Include compiler-rt to fix building more recent SDL versions (see libsdl-org/SDL#4958). Deployment target is now 10.7 due to SDL requirement.
This is with building against 10.12 SDK.
The text was updated successfully, but these errors were encountered: