keepassxreboot / keepassxc

KeePassXC is a cross-platform community-driven port of the Windows application “Keepass Password Safe”.
https://keepassxc.org/
Other
21.34k stars 1.47k forks source link

Failed build on macOS with Xcode 16.0 #11288

Closed shuxiao9058 closed 6 days ago

shuxiao9058 commented 1 month ago
:info:build /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_security_KeePassXC/KeePassXC/work/keepassxc-c1a66a8be98d8f3a7ea1ba0ca6065c2d1a10e56b/src/gui/osutils/macutils/AppKitImpl.mm:190:37: error: 'CGDisplayStreamCreate' is unavailable: obsoleted in macOS 15.0 - Please use ScreenCaptureKit instead.
:info:build   190 |         CGDisplayStreamRef stream = CGDisplayStreamCreate(CGMainDisplayID(), 1, 1, kCVPixelFormatType_32BGRA, nil,
:info:build       |                                     ^
:info:build /Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/System/Library/Frameworks/CoreGraphics.framework/Headers/CGDisplayStream.h:242:41: note: 'CGDisplayStreamCreate' has been explicitly marked unavailable here

refer to: https://github.com/keepassxreboot/keepassxc/discussions/10308

droidmonkey commented 1 month ago

@phoerious we will need to fix this

varjolintu commented 1 month ago

This also happens with macOS Sequoia when building KeePassXC locally. Not depending on the Xcode.

burnziii commented 1 month ago

CGDisplayStreamCreate is deprecated see: https://developer.apple.com/documentation/coregraphics/1455170-cgdisplaystreamcreate

shemeshg commented 1 month ago

actually found it is not required to prevent screen capture

Screen capture is managed (as intended) with

m_appkit->setWindowSecurity(this->winId(), true);

it might be that this function can be remarked...

more details

CGDisplayStreamCreate is deprecated see: https://developer.apple.com/documentation/coregraphics/1455170-cgdisplaystreamcreate

use ScreenCaptureKit instead

AppKitImpl.mm::199::37
  ....../AppKitImpl.mm</a>:199:37: error: 'CGDisplayStreamCreate' is unavailable: obsoleted in macOS 15.0 - Please 
use ScreenCaptureKit instead.
  199 |         CGDisplayStreamRef stream = CGDisplayStreamCreate(CGMainDisplayID(), 1, 1, kCVPixelFormatType_32BGRA, nil,

Also notice deprecation for - (bool) activateProcess:(pid_t) pid

  AppKitImpl.mm::117::37" ... /AppKitImpl.mm</a>:117:37: warning: 
  'NSApplicationActivateIgnoringOtherApps' is deprecated: first deprecated in macOS 14.0 - 
ignoringOtherApps is deprecated in macOS 14 
  and will have no effect. [-Wdeprecated-declarations]
  117 |     return [app activateWithOptions:NSApplicationActivateIgnoringOtherApps];
droidmonkey commented 1 month ago

The function that uses this call to CGDisplayStreamRef is actually just triggering the permission request to enable Screen Recording which is required for polling the window titles (if I recall correctly). If we can poll window titles using just the accessibility permission that would be ideal. Any ideas?

shemeshg commented 1 month ago

The function that uses this call to CGDisplayStreamRef is actually just triggering the permission request to enable Screen Recording which is required for polling the window titles (if I recall correctly). If we can poll window titles using just the accessibility permission that would be ideal. Any ideas?

I do it in my app without CGDisplayStreamRef and it works fine, since keepassxc is code signed , it should be ok - the authorization is uniquely bound to the executable . if it wasn't, you would have to clear old authorization manually for every upgrade.

droidmonkey commented 1 month ago

Can you provide a code snippet from your app?

droidmonkey commented 1 month ago

BTW, you can continue to build properly if you set the following environment variable before running cmake: MACOSX_DEPLOYMENT_TARGET=10.14

shemeshg commented 1 month ago

I'm using the keepassXC macos files as is and just

https://github.com/shemeshg/pass-simple-qt/blob/f79873fb0325d67bef849b9b0e3b74202f5f7608/mainwindow.cpp#L427C1-L440C2

(I've credited you at the SBOM)

droidmonkey commented 1 month ago

We are talking about two different things. The linked code hides the window from other processes and remote viewers. I'm referring to harvesting window titles for use by auto-type. This thread doesn't impact hiding the main window.

phoerious commented 1 month ago

BTW, you can continue to build properly if you set the following environment variable before running cmake: MACOSX_DEPLOYMENT_TARGET=10.14

This won't work for ARM builds. There it has to be at least 11.0.

TheRojam commented 1 month ago

Idk if this helps.

'CGDisplayStreamCreate' is unavailable: obsoleted in macOS 15.0 - **Please use ScreenCaptureKit instead**

colorenz commented 1 month ago

Hi, is there anything new here? It seems there are also issues related to DisplayLink and KeePassXC, causing windows to sometimes become unmovable.

https://www.synaptics.com/products/displaylink-graphics/downloads/macos