[MacPorts] #62164: qemu @5.2.0: build failure with +cocoa

MacPorts noreply at macports.org
Wed Jan 27 20:15:45 UTC 2021


#62164: qemu @5.2.0: build failure with +cocoa
-----------------------+----------------------
 Reporter:  Ionic      |      Owner:  raimue
     Type:  defect     |     Status:  assigned
 Priority:  Normal     |  Milestone:
Component:  ports      |    Version:
 Keywords:  legacy-os  |       Port:  qemu
-----------------------+----------------------
 This targets legacy OS versions only, so Raim doesn't need to care.

 Some relevant excerpts from the build log on 10.9:

 {{{
 In file included from ../qemu-5.2.0/ui/cocoa.m:25:
 In file included from
 /opt/local/var/macports/build/_opt_local_var_macports_sources_macports.rsync.ionic.de_release_ports_emulators_qemu/qemu/work/qemu-5.2.0/include/qemu/osdep.h:93:
 /opt/local/include/LegacySupport/unistd.h:34:5: warning:
 '__DISABLE_MP_LEGACY_SUPPORT_SYSCONF_WRAP__' is not defined, evaluates to
 0 [-Wundef]
 /opt/local/include/LegacySupport/MacportsLegacySupport.h:107:12: note:
 expanded from macro '__ENABLE_MP_LEGACY_SUPPORT_SYSCONF_WRAP__'
 !__DISABLE_MP_LEGACY_SUPPORT_SYSCONF_WRAP__       && \
                                                      ^
 ../qemu-5.2.0/ui/cocoa.m:421:71: warning: instance method '-CGContext' not
 found (return type defaults to 'id'); did you mean '-CIContext'? [-Wobjc-
 method-access]
     CGContextRef viewContextRef = [[NSGraphicsContext currentContext]
 CGContext];
 ^~~~~~~~~
 CIContext
 /System/Library/Frameworks/AppKit.framework/Headers/NSGraphicsContext.h:39:12:
 note: receiver is instance of class declared here
 @interface NSGraphicsContext : NSObject {
            ^
 ../qemu-5.2.0/ui/cocoa.m:421:18: warning: incompatible pointer types
 initializing 'CGContextRef' (aka 'struct CGContext *') with an expression
 of type 'id' [-Wincompatible-pointer-types]
     CGContextRef viewContextRef = [[NSGraphicsContext currentContext]
 CGContext];
                  ^
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ../qemu-5.2.0/ui/cocoa.m:588:27: error: use of undeclared identifier
 'NSWindowStyleMaskBorderless'
                 styleMask:NSWindowStyleMaskBorderless
                           ^
 ../qemu-5.2.0/ui/cocoa.m:623:33: error: use of undeclared identifier
 'NSEventModifierFlagControl'
     if ([event modifierFlags] & NSEventModifierFlagControl) {
                                 ^
 ../qemu-5.2.0/ui/cocoa.m:709:14: error: use of undeclared identifier
 'NSEventTypeFlagsChanged'; did you mean 'kCGEventFlagsChanged'?
         case NSEventTypeFlagsChanged:
              ^~~~~~~~~~~~~~~~~~~~~~~
              kCGEventFlagsChanged
 /System/Library/Frameworks/CoreGraphics.framework/Headers/CGEventTypes.h:117:3:
 note: 'kCGEventFlagsChanged' declared here
   kCGEventFlagsChanged = NX_FLAGSCHANGED,
   ^
 ../qemu-5.2.0/ui/cocoa.m:718:40: error: use of undeclared identifier
 'NSEventModifierFlagCapsLock'
                     if (!!(modifiers & NSEventModifierFlagCapsLock) !=
 !!modifiers_state[Q_KEY_CODE_CAPS_LOCK]) {
                                        ^
 ../qemu-5.2.0/ui/cocoa.m:721:40: error: use of undeclared identifier
 'NSEventModifierFlagShift'
                     if (!!(modifiers & NSEventModifierFlagShift) !=
 !!modifiers_state[Q_KEY_CODE_SHIFT]) {
                                        ^
 ../qemu-5.2.0/ui/cocoa.m:724:40: error: use of undeclared identifier
 'NSEventModifierFlagControl'
                     if (!!(modifiers & NSEventModifierFlagControl) !=
 !!modifiers_state[Q_KEY_CODE_CTRL]) {
                                        ^
 ../qemu-5.2.0/ui/cocoa.m:727:40: error: use of undeclared identifier
 'NSEventModifierFlagOption'
                     if (!!(modifiers & NSEventModifierFlagOption) !=
 !!modifiers_state[Q_KEY_CODE_ALT]) {
                                        ^
 ../qemu-5.2.0/ui/cocoa.m:730:40: error: use of undeclared identifier
 'NSEventModifierFlagCommand'
                     if (!!(modifiers & NSEventModifierFlagCommand) !=
 !!modifiers_state[Q_KEY_CODE_META_L]) {
                                        ^
 ../qemu-5.2.0/ui/cocoa.m:759:14: error: use of undeclared identifier
 'NSEventTypeKeyDown'
         case NSEventTypeKeyDown:
              ^
 ../qemu-5.2.0/ui/cocoa.m:763:61: error: use of undeclared identifier
 'NSEventModifierFlagCommand'
             if (!isMouseGrabbed && ([event modifierFlags] &
 NSEventModifierFlagCommand)) {
                                                             ^
 ../qemu-5.2.0/ui/cocoa.m:777:42: error: use of undeclared identifier
 'NSEventModifierFlagControl'
             if (([event modifierFlags] & NSEventModifierFlagControl) &&
 ([event modifierFlags] & NSEventModifierFlagOption)) {
                                          ^
 ../qemu-5.2.0/ui/cocoa.m:777:98: error: use of undeclared identifier
 'NSEventModifierFlagOption'
             if (([event modifierFlags] & NSEventModifierFlagControl) &&
 ([event modifierFlags] & NSEventModifierFlagOption)) {
 ^
 ../qemu-5.2.0/ui/cocoa.m:802:14: error: use of undeclared identifier
 'NSEventTypeKeyUp'; did you mean 'NSEventTypeSwipe'?
         case NSEventTypeKeyUp:
              ^~~~~~~~~~~~~~~~
              NSEventTypeSwipe
 }}}

 Ken, what do you think? Back then, in #59257, your fork included a
 downgrade of the cocoa interface from 4.1.0 to 4.0.0. We probably can't
 keep up with that going forward, since we'd lose any new changes to the UI
 (and, also, because features within qemu might be removed that the old UI
 references/uses).

 Do we want to try to make the code compatible with older operating
 systems, or just take the easy way out and let the `cocoa` variant throw
 an error for anything below 10.12?

 I don't currently know how much effort it would be to rewrite the cocoa
 code to make it work on older systems. A quick glance revealed that some
 errors are very easy to fix (for instance, `NSEventTypeKeyUp` was
 introduced in 10.12, while older systems provide the same functionality as
 `NSKeyDown`), while others might be more difficult to rewrite or may even
 not have a direct deprecated alternative we could use instead. Going
 forward, it will probably get ever more difficult to keep the code
 compatible.

 I guess I'll try to make it compatible, as far as I can. My target is
 10.9, though.

-- 
Ticket URL: <https://trac.macports.org/ticket/62164>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list