Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-128900

macOS 15 deployment target build failure due to obsolete API 'CGDisplayCreateImageForRect'

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P4: Low
    • None
    • 6.7, 6.8
    • GUI: Window management
    • None
    • macOS 15.0 (RC), ARM64, Xcode 16.0
    • macOS

    Description

      In Homebrew, we were trying to build Qt6 on macOS 15.0 Sequoia (RC) with a deployment target of 15.0

      The build failed due to use of obsolete APIs in QtBase Cocoa Platform Plugin:

       

        /tmp/qt-20240911-12865-ecscy5/qt-everywhere-src-6.7.0/qtbase/src/plugins/platforms/cocoa/qcocoascreen.mm:601:37: error: 'CGDisplayCreateImageForRect' is unavailable: obsoleted in macOS 15.0 - Please use ScreenCaptureKit instead.
          601 |         QCFType<CGImageRef> image = CGDisplayCreateImageForRect(displayId, grabRect.toCGRect());
              |                                     ^
        /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDirectDisplay.h:391:33: note: 'CGDisplayCreateImageForRect' has been explicitly marked unavailable here
          391 | CG_EXTERN CGImageRef __nullable CGDisplayCreateImageForRect(
              |                                 ^
        1 error generated. 

      Full logs at https://github.com/Homebrew/homebrew-core/actions/runs/10809233663/job/29984236810#step:4:5641

      This was seen building 6.7.0, but should impact latest development code: https://github.com/qt/qtbase/blob/dev/src/plugins/platforms/cocoa/qcocoascreen.mm#L550

      Corresponding Apple documentations on API (available until 14.4) - https://developer.apple.com/documentation/coregraphics/1454595-cgdisplaycreateimageforrect

       

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            vestbo Tor Arne Vestbø
            cho-m Michael Cho
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes