Opened 8 years ago
Last modified 7 months ago
#52210 new defect
libsdl2: make it build on 10.6 (against 10.6 SDK)
Reported by: | kenneth.f.cunningham@… | Owned by: | jmroot (Joshua Root) |
---|---|---|---|
Priority: | Low | Milestone: | |
Component: | ports | Version: | |
Keywords: | snowleopard | Cc: | ryandesign (Ryan Carsten Schmidt), mojca (Mojca Miklavec), jeremyhu (Jeremy Huddleston Sequoia), dliessi (Davide Liessi), udbraumann, Raptor007 (Raptor007), evanmiller (Evan Miller), mascguy (Christopher Nielsen) |
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.
Attachments (12)
Change History (89)
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) |
---|
comment:31 Changed 8 years ago by jeremyhu (Jeremy Huddleston Sequoia)
mojca, can you push what you've got later today? If I have time this weekend, I'll take a closer look as well.
comment:32 Changed 8 years ago by udbraumann
Cc: | udbraumann added |
---|
comment:33 follow-up: 34 Changed 8 years ago by udbraumann
Though presently the focus is on building libsdl2
on 10.6.8, is it likely that 10.5.8 will never get it?
comment:34 Changed 8 years ago by jmroot (Joshua Root)
Replying to udbraumann:
Though presently the focus is on building
libsdl2
on 10.6.8, is it likely that 10.5.8 will never get it?
Unclear. The official binaries say they're built with a 10.5 deployment target, but there would likely be more fixes needed to build there due to SDK differences.
comment:35 Changed 8 years ago by kencu (Ken)
Here is something interesting along these lines, perhaps.
patch to compile SDL2 on Mac OS X 10.5 Leopard
this version was written against SLD2 2.0.3 it appears.
<https://gist.github.com/miniupnp/a8f474c504eaa3ad9135>
also, this project has a downloadable framework version of libsdl2 (between 2.0 and 2.1, says the info) is a fat binary with x86_64, i386, and PPC code that is apparently compatible back to 10.4. patches are also included in a directory.
<https://github.com/bitfighter/bitfighter>
Here a topic on the libsdl forums that is trying to maintain/ restore backwards compatibility:
<http://forums.libsdl.org/viewtopic.php?t=9842&sid=ec0463236bc80e762cc1f1b0ea2ab058>
comment:36 Changed 8 years ago by mojca (Mojca Miklavec)
I almost forgot about this ticket. I didn't check the patches for include/SDL_config.h
yet, but the rest seems like completely reasonable patching.
The patch uses
#if MAC_OS_X_VERSION_MIN_REQUIRED
while Jeremy suggested
#if __MAC_OS_X_VERSION_MAX_ALLOWED
I always mix up the difference between the two (the idea is mostly the same, just different use case) and I guess Jeremy knows better.
Thanks a lot for the good news. It probably makes sense to test that patch (and perhaps look at my observations above), first on 10.6, then on 10.5, and submit it upstream.
comment:37 Changed 7 years ago by kencu (Ken)
I have libsdl2 working now, on 10.5 PPC, using the patches referenced above. 10.4 PPC can be next - there is a patch for that too.
It is version 2.0.3 - not sure how practical it is to try for 2.0.4. Version 2.0.5 seems difficult to enable for 10.5 PPC, although I haven't tried it using the guidance of this patch for reference.
I'm not sure the (smallish) changes required to the portfile would be acceptable for the general macports repo. I'll put it in my LeopardPorts repo until we see what jmr thinks about the whole situation.
Changed 7 years ago by kencu (Ken)
libsdl2 2.0.3 Portfile - for 10.4 and 10.5 PPC
Changed 7 years ago by kencu (Ken)
Attachment: | patch-SDL2-2.0.3_OSX_104.diff added |
---|
Changed 7 years ago by kencu (Ken)
Attachment: | patch-SDL2-2.0.3_OSX_105.diff added |
---|
comment:38 Changed 7 years ago by snigel
@kencu tried to install the Portfile and diff file manually:
Error: No checksum set for patch-SDL2-2.0.3_OSX_105.diff Error: No checksum set for SDL2-2.0.3.tar.gz
Can I ignore checksum with a flag to ports? Or should it be added to the ports file?
comment:39 Changed 7 years ago by kencu (Ken)
Hi. A fully fixed-up version of this for Leopard is available in this repo: <https://github.com/kencu/LeopardPorts> and a similar one in <https://github.com/kencu/TigerPorts> for Tiger. Other Leopard and Tiger fixes are in there too, mostly focused on PPC.
So far, libsdl2 2.0.3 is as far as we've come, but it's not impossible that some newer version might become available some day.
If you're not quite sure how to use a local repository, see <https://guide.macports.org/chunked/development.local-repositories.html>.
Make sure you clone it somewhere usable, like /opt/LeopardPorts
or /Users/Shared/LeopardPorts
, otherwise you'll probably get permissions issues.
Changed 6 years ago by miniupnp (Thomas BERNARD)
Attachment: | SDL2-2.0.4_OSX_105.patch added |
---|
patch to compile SDL2-2.0.4 under OS X 10.5.8 Leopard
Changed 6 years ago by miniupnp (Thomas BERNARD)
Attachment: | SDL2-2.0.5_OSX_105.patch added |
---|
patch to compile SDL2.0.5 on OS X 10.5 Leopard
comment:41 Changed 6 years ago by miniupnp (Thomas BERNARD)
the patch need more testing, but that a good base ;)
Changed 6 years ago by miniupnp (Thomas BERNARD)
Attachment: | SDL2-2.0.6_OSX_105.patch added |
---|
Patch to build SDL 2.0.6 on OS X 10.5.8 leopard
Changed 6 years ago by miniupnp (Thomas BERNARD)
Attachment: | SDL2-2.0.7_OSX_105.patch added |
---|
Patch to build SDL 2.0.7 on OS X 10.5.8 leopard
Changed 6 years ago by miniupnp (Thomas BERNARD)
Attachment: | SDL2-2.0.8_OSX_105.patch added |
---|
Patch to build SDL 2.0.8 on OS X 10.5.8 leopard
comment:42 Changed 6 years ago by miniupnp (Thomas BERNARD)
Changed 6 years ago by miniupnp (Thomas BERNARD)
Attachment: | SDL2-2.0.6_OSX_104.patch added |
---|
Patch to build SDL 2.0.6 on Tiget 10.4.11 - tested to work !
Changed 6 years ago by miniupnp (Thomas BERNARD)
Attachment: | SDL2_image-2.0.2_OSX_104.patch added |
---|
bonus : patch for SDL2_image to build under Tiger
comment:43 Changed 6 years ago by miniupnp (Thomas BERNARD)
@kencu I spent too much time on this one, but now I have a working SDL 2.0.6 on my Tiger PPC Mac !
comment:44 Changed 6 years ago by kencu (Ken)
Thomas, that's great! With any luck, having this version of libsdl2 will keep the PPC machines in action for many years to come -- one day the power supplies will all dry up and die, and parts will be too scarce to find. In the meantime, WooHoo! Thanks.
comment:46 Changed 6 years ago by Raptor007 (Raptor007)
Are any tricks required for 10.6.8 now other than installing MacOSX10.7.sdk? Mine is still failing to build:
:info:build libtool: compile: /opt/local/bin/clang-mp-3.4 -Os -isysroot/Developer/SDKs/MacOSX10.7.sdk -arch x86_64 -arch i386 -I/opt/local/include -isysroot/Developer/SDKs/MacOSX10.7.sdk -DUSING_GENERATED_CONFIG_H -Iinclude -I/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.8/include -idirafter /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.8/src/video/khronos -mmmx -msse -msse2 -msse3 -Wall -DTARGET_API_MAC_CARBON -DTARGET_API_MAC_OSX -fvisibility=hidden -Wdeclaration-after-statement -Werror=declaration-after-statement -D_THREAD_SAFE -c /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.8/src/video/cocoa/SDL_cocoavideo.m -o build/SDL_cocoavideo.o >/dev/null 2>&1 :info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.8/src/video/cocoa/SDL_cocoawindow.m:317:93: error: use of undeclared identifier 'NSWindowDidChangeBackingPropertiesNotification'; did you mean 'NSWindowDidChangeScreenProfileNotification'? :info:build [center addObserver:self selector:@selector(windowDidChangeBackingProperties:) name:NSWindowDidChangeBackingPropertiesNotification object:window]; :info:build ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :info:build NSWindowDidChangeScreenProfileNotification :info:build /Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSWindow.h:786:25: note: 'NSWindowDidChangeScreenProfileNotification' declared here :info:build APPKIT_EXTERN NSString *NSWindowDidChangeScreenProfileNotification ; :info:build ^ :info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.8/src/video/cocoa/SDL_cocoawindow.m:448:42: error: use of undeclared identifier 'NSWindowDidChangeBackingPropertiesNotification'; did you mean 'NSWindowDidChangeScreenProfileNotification'? :info:build [center removeObserver:self name:NSWindowDidChangeBackingPropertiesNotification object:window]; :info:build ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ :info:build NSWindowDidChangeScreenProfileNotification :info:build /Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSWindow.h:786:25: note: 'NSWindowDidChangeScreenProfileNotification' declared here :info:build APPKIT_EXTERN NSString *NSWindowDidChangeScreenProfileNotification ; :info:build ^ :info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_devel_libsdl2/libsdl2/work/SDL2-2.0.8/src/video/cocoa/SDL_cocoawindow.m:661:65: error: use of undeclared identifier 'NSBackingPropertyOldScaleFactorKey' :info:build NSNumber *oldscale = [[aNotification userInfo] objectForKey:NSBackingPropertyOldScaleFactorKey]; :info:build ^ :info:build 3 errors generated. :info:build make: *** [build/SDL_cocoawindow.lo] Error 1
comment:47 Changed 6 years ago by kencu (Ken)
I just built it on 10.6.8 without any trouble, and I see the buildbots have built every version. So, we have a puzzle. I would clean and rebuild, and submit the full log if it fails. Must be something.
comment:48 Changed 6 years ago by kencu (Ken)
Just out of curiosity, you have a real MacOSX10.7.sdk, right? Not just a symlink to the 10.6 sdk or something similar? I know, stupid question. Anyway, I'll put up my last build log FYI.
Changed 6 years ago by kencu (Ken)
Attachment: | libsdl2.0.8-10.6.8-success.log.zip added |
---|
Changed 6 years ago by Raptor007 (Raptor007)
sudo port install libsdl2 +universal configure.compiler=macports-clang-3.9
comment:49 Changed 6 years ago by Raptor007 (Raptor007)
It's not a stupid question; I had to check because it's been a while since I set that up. It's not a symlink and the contents differ from the 10.6 SDK, so I think it's the real thing. For example:
$ diff /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSWindow.h /Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSWindow.h | head -4 4c4 < Copyright (c) 1994-2009, Apple Inc. --- > Copyright (c) 1994-2011, Apple Inc.
I notice in your log that you have Xcode 4.2 where I have 4.0.2, but I'm not sure if that's relevant since it isn't where the 10.7 SDK comes from, and we're both using MacPorts Clang 3.9.
comment:50 Changed 6 years ago by Raptor007 (Raptor007)
Cc: | Raptor007 added |
---|
comment:51 Changed 6 years ago by kencu (Ken)
My working theory here is that you don't have the most up to date MacOS10.7.sdk. Perhaps yours is not the 10.7.5 version. Just trying now to confirm if that is true, but I don't have a better explanation at the moment.
comment:52 Changed 6 years ago by kencu (Ken)
I think that's it -- your 10.7 SDK is not the last. I have this in my
/Developer/SDKs/MacOSX10.7.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSWindow.h
/* NSWindowDidChangeBackingPropertiesNotification is posted on 10.7.3 and later, when a window's backingScaleFactor and/or its colorSpace changes. When runing on a system version where this new notification is available, applications should use it instead of NSWindowDidChangeScreenProfileNotification to watch for changes to either of these backing store properties. Many applications won't have any need to watch for this notification, but those that perform sophisticated color handling or manually manage their own caches of window-resolution-and/or/colorspace-appropriate bitmapped images will find this notification useful, as a prompt to invalidate their caches or schedule other reassessment for the new resolution and/or color space as needed. The notification's userInfo dictionary specifies the window's previous backingScaleFactor and colorSpace. You can compare these with the window's new backingScaleFactor and colorSpace at the time of the notification, to determine which of these two properties (potentially both) changed. */ APPKIT_EXTERN NSString * const NSWindowDidChangeBackingPropertiesNotification NS_AVAILABLE_MAC(10_7); // added in 10.7.3; userInfo keys: NSBackingPropertyOldScaleFactorKey, NSBackingPropertyOldColorSpaceKey APPKIT_EXTERN NSString * const NSBackingPropertyOldScaleFactorKey NS_AVAILABLE_MAC(10_7); // added in 10.7.3; an NSNumber APPKIT_EXTERN NSString * const NSBackingPropertyOldColorSpaceKey NS_AVAILABLE_MAC(10_7); // added in 10.7.3; an NSColorSpace
comment:53 Changed 6 years ago by Raptor007 (Raptor007)
I think you're right. My copy of NSWindow.h doesn't have those lines. Perhaps the warning should be more specific about requiring SDK version 10.7.3 or later.
Where would you get a proper 10.7.5 SDK today? One of my many gripes about the App Store is that as new versions are released old ones are no longer available, and one of my many gripes about Xcode is that it's only released through limited channels such as the App Store.
I tried these sources, but neither has the new definitions in NSWindow.h required by libsdl2: https://github.com/phracker/MacOSX-SDKs https://github.com/AaronWallace/MacOSX_SDKs
I could get a little farther in the build process by adding those lines from your comment to my NSWindow.h, but unsurprisingly it failed to find those symbols when linking.
comment:54 Changed 6 years ago by Raptor007 (Raptor007)
I found it! You need an Apple account, but you do NOT paid App Store developer credentials:
https://developer.apple.com/download/more/
Download "Xcode 4.3.3 for Lion", then right-click that Xcode.app and Show Package Contents, then browse to Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs and you'll find a copy of MacOSX10.7.sdk that's new enough to build libsdl2.
Thanks for pointing me in the right direction Ken.
comment:56 follow-up: 57 Changed 6 years ago by mrkapqa
Hello , i have done today
sudo port upgrade outdated
and run into error
sudo port upgrade outdated ---> Computing dependencies for libsdl2 ---> Fetching distfiles for libsdl2 Error: Failed to fetch libsdl2: Building libsdl2 @2.0.9 on Mac OS X 10.6 requires the MacOSX10.7.sdk to be present in /Developer/SDKs/ Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_devel_libsdl2/libsdl2/main.log for details. Error: Problem while installing libsdl2
Am i right in assuming that this error can be overcome by downloading the above SDK for Lion 10.7.5? I am running latest MacPorts on Snow Leopard 10.6.8
Thank you
comment:57 Changed 6 years ago by kencu (Ken)
Replying to mrkapqa:
Am i right in assuming that this error can be overcome by downloading the above SDK for Lion 10.7.5? I am running latest MacPorts on Snow Leopard 10.6.8
Yes. See comment:54 above for the link.
comment:58 Changed 6 years ago by mrkapqa
Thanks, copied this folder MacOSX10.7.sdk over into the Directory /Developer/SDKs/, now it is continuing
comment:59 Changed 3 years ago by evanmiller (Evan Miller)
Cc: | evanmiller added |
---|
comment:60 Changed 3 years ago by evanmiller (Evan Miller)
I can report that SDL2-2.0.6_OSX_104.patch
builds on Tiger with --disable-joystick --disable-haptic
. Might be worth packaging up?
comment:61 Changed 3 years ago by kencu (Ken)
I have had a fully-working slightly older libsdl2 for Tiger and Leopard in TigerPorts and LeopardPorts for years, as most know.
https://github.com/kencu/TigerPorts/tree/master/devel/libsdl2
The portfile is quite different (No 10.7 SDK forcing, etc etc etc).
We had some discussions before about how to roll that into MacPorts, but could never come to an agreement about how to cleanly allow the older version and the needed change in patches to be incorporated into the current Portfile without making a total mess of it, so it was voted down.
We talked about perhaps sourcing different Portfiles based on OS version, which would work, but it was pointed out that those would not be properly incorporated into the way portfiles are cached, so could not be considered.
So -- these remain in TigerPorts and LeopardPorts.
A completely new Port, like libsdl2-legacy or something, might be allowed -- I gave up on that a few years back, and just have all of it (and the things that can use this older version) in TigerPorts/LeoapardPorts.
comment:62 Changed 3 years ago by evanmiller (Evan Miller)
I did see your Portfile for 2.0.3, but it lost me at mandatory -faltivec
:-)
If you have a link to the prior discussion I will take a look at the concerns... I think for Tiger at least, 2.0.6 could slide in relatively smoothly. The only remaining patch in the current Portfile is some clang stuff that 10.4/10.5 won't use anyway.
comment:63 Changed 3 years ago by kencu (Ken)
If the mood has somehow changed, it would be reasonable to try to push the changes I've been carrying locally for years and years.
I tried 2.0.6 but it had some major wreckage, by the way -- it was a hope from Thomas it might be OK, but it bombed out badly in practice as the patches did not actually work right. 2.0.3 was the last one that actually seemed to work properly when building most things.
I built dozens of the things with it.
faltivec, if not needed, pops right out, BTW :>
comment:64 Changed 3 years ago by kencu (Ken)
In my fixed libsdl2 for Tiger I also copy in some other headers, etc, to try to get it to work maximally, so more is needed beyond just what you outlined.
comment:65 follow-up: 66 Changed 3 years ago by evanmiller (Evan Miller)
Thanks for the additional context; it's too bad Thomas's patches didn't live up to the hype.
I opened a quick PR to disable Altivec on G3s if you want to take a look: https://github.com/kencu/TigerPorts/pull/12
Building now but I am optimistic.
comment:66 Changed 3 years ago by cesss
Replying to evanmiller:
Thanks for the additional context; it's too bad Thomas's patches didn't live up to the hype.
What do you mean by them not living up to the hype? Don't they let build 2.0.6 on Tiger? I was reading this ticket because I want to build libsdl2 on a Tiger PPC, and the conclusion I got after reading all the messages, seeing two success notices and no failure notice, is that "SDL2-2.0.6_OSX_104.patch" should do the trick (but didn't try it myself yet, though). Or am I mistaken in assuming that?
BTW, Ken's TigerPorts and LeonardPorts github folders seem to have gone away...
comment:67 follow-up: 68 Changed 3 years ago by evanmiller (Evan Miller)
What do you mean by them not living up to the hype? Don't they let build 2.0.6 on Tiger?
I was just going off of kencu's comment... "it bombed out badly in practice as the patches did not actually work right". I have not tested the 2.0.6 patches myself, but have 2.0.3 working locally.
I'm not sure what happened to ken's TigerPorts repo but I have a relatively recent clone here:
comment:68 Changed 3 years ago by cesss
Replying to evanmiller:
What do you mean by them not living up to the hype? Don't they let build 2.0.6 on Tiger?
I was just going off of kencu's comment... "it bombed out badly in practice as the patches did not actually work right". I have not tested the 2.0.6 patches myself, but have 2.0.3 working locally.
Ooops! I read all the comments in the ticket but that line!! Sorry.
I'm not sure what happened to ken's TigerPorts repo but I have a relatively recent clone here:
Thanks a lot!!
comment:69 Changed 2 years ago by barracuda156
I have built 2.0.9 on 10.6 PPC: #64655
Though to fix the latest version, but ran into a bug in gcc: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105522
comment:70 Changed 2 years ago by jmroot (Joshua Root)
Another possibility might be to disable Cocoa video on these systems and use X11.
comment:71 Changed 2 years ago by mascguy (Christopher Nielsen)
Cc: | mascguy added |
---|
comment:72 Changed 2 years ago by mascguy (Christopher Nielsen)
Assuming we can't fix this ASAP, can we please add a fallback to 2.0.22 for 10.6? That would be far more user-friendly, vs. leaving it broken...
comment:73 follow-up: 74 Changed 2 years ago by kencu (Ken)
good plan. josh already fleshed that out in the portfile, if you look there. slightly different idea though, with a legacy port instead of a fallback.
by the way, re this ticket here, I can’t see spending any time trying to fix libsdl2 to build against the 10.6 sdk on 10.6, as there is no point given the 10.7 sdk works fine.
comment:74 Changed 2 years ago by mascguy (Christopher Nielsen)
Replying to kencu:
good plan. josh already fleshed that out in the portfile, if you look there. slightly different idea though, with a legacy port instead of a fallback.
by the way, re this ticket here, I can’t see spending any time trying to fix libsdl2 to build against the 10.6 sdk on 10.6, as there is no point given the 10.7 sdk works fine.
Now that webkit2-gtk
is building for older macOS releases, it's being blocked by this. And given how long it takes to build, it would be really nice if the fallback could be added.
What's the ETA on a short-term fix?
comment:75 Changed 2 years ago by kencu (Ken)
fallback done here [c45d5dcf4f0ab75a1049989ba26cee836ca1ad31/macports-ports]
comment:76 Changed 22 months ago by rmottola (Riccardo)
I have a variation of this today - on 10.5 I actually wonder how it did compile "in the past".. anyway today on 10.5 Leopard ports tries to build libsdl2-snowleopard (would be 10.6) at 2.0.22 and for that one it wants 10.7 SDK :) I guess that's too much on 10.5.
Is the fallback by @kencu only for 10.6 perhaps?
comment:77 Changed 22 months ago by kencu (Ken)
libsdl2-snowleopard is indeed really only for 10.6.
You'd have to make a new port, libsdl2-leopard and set that up to work on leopard using a similar mechanism.
It's easy enough -- the portfiles for it were in my LeopardPorts repo and I still have them if nobody else does.
But nobody has done it as yet.
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.