[MacPorts] #58390: qt53-qtbase 32bit: error: no viable conversion from 'CGRect' to 'NSRect'

MacPorts noreply at macports.org
Thu Apr 25 23:00:35 UTC 2019


#58390: qt53-qtbase 32bit: error: no viable conversion from 'CGRect' to 'NSRect'
--------------------+-------------------------
 Reporter:  kencu   |      Owner:  kencu
     Type:  defect  |     Status:  assigned
 Priority:  Normal  |  Milestone:
Component:  ports   |    Version:
 Keywords:          |       Port:  qt53-qtbase
--------------------+-------------------------
 qt53-qtbase port  [https://build.macports.org/builders/ports-10
 .6_i386_legacy-builder/builds/63812/steps/install-port/logs/stdio fails to
 build] on 10.6.8 in 32bit mode. Perhaps all 32bit builds will fail - I
 haven't tried to build it +universal yet or 32bit on any other systems.

 This is the error:
 {{{
 styles/qmacstyle_mac.mm:3672:87: error: no viable conversion from 'CGRect'
 to 'NSRect' (aka '_NSRect')
                     pushButtonFocusRingPath = [NSBezierPath
 bezierPathWithRoundedRect:focusRect xRadius:4 yRadius:4];
 ^~~~~~~~~
 }}}

 It seemed to be an inconsistency between the 64 bit build (which
 succeeds), and the 32 bit build with respect to the definitions in the
 Foundation classes.

 I first fixed it with a simple patch:
 {{{
 --- ./src/widgets/styles/qmacstyle_mac.mm.orig  2019-04-25
 14:12:12.000000000 -0700
 +++ ./src/widgets/styles/qmacstyle_mac.mm       2019-04-25
 14:17:29.000000000 -0700
 @@ -3667,9 +3667,9 @@

                  NSBezierPath *pushButtonFocusRingPath;
                  if (bdi.kind == kThemeBevelButton)
 -                    pushButtonFocusRingPath = [NSBezierPath
 bezierPathWithRect:focusRect];
 +                    pushButtonFocusRingPath = [NSBezierPath
 bezierPathWithRect:NSRectFromCGRect(focusRect)];
                  else
 -                    pushButtonFocusRingPath = [NSBezierPath
 bezierPathWithRoundedRect:focusRect xRadius:4 yRadius:4];
 +                    pushButtonFocusRingPath = [NSBezierPath
 bezierPathWithRoundedRect:NSRectFromCGRect(focusRect) xRadius:4
 yRadius:4];
                  qt_drawFocusRingOnPath(cg, pushButtonFocusRingPath);
              }
  }}}
 which does work, but this just seems like an odd thing to have to do, and
 in the end, most likely the wrong approach.

 Looking around, 32 bit builds of qt and other software have been having
 issues like this for a long time, eg this fix from michael from many years
 ago for qt4 [ticket:34902], and many other similar references out there:

 1. <https://stackoverflow.com/questions/3538347/how-come-nsrect-and-
 cgrect-are-incompatible-types>
 1. <https://bugs.webkit.org/show_bug.cgi?id=93397>
 1.
 <https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/Cocoa64BitGuide/64BitChangesCocoa/64BitChangesCocoa.html>

 It  looks like what we really want to do to fix 32bit builds of qt is to
 define `-DNS_BUILD_32_LIKE_64` everywhere.

 In fact, thinking about it, AFAICT, that means **everywhere** that qt
 builds. i.e. it should be embedded in the `mkspecs` for all 32 bit builds,
 and used for everything that builds 32bit against 32 bit qt, otherwise
 there will be trouble.

 I haven't really thought about +universal builds yet -- but it would seem
 that they need it too...

 Does this seem like the right approach?

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


More information about the macports-tickets mailing list