Opened 8 years ago
Last modified 5 months ago
#52210 new defect
libsdl2: make it build on 10.6 (against 10.6 SDK) — at Version 30
Reported by: | kenneth.f.cunningham@… | Owned by: | jmr@… |
---|---|---|---|
Priority: | Low | Milestone: | |
Component: | ports | Version: | |
Keywords: | snowleopard | Cc: | ryandesign (Ryan Carsten Schmidt), mojca (Mojca Miklavec), jeremyhu (Jeremy Huddleston Sequoia), dliessi (Davide Liessi) |
Port: | libsdl2 |
Description (last modified by mojca (Mojca Miklavec))
This one might be nitpicky I suppose, but it stuck me for while.
libsdl2 does build and run nicely on 10.6, but indeed, as the instructions say "Building $name requires OS X 10.7 SDK or later"
At first, I thought this was a no-go on 10.6, and it wasn't initially obvious to me that what was needed was to copy the MacOSX10.7.sdk from another machine to ${developer_dir}/SDKs/MacOSX10.7.sdk, and that only this exact SDK would work. Then the build on 10.6 goes fine.
How about something like:
error "Building $name on Mac OS X 10.6 requires the MacOSX10.7.sdk to be present in ${developer_dir}/SDKs/"
Addendum my mojca: the above mentioned issue has been addressed, but let's turn this ticket into an effort to make the software build natively against 10.6 SDK.
Change History (30)
comment:1 follow-up: 6 Changed 8 years ago by ryandesign (Ryan Carsten Schmidt)
Cc: | jmr@… removed |
---|---|
Keywords: | libsdl2 removed |
Owner: | changed from macports-tickets@… to jmr@… |
Port: | libsdl2 added |
comment:2 Changed 8 years ago by kenneth.f.cunningham@…
I know -- I find this "build to an SDK for another OS version" business still a little magical.
I think if the 10.7 SDK is sitting there but isn't specifically referenced by the software being built, it is just ignored, but of course as I'm sure you know better than most, one never really knows how it might move into the mix. You could add it, build libSDL2 universal, and then delete it or archive it. That would keep it out of sight for the unforeseen other unknowns.
I'm not certain how much new software libSDL2 would allow to run on 10.6 that might otherwise not be able to run -- probably quite a bit, I would imagine.
comment:3 Changed 8 years ago by jmroot (Joshua Root)
SDL upstream doesn't really support this either, the extent of the 10.6 compatibility offered is that you can build on 10.7 or later with MACOSX_DEPLOYMENT_TARGET=10.6 and get a binary that will run on 10.6.
comment:4 Changed 8 years ago by kenneth.f.cunningham@…
I guess my only point with this ticket was that I saw you had already done the work in the portfile to screen for 10.6, and then to file check for the 10.7SDK to see if libSDL2 should build -- and I thought you were trying to tell people what they had to do to make it work, but figured you might make the message a little more direct for us slower folk. -- K
comment:5 Changed 8 years ago by kenneth.f.cunningham@…
I was curious whether libSDL2 linked to or depended in any way on the 10.7SDK once built, but it doesn't appear to -- I have to read more about how this works. I guess it just uses the headers and other information in the 10.7SDK to run the build correctly...I wonder if this approach might work for any other software on 10.6 too (like qt5, for example...).
$ otool -L /opt/local/lib/libSDL2-2.0.0.dylib /opt/local/lib/libSDL2-2.0.0.dylib: /opt/local/lib/libSDL2-2.0.0.dylib (compatibility version 5.0.0, current version 5.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0) /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0) /System/Library/Frameworks/ForceFeedback.framework/Versions/A/ForceFeedback (compatibility version 1.0.0, current version 1.0.2) /System/Library/Frameworks/CoreVideo.framework/Versions/A/CoreVideo (compatibility version 1.2.0, current version 1.7.0) /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 17.0.0) /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 153.0.0) /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0) /System/Library/Frameworks/CoreAudio.framework/Versions/A/CoreAudio (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/AudioToolbox.framework/Versions/A/AudioToolbox (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/AudioUnit.framework/Versions/A/AudioUnit (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1138.47.0) /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 41.0.0) /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 635.21.0) /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 53.0.0) /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 833.25.0)
comment:6 Changed 8 years ago by ryandesign (Ryan Carsten Schmidt)
Cc: | ryandesign added |
---|
Replying to ryandesign:
You observations sound correct, but I'm not thrilled about asking users to modify the contents of /Developer/SDKs. As far as I know, Apple does not provide a sanctioned way of having the 10.7 SDK on 10.6, and MacPorts currently doesn't do anything to advocate circumventing that.
I'm changing my mind on this. There should be no harm to copying a 10.7 SDK into /DeveloperSDKs on Snow Leopard. I'll try it out and if that works, then I'll add that SDK to the 10.6 buildbot workers.
comment:7 follow-up: 11 Changed 8 years ago by jmroot (Joshua Root)
If we need to add a compiler blacklist here as per PR#5, I imagine it would be needed when actually building on 10.7 as well. Might need some more testing to find out exactly which compiler versions work.
comment:8 Changed 8 years ago by mojca (Mojca Miklavec)
Cc: | mojca added |
---|
comment:9 Changed 8 years ago by mojca (Mojca Miklavec)
Cc: | jeremyhu added |
---|---|
Version: | 2.3.4 |
Jeremy asked why the port could not be built without 10.7 SDK. Here's the very first problem one hits:
/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/SDL_error.c:120: warning: expected [error|warning|ignored] after '#pragma GCC diagnostic' /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/SDL_error.c:224: warning: expected [error|warning|ignored] after '#pragma GCC diagnostic' CC build/SDL_hints.lo CC build/SDL_log.lo CC build/SDL_atomic.lo CC build/SDL_spinlock.lo CC build/SDL_audio.lo CC build/SDL_audiocvt.lo CC build/SDL_audiodev.lo CC build/SDL_audiotypecvt.lo CC build/SDL_mixer.lo CC build/SDL_wave.lo CC build/SDL_cpuinfo.lo CC build/SDL_dynapi.lo In file included from /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/dynapi/SDL_dynapi.c:31: include/SDL_syswm.h:230:65: error: missing binary operator before token "(" make: *** [build/SDL_dynapi.lo] Error 1 make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5' Command failed: cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5" && /usr/bin/make -w all Exit code: 2
After blacklisting the old compiler with
compiler.blacklist *gcc* { clang < 211 }
(I took the list from Ken Cunningham, I don't know whether also the latest gcc versions are bad.)
the following problem pops up:
CC build/SDL_cocoaevents.lo /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/video/cocoa/SDL_cocoaevents.m:332:40: error: use of undeclared identifier 'NSAppKitVersionNumber10_6'; did you mean 'NSAppKitVersionNumber'? if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) { ^~~~~~~~~~~~~~~~~~~~~~~~~ NSAppKitVersionNumber /System/Library/Frameworks/AppKit.framework/Headers/NSApplication.h:21:28: note: 'NSAppKitVersionNumber' declared here APPKIT_EXTERN const double NSAppKitVersionNumber; ^ /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/video/cocoa/SDL_cocoaevents.m:445:9: warning: implicit declaration of function 'IOPMAssertionCreateWithDescription' is invalid in C99 [-Wimplicit-function-declaration] IOPMAssertionCreateWithDescription(kIOPMAssertPreventUserIdleDisplaySleep, ^ /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/video/cocoa/SDL_cocoaevents.m:445:44: error: use of undeclared identifier 'kIOPMAssertionTypePreventUserIdleDisplaySleep' IOPMAssertionCreateWithDescription(kIOPMAssertPreventUserIdleDisplaySleep, ^ /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/video/cocoa/SDL_cocoaevents.m:33:48: note: expanded from macro 'kIOPMAssertPreventUserIdleDisplaySleep' #define kIOPMAssertPreventUserIdleDisplaySleep kIOPMAssertionTypePreventUserIdleDisplaySleep ^ 1 warning and 2 errors generated. make: *** [build/SDL_cocoaevents.lo] Error 1
After applying the following patch:
-
src/video/cocoa/SDL_cocoaevents.m
old new CreateApplicationMenus(void) 328 328 [windowMenu release]; 329 329 330 330 331 #if defined NSAppKitVersionNumber10_6 331 332 /* Add the fullscreen view toggle menu option, if supported */ 332 333 if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) { 333 334 /* Create the view menu */ … … CreateApplicationMenus(void) 345 346 346 347 [viewMenu release]; 347 348 } 349 #endif 348 350 } 349 351 350 352 void
it eventually fails with:
CC build/SDL_cocoaevents.lo /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/video/cocoa/SDL_cocoaevents.m:249:13: warning: unused variable 'viewMenu' [-Wunused-variable] NSMenu *viewMenu; ^ /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/video/cocoa/SDL_cocoaevents.m:447:9: warning: implicit declaration of function 'IOPMAssertionCreateWithDescription' is invalid in C99 [-Wimplicit-function-declaration] IOPMAssertionCreateWithDescription(kIOPMAssertPreventUserIdleDisplaySleep, ^ /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/video/cocoa/SDL_cocoaevents.m:447:44: error: use of undeclared identifier 'kIOPMAssertionTypePreventUserIdleDisplaySleep' IOPMAssertionCreateWithDescription(kIOPMAssertPreventUserIdleDisplaySleep, ^ /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/video/cocoa/SDL_cocoaevents.m:33:48: note: expanded from macro 'kIOPMAssertPreventUserIdleDisplaySleep' #define kIOPMAssertPreventUserIdleDisplaySleep kIOPMAssertionTypePreventUserIdleDisplaySleep ^ 2 warnings and 1 error generated. make: *** [build/SDL_cocoaevents.lo] Error 1
According to https://developer.apple.com/reference/iokit/kiopmassertiontypepreventuseridledisplaysleep the kIOPMAssertionTypePreventUserIdleDisplaySleep
variable has only been defined in 10.7 and the function IOPMAssertionCreateWithDescription()
that uses it is also only available since 10.7.
Commenting out the function IOPMAssertionCreateWithDescription()
leads to a further error:
CC build/SDL_cocoakeyboard.lo /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/video/cocoa/SDL_cocoakeyboard.m:147:24: warning: instance method '-convertRectToScreen:' not found (return type defaults to 'id') [-Wobjc-method-access] rect = [window convertRectToScreen:rect]; ^~~~~~~~~~~~~~~~~~~ /System/Library/Frameworks/AppKit.framework/Headers/NSWindow.h:156:12: note: receiver is instance of class declared here @interface NSWindow : NSResponder ^ /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/video/cocoa/SDL_cocoakeyboard.m:147:14: error: assigning to 'NSRect' (aka 'struct CGRect') from incompatible type 'id' rect = [window convertRectToScreen:rect]; ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning and 1 error generated. make: *** [build/SDL_cocoakeyboard.lo] Error 1
Again https://developer.apple.com/reference/appkit/nswindow/1419286-convertrecttoscreen says that convertRectToScreen
from
if ([window respondsToSelector:@selector(convertRectToScreen:)]) { rect = [window convertRectToScreen:rect]; } else { rect.origin = [window convertBaseToScreen:rect.origin]; }
is 10.7+ only (I'm not sure how this is properly handled when compiled against an earlier SDK).
Commenting out the problematic line leads to
CC build/SDL_cocoaopengl.lo /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/video/cocoa/SDL_cocoaopengl.m:157:61: error: use of undeclared identifier 'NSAppKitVersionNumber10_6'; did you mean 'NSAppKitVersionNumber'? SDL_bool lion_or_later = floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6; ^~~~~~~~~~~~~~~~~~~~~~~~~ NSAppKitVersionNumber /System/Library/Frameworks/AppKit.framework/Headers/NSApplication.h:21:28: note: 'NSAppKitVersionNumber' declared here APPKIT_EXTERN const double NSAppKitVersionNumber; ^ /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/video/cocoa/SDL_cocoaopengl.m:180:48: error: use of undeclared identifier 'NSOpenGLProfileVersionLegacy' NSOpenGLPixelFormatAttribute profile = NSOpenGLProfileVersionLegacy; ^ /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/video/cocoa/SDL_cocoaopengl.m:182:23: error: use of undeclared identifier 'NSOpenGLProfileVersion3_2Core' profile = NSOpenGLProfileVersion3_2Core; ^ /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/video/cocoa/SDL_cocoaopengl.m:184:21: error: use of undeclared identifier 'NSOpenGLPFAOpenGLProfile' attr[i++] = NSOpenGLPFAOpenGLProfile; ^ /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/video/cocoa/SDL_cocoaopengl.m:333:33: warning: instance method '-convertRectToBacking:' not found (return type defaults to 'id') [-Wobjc-method-access] viewport = [contentView convertRectToBacking:viewport]; ^~~~~~~~~~~~~~~~~~~~ /System/Library/Frameworks/AppKit.framework/Headers/NSView.h:122:12: note: receiver is instance of class declared here @interface NSView : NSResponder ^ /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/video/cocoa/SDL_cocoaopengl.m:333:18: error: assigning to 'NSRect' (aka 'struct CGRect') from incompatible type 'id' viewport = [contentView convertRectToBacking:viewport]; ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning and 5 errors generated. make: *** [build/SDL_cocoaopengl.lo] Error 1
thrown by
/* This gives us the correct viewport for a Retina-enabled view, only * supported on 10.7+. */ if ([contentView respondsToSelector:@selector(convertRectToBacking:)]) { viewport = [contentView convertRectToBacking:viewport]; }
Commenting out the assignment leads to
CC build/SDL_cocoaopengl.lo /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/video/cocoa/SDL_cocoaopengl.m:157:61: error: use of undeclared identifier 'NSAppKitVersionNumber10_6'; did you mean 'NSAppKitVersionNumber'? SDL_bool lion_or_later = floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6; ^~~~~~~~~~~~~~~~~~~~~~~~~ NSAppKitVersionNumber /System/Library/Frameworks/AppKit.framework/Headers/NSApplication.h:21:28: note: 'NSAppKitVersionNumber' declared here APPKIT_EXTERN const double NSAppKitVersionNumber; ^ /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/video/cocoa/SDL_cocoaopengl.m:180:48: error: use of undeclared identifier 'NSOpenGLProfileVersionLegacy' NSOpenGLPixelFormatAttribute profile = NSOpenGLProfileVersionLegacy; ^ /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/video/cocoa/SDL_cocoaopengl.m:182:23: error: use of undeclared identifier 'NSOpenGLProfileVersion3_2Core' profile = NSOpenGLProfileVersion3_2Core; ^ /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/video/cocoa/SDL_cocoaopengl.m:184:21: error: use of undeclared identifier 'NSOpenGLPFAOpenGLProfile' attr[i++] = NSOpenGLPFAOpenGLProfile; ^ 4 errors generated. make: *** [build/SDL_cocoaopengl.lo] Error 1
thrown by
SDL_bool lion_or_later = floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6; ... /* specify a profile if we're on Lion (10.7) or later. */ if (lion_or_later) { NSOpenGLPixelFormatAttribute profile = NSOpenGLProfileVersionLegacy; if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_CORE) { profile = NSOpenGLProfileVersion3_2Core; } attr[i++] = NSOpenGLPFAOpenGLProfile; attr[i++] = profile; }
which can temporary/naively be replaced by
SDL_bool lion_or_later = false;
and commenting out the block that asks for Lion.
Then the same story repeats with
CC build/SDL_cocoavideo.lo /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/video/cocoa/SDL_cocoavideo.m:153:59: error: use of undeclared identifier 'NSAppKitVersionNumber10_6'; did you mean 'NSAppKitVersionNumber'? data->allow_spaces = ((floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) && SDL_GetHintBoolean(SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES, SDL_TRUE)); ^~~~~~~~~~~~~~~~~~~~~~~~~ NSAppKitVersionNumber /System/Library/Frameworks/AppKit.framework/Headers/NSApplication.h:21:28: note: 'NSAppKitVersionNumber' declared here APPKIT_EXTERN const double NSAppKitVersionNumber; ^ /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/video/cocoa/SDL_cocoavideo.m:156:65: error: use of undeclared identifier 'NSAppKitVersionNumber10_6'; did you mean 'NSAppKitVersionNumber'? data->screensaver_use_iopm = floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6; ^~~~~~~~~~~~~~~~~~~~~~~~~ NSAppKitVersionNumber /System/Library/Frameworks/AppKit.framework/Headers/NSApplication.h:21:28: note: 'NSAppKitVersionNumber' declared here APPKIT_EXTERN const double NSAppKitVersionNumber; ^ 2 errors generated. make: *** [build/SDL_cocoavideo.lo] Error 1
from
data->allow_spaces = ((floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) && SDL_GetHintBoolean(SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES, SDL_TRUE)); /* The IOPM assertion API can disable the screensaver as of 10.7. */ data->screensaver_use_iopm = floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6;
The naive approach is again
data->allow_spaces = false; data->screensaver_use_iopm = false;
The fun continues:
CC build/SDL_cocoawindow.lo /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/video/cocoa/SDL_cocoawindow.m:26:3: error: SDL for Mac OS X must be built with a 10.7 SDK or above. # error SDL for Mac OS X must be built with a 10.7 SDK or above. ^ /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/video/cocoa/SDL_cocoawindow.m:56:34: error: cannot find protocol declaration for 'NSDraggingDestination' @interface SDLWindow : NSWindow <NSDraggingDestination> ^ /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/video/cocoa/SDL_cocoawindow.m:287:93: error: use of undeclared identifier 'NSWindowDidChangeBackingPropertiesNotification'; did you mean 'NSWindowDidChangeScreenProfileNotification'? [center addObserver:self selector:@selector(windowDidChangeBackingProperties:) name:NSWindowDidChangeBackingPropertiesNotification object:window]; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ NSWindowDidChangeScreenProfileNotification /System/Library/Frameworks/AppKit.framework/Headers/NSWindow.h:726:25: note: 'NSWindowDidChangeScreenProfileNotification' declared here APPKIT_EXTERN NSString *NSWindowDidChangeScreenProfileNotification AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; ^ /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/video/cocoa/SDL_cocoawindow.m:288:86: error: use of undeclared identifier 'NSWindowWillEnterFullScreenNotification' [center addObserver:self selector:@selector(windowWillEnterFullScreen:) name:NSWindowWillEnterFullScreenNotification object:window]; ^ /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/video/cocoa/SDL_cocoawindow.m:289:85: error: use of undeclared identifier 'NSWindowDidEnterFullScreenNotification'; did you mean 'NSWindowDidChangeScreenNotification'? [center addObserver:self selector:@selector(windowDidEnterFullScreen:) name:NSWindowDidEnterFullScreenNotification object:window]; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ NSWindowDidChangeScreenNotification /System/Library/Frameworks/AppKit.framework/Headers/NSWindow.h:712:25: note: 'NSWindowDidChangeScreenNotification' declared here APPKIT_EXTERN NSString *NSWindowDidChangeScreenNotification; ^ /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/video/cocoa/SDL_cocoawindow.m:290:85: error: use of undeclared identifier 'NSWindowWillExitFullScreenNotification' [center addObserver:self selector:@selector(windowWillExitFullScreen:) name:NSWindowWillExitFullScreenNotification object:window]; ^ /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/video/cocoa/SDL_cocoawindow.m:291:84: error: use of undeclared identifier 'NSWindowDidExitFullScreenNotification'; did you mean 'NSWindowDidChangeScreenNotification'? [center addObserver:self selector:@selector(windowDidExitFullScreen:) name:NSWindowDidExitFullScreenNotification object:window]; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ NSWindowDidChangeScreenNotification /System/Library/Frameworks/AppKit.framework/Headers/NSWindow.h:712:25: note: 'NSWindowDidChangeScreenNotification' declared here APPKIT_EXTERN NSString *NSWindowDidChangeScreenNotification; ^ /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/video/cocoa/SDL_cocoawindow.m:382:37: error: use of undeclared identifier 'NSWindowCollectionBehaviorFullScreenPrimary'; did you mean 'NSWindowCollectionBehaviorStationary'? [nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ NSWindowCollectionBehaviorStationary /System/Library/Frameworks/AppKit.framework/Headers/NSWindow.h:96:2: note: 'NSWindowCollectionBehaviorStationary' declared here NSWindowCollectionBehaviorStationary = 1 << 4, // unaffected by exposé. Stays visible and stationary, like desktop window ^ /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/video/cocoa/SDL_cocoawindow.m:418:42: error: use of undeclared identifier 'NSWindowDidChangeBackingPropertiesNotification'; did you mean 'NSWindowDidChangeScreenProfileNotification'? [center removeObserver:self name:NSWindowDidChangeBackingPropertiesNotification object:window]; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ NSWindowDidChangeScreenProfileNotification /System/Library/Frameworks/AppKit.framework/Headers/NSWindow.h:726:25: note: 'NSWindowDidChangeScreenProfileNotification' declared here APPKIT_EXTERN NSString *NSWindowDidChangeScreenProfileNotification AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER; ^ /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/video/cocoa/SDL_cocoawindow.m:419:42: error: use of undeclared identifier 'NSWindowWillEnterFullScreenNotification' [center removeObserver:self name:NSWindowWillEnterFullScreenNotification object:window]; ^ /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/video/cocoa/SDL_cocoawindow.m:420:42: error: use of undeclared identifier 'NSWindowDidEnterFullScreenNotification'; did you mean 'NSWindowDidChangeScreenNotification'? [center removeObserver:self name:NSWindowDidEnterFullScreenNotification object:window]; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ NSWindowDidChangeScreenNotification /System/Library/Frameworks/AppKit.framework/Headers/NSWindow.h:712:25: note: 'NSWindowDidChangeScreenNotification' declared here APPKIT_EXTERN NSString *NSWindowDidChangeScreenNotification; ^ /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/video/cocoa/SDL_cocoawindow.m:421:42: error: use of undeclared identifier 'NSWindowWillExitFullScreenNotification' [center removeObserver:self name:NSWindowWillExitFullScreenNotification object:window]; ^ /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/video/cocoa/SDL_cocoawindow.m:422:42: error: use of undeclared identifier 'NSWindowDidExitFullScreenNotification'; did you mean 'NSWindowDidChangeScreenNotification'? [center removeObserver:self name:NSWindowDidExitFullScreenNotification object:window]; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ NSWindowDidChangeScreenNotification /System/Library/Frameworks/AppKit.framework/Headers/NSWindow.h:712:25: note: 'NSWindowDidChangeScreenNotification' declared here APPKIT_EXTERN NSString *NSWindowDidChangeScreenNotification; ^ /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/video/cocoa/SDL_cocoawindow.m:626:65: error: use of undeclared identifier 'NSBackingPropertyOldScaleFactorKey' NSNumber *oldscale = [[aNotification userInfo] objectForKey:NSBackingPropertyOldScaleFactorKey]; ^ /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/video/cocoa/SDL_cocoawindow.m:632:52: warning: instance method '-backingScaleFactor' not found (return type defaults to 'id') [-Wobjc-method-access] if ([oldscale doubleValue] != [_data->nswindow backingScaleFactor]) { ^~~~~~~~~~~~~~~~~~ /System/Library/Frameworks/AppKit.framework/Headers/NSWindow.h:156:12: note: receiver is instance of class declared here @interface NSWindow : NSResponder ^ /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/video/cocoa/SDL_cocoawindow.m:632:32: error: invalid operands to binary expression ('double' and 'id') if ([oldscale doubleValue] != [_data->nswindow backingScaleFactor]) { ~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/video/cocoa/SDL_cocoawindow.m:740:45: error: use of undeclared identifier 'NSWindowCollectionBehaviorFullScreenPrimary'; did you mean 'NSWindowCollectionBehaviorStationary'? [nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ NSWindowCollectionBehaviorStationary /System/Library/Frameworks/AppKit.framework/Headers/NSWindow.h:96:2: note: 'NSWindowCollectionBehaviorStationary' declared here NSWindowCollectionBehaviorStationary = 1 << 4, // unaffected by exposé. Stays visible and stationary, like desktop window ^ /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/video/cocoa/SDL_cocoawindow.m:764:16: error: use of undeclared identifier 'NSApplicationPresentationFullScreen' return NSApplicationPresentationFullScreen | NSApplicationPresentationHideDock | NSApplicationPresentationHideMenuBar; ^ /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/video/cocoa/SDL_cocoawindow.m:1255:51: error: use of undeclared identifier 'NSAppKitVersionNumber10_6'; did you mean 'NSAppKitVersionNumber'? SDL_assert(floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6); ^~~~~~~~~~~~~~~~~~~~~~~~~ NSAppKitVersionNumber include/SDL_assert.h:167:54: note: expanded from macro 'SDL_assert' # define SDL_assert(condition) SDL_disabled_assert(condition) ^ include/SDL_assert.h:98:26: note: expanded from macro 'SDL_disabled_assert' do { (void) sizeof ((condition)); } while (SDL_NULL_WHILE_LOOP_CONDITION) ^ /System/Library/Frameworks/AppKit.framework/Headers/NSApplication.h:21:28: note: 'NSAppKitVersionNumber' declared here APPKIT_EXTERN const double NSAppKitVersionNumber; ^ /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/video/cocoa/SDL_cocoawindow.m:1260:45: error: use of undeclared identifier 'NSWindowCollectionBehaviorFullScreenPrimary'; did you mean 'NSWindowCollectionBehaviorStationary'? [nswindow setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ NSWindowCollectionBehaviorStationary /System/Library/Frameworks/AppKit.framework/Headers/NSWindow.h:96:2: note: 'NSWindowCollectionBehaviorStationary' declared here NSWindowCollectionBehaviorStationary = 1 << 4, // unaffected by exposé. Stays visible and stationary, like desktop window ^ /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/video/cocoa/SDL_cocoawindow.m:1271:26: warning: instance method '-setWantsBestResolutionOpenGLSurface:' not found (return type defaults to 'id') [-Wobjc-method-access] [contentView setWantsBestResolutionOpenGLSurface:YES]; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5/src/video/cocoa/SDL_cocoawindow.m:1067:12: note: receiver is instance of class declared here @interface SDLView : NSView { ^ 2 warnings and 19 errors generated. make: *** [build/SDL_cocoawindow.lo] Error 1 make: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5' Command failed: cd "/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.5" && /usr/bin/make -w all Exit code: 2
starting from src/video/cocoa/SDL_cocoawindow.m
at
#if MAC_OS_X_VERSION_MAX_ALLOWED < 1070 # error SDL for Mac OS X must be built with a 10.7 SDK or above. #endif /* MAC_OS_X_VERSION_MAX_ALLOWED < 1070 */
The bad news is that this leaves 19 errors that I didn't try to investigate yet. The good news is that this might be the last file that needs any patching (at least all other files with cocoa
in their name were compiled successfully).
comment:10 Changed 8 years ago by dliessi (Davide Liessi)
Cc: | dliessi added |
---|
comment:11 follow-up: 13 Changed 8 years ago by ken-cunningham-webuse
Replying to jmroot:
If we need to add a compiler blacklist here as per PR#5, I imagine it would be needed when actually building on 10.7 as well. Might need some more testing to find out exactly which compiler versions work.
I didn't try on 10.7 - but the libsdl2 docs indicate it will build on a stock 10.7 system, so whatever clang version that represents would appear to be good enough. I suppose we might just check if the 10.7 buildbot built it, and that would answer the question.
As to which clang -- I set the bar at 211, and that pulled in clang-3.4, which worked. As per other macports documentation, that test would appear to be sufficient, and plumbing the bottom didn't seem to be worth the time it would take to explicitly figure it out.
To be honest, I would personally be inclined to set the bar such that clang-3.7 was pulled in (I think all 10.6 users should be using that, if they are going to pull in anything at all), but here I'm deferring to other admins who felt that wasn't the right thing to do.
comment:12 Changed 8 years ago by ken-cunningham-webuse
Oh - Mojca -- what a great effort! Thanks.
Re: gcc -- I can't see any newer gcc working - the last one that spoke "Apple" even half-decently was 4.2, and that doesn't work. -- Best, Ken
comment:13 follow-up: 14 Changed 8 years ago by jmroot (Joshua Root)
Replying to ken-cunningham-webuse:
I didn't try on 10.7 - but the libsdl2 docs indicate it will build on a stock 10.7 system, so whatever clang version that represents would appear to be good enough.
Is that a stock 10.7 system with Xcode 4.1 or one with Xcode 4.6.3? The former uses llvm-gcc-4.2.
To be honest, I would personally be inclined to set the bar such that clang-3.7 was pulled in (I think all 10.6 users should be using that, if they are going to pull in anything at all), but here I'm deferring to other admins who felt that wasn't the right thing to do.
That isn't how compiler selection works. You get the first compiler in the fallback list that is available and not blacklisted.
comment:14 follow-up: 15 Changed 8 years ago by ken-cunningham-webuse
Replying to jmroot:
Is that a stock 10.7 system with Xcode 4.1 or one with Xcode 4.6.3? The former uses llvm-gcc-4.2.
I wish I knew how to quickly check the buildbot for you and answer that. I haven't spent much time with 10.7, although I do have it installed and could go there (once about 36 hours of Jeremy's compiler updates finish building on 10.6!)
That isn't how compiler selection works. You get the first compiler in the fallback list that is available and not blacklisted.
I think I see -- I meant that I personally would have blacklisted { clang < whatever-clang-3.7-is
} and skipped pulling in clang-3.4, if it were up to me.
comment:15 follow-up: 16 Changed 8 years ago by jmroot (Joshua Root)
Replying to ken-cunningham-webuse:
Replying to jmroot:
Is that a stock 10.7 system with Xcode 4.1 or one with Xcode 4.6.3? The former uses llvm-gcc-4.2.
I wish I knew how to quickly check the buildbot for you and answer that. I haven't spent much time with 10.7, although I do have it installed and could go there (once about 36 hours of Jeremy's compiler updates finish building on 10.6!)
The point is we don't write Portfiles to run only on the buildbot.
That isn't how compiler selection works. You get the first compiler in the fallback list that is available and not blacklisted.
I think I see -- I meant that I personally would have blacklisted { clang <
whatever-clang-3.7-is
} and skipped pulling in clang-3.4, if it were up to me.
'clang' means the system clang. It's either used or not. If not, the next compiler in the fallback list is used. That is macports-clang-3.4 because clang 3.5+ requires libc++.
comment:16 Changed 8 years ago by ken-cunningham-webuse
Replying to jmroot:
That is macports-clang-3.4 because clang 3.5+ requires libc++.
Ah, thanks, of course - now I fully understand why it has to fallback to clang-3.4 and no higher on stock (i.e. not upgraded with LibcxxOnOlderSystems) systems. I appreciate your taking the time to explain that.
comment:17 Changed 8 years ago by jeremyhu (Jeremy Huddleston Sequoia)
include/SDL_syswm.h:230 does
#if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc)
That's clearly a bug in libsdl that has nothing to do with the 10.7 SDK. They need to check if __has_feature
is defined *BEFORE* using it, not in the same line. This should be:
#if defined(__OBJC__) && defined(__has_feature) # if __has_feature(objc_arc) # endif #endif
---
Your NSAppKitVersionNumber10_6 fix looks good. It can also be defined locally if it isn't available. Upstream should probably do:
#ifndef NSAppKitVersionNumber10_6 #define NSAppKitVersionNumber10_6 1038 #endif
I suggest just we just do:
platform darwin { if {${os.major} < 11} { configure.cppflags-append -DNSAppKitVersionNumber10_6=1038 } }
---
For the IOPMAssertionCreateWithDescription issue, you can do:
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 #if __MAC_OS_X_VERSION_MIN_REQUIRED < 1070 if (& IOPMAssertionCreateWithDescription) #endif IOPMAssertionCreateWithDescription(...); #endif
---
Your -convertRectToScreen
fix looks good.
---
I'll check the others later.
comment:18 Changed 8 years ago by ryandesign (Ryan Carsten Schmidt)
The MacOSX10.7 SDK from Xcode 4.6.3 is on the 10.6 buildbot workers now. The build still fails, perhaps because gcc and old clang haven't been blacklisted as suggested in this PR.
comment:20 Changed 8 years ago by mojca (Mojca Miklavec)
I committed the patch that blacklists the compilers and the two builds on 10.6 seem to have succeeded:
Thanks.
I would suggest to rename this particular ticket into something like "an attempt to make the port build without the 10.7 SDK".
Your
-convertRectToScreen
fix looks good.
It's not a fix. It's part of the code that throws an error and had to be commented out :)
comment:21 Changed 8 years ago by jeremyhu (Jeremy Huddleston Sequoia)
It's not a fix. It's part of the code that throws an error and had to be commented out :)
Oh, I just assumed you added the respondsToSelector:bits.
You'll want to do something like:
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 if ([window respondsToSelector:@selector(convertRectToScreen:)]) { rect = [window convertRectToScreen:rect]; } else { rect.origin = [window convertBaseToScreen:rect.origin]; } #else rect.origin = [window convertBaseToScreen:rect.origin]; #endif
comment:22 Changed 8 years ago by mojca (Mojca Miklavec)
Thank you. I believe I should be able to fix all problems now, but the number of issues with SDL_cocoawindow.m
is still pretty high (and lower on the priority list).
Btw: we now have #!objc
syntax working. If you put this on top, you get proper syntax highlighting :)
comment:23 Changed 8 years ago by jmroot (Joshua Root)
The reporter's issue has been resolved by merging the PR. These fixes should be sent upstream, but I'm not sure there's a lot of value in patching the port further at this stage.
comment:24 Changed 8 years ago by mojca (Mojca Miklavec)
Which fixes (for sending upstream) do you mean? We should either provide a full patch that would allow building against 10.6 SDK or no patch at all. The patch that complicates the source code without allowing to build against 10.6 SDK doesn't really serve anyone.
comment:25 Changed 8 years ago by jmroot (Joshua Root)
Yes, I agree entirely. I thought you were close to a full patch.
comment:26 Changed 8 years ago by mojca (Mojca Miklavec)
I fixed (or know how to fix) approximately 9 errors in 4 files, but there are 19 more in the last file that I didn't yet look into. They are probably straightforward to fix though.
I just didn't get the "fixes should be sent upstream" vs. "there's no value in patching any further" because those two statements seem to conflict with each other. I don't know if upstream would accept patches. It's slightly less relevant for us now that Ryan fixed the issue on the buildbot, but it might still be valuable if users could build from source out-of-the-box. What is not clear to me is how much maintenance burden patching might introduce in the future in case upstream rejects the patches. I would say that it might be worth trying with to get the patches upstream (with some low priority) or at least ask them for opinion upfront.
comment:27 Changed 8 years ago by jmroot (Joshua Root)
Let me put it this way: Try to get the patches accepted upstream. If they are, we can just remove the workarounds next release. If upstream isn't interested, we can look at whether we want to maintain a patch set.
comment:28 Changed 8 years ago by mojca (Mojca Miklavec)
They answered that accepting patches
would be fine as long as it doesn't introduce any regressions or significant code complexity
I would say that's a good sign to proceed.
comment:29 Changed 8 years ago by mojca (Mojca Miklavec)
Keywords: | snowleopard added |
---|---|
Summary: | libsdl2 can build on 10.6, but instructions a bit vague → libsdl2: make it build on 10.6 (against 10.6 SDK) |
comment:30 Changed 8 years ago by mojca (Mojca Miklavec)
Description: | modified (diff) |
---|
You observations sound correct, but I'm not thrilled about asking users to modify the contents of /Developer/SDKs. As far as I know, Apple does not provide a sanctioned way of having the 10.7 SDK on 10.6, and MacPorts currently doesn't do anything to advocate circumventing that.