[MacPorts] #63824: iTerm2: error: property 'safeAreaInsets' not found on object of type 'iTermRootTerminalView *'

MacPorts noreply at macports.org
Sat Jan 15 00:34:33 UTC 2022


#63824: iTerm2: error: property 'safeAreaInsets' not found on object of type
'iTermRootTerminalView *'
-----------------------+----------------------
  Reporter:  szhorvat  |      Owner:  markemer
      Type:  defect    |     Status:  assigned
  Priority:  Normal    |  Milestone:
 Component:  ports     |    Version:  2.7.1
Resolution:            |   Keywords:  mojave
      Port:  iTerm2    |
-----------------------+----------------------

Comment (by Gandoon):

 Replying to [comment:11 Gandoon] (myself and everyone else):
 > This issue seems to be present on several OS versions. I am using MacOS
 10.15 and do also get the "iTerm2SandboxedWorker isn't code signed but
 requires entitlements" error (the same as in the now marked as duplicate
 #63924) when trying to build any iTerm2 post v3.4.13. It is not fully
 clear to me where in the build this signing is performed, but it sure
 presents problems.
 >
 > I also tried to build a gitHub clone, and it also fails to build, but
 with (seemingly) other errors.
 > One prominent issue (that seems to be a recurring theme for software
 that should end up in .app containers) seems to be swift-related (max
 version 5.3.2 on 10.15). Mismatched versions always seems to end up in
 failures. There is limited forward compatibility. If there are frameworks
 that have been built for v5.5, it most certainly won't work with 5.3.2 for
 this particular piece of software I noticed.

 I just want to announce that I found a workaround for my older system. I
 could confirm that the swift frameworks must indeed be built by the build
 system, as they do not give any issues with my older (Xcode v12.4 with
 Swift 5.3.2 on MacOS 10.15.7) system. I now have a working MacPorts build
 of iTerm2 @3.4.15_1.

 However I needed to remove three statements in two .m-files to get it to
 build. The issue seemed to be statements relating to specific MacOS 12
 features (I think they may have something to do with notch handling on the
 newer Apple silicon machines). The functionalities may indeed only be
 present in newer variants of the SDKs, thus breaking building on  older
 variants.

 The statements in questions are:

 In NSScreen+iTerm.m, on lines 97 and 113:

 {{{
 - (CGFloat)notchHeight {
     if (@available(macOS 12.0, *)) {
 //        return self.safeAreaInsets.top;
     }
     return 0;
 }

 . . .

 - (CGFloat)it_menuBarHeight {
     if (@available(macOS 12, *)) {
         // When the "current" screen has a notch, there doesn't seem to be
 a way to get the height
         // of the menu bar on other screens :(
 //        return MAX(24, self.safeAreaInsets.top);
     }
     return NSApp.mainMenu.menuBarHeight;
 }
 }}}
 And in iTermRootTerminalView.m, on lines 1257-1258 (I did actually disable
 the whole if-block here, I could have done that in the previous file as
 well I guess):

 {{{
 //    if (@available(macOS 12, *)) {
 //        // self.safeAreaInsets is all 0s on a notch Mac. Why the hell
 doesn't anything work right?
 //        const NSEdgeInsets safeAreaInsets =
 self.window.screen.safeAreaInsets;
 //        return safeAreaInsets.top;
 //    }
 }}}
 I found the root of the issue by making a copy of the build directory and
 building it with Xcode directly, then making the same modifications in the
 build directory and running **port -v build** to confirm that everything
 worked. Finally a **port -v upgrade iTerm2** ran smoothly and the
 application installed and runs as intended.

 There may be a need for a conditional patch that removes/comments out
 those uses of ''safeAreaInsets'' on older systems.

-- 
Ticket URL: <https://trac.macports.org/ticket/63824#comment:12>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list