Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support build on macOS Monterey (v12) #1378

Open
bmalinowsky opened this issue Sep 12, 2024 · 2 comments · May be fixed by #1990
Open

Support build on macOS Monterey (v12) #1378

bmalinowsky opened this issue Sep 12, 2024 · 2 comments · May be fixed by #1990

Comments

@bmalinowsky
Copy link

Building d29797f on macOS Monterey 12.7.6 fails with

/Users/bro/Documents/repositories/ladybird/Ladybird/AppKit/UI/SearchPanel.mm:66:36: error: use of undeclared identifier 'NSBezelStyleAccessoryBarAction'
   66 |         [search_done setBezelStyle:NSBezelStyleAccessoryBarAction];
      |                                    ^

NSBezelStyleAccessoryBarAction got introduced with macOS v14. AFAICT this is the only constant which prevents a successful build for earlier versions.

Currently I use this hack:

-        [search_done setBezelStyle:NSBezelStyleAccessoryBarAction];
-
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+        [search_done setBezelStyle:NSBezelStyleRoundRect];
+#pragma clang diagnostic pop
@AtkinsSJ
Copy link
Member

Looks like there's an official way to run different code on different versions of macOS. https://developer.apple.com/documentation/xcode/running-code-on-a-specific-version#Require-a-minimum-operating-system-version-for-a-feature

As far as I can tell, Apple still supports Monterey, so it seems reasonable to me for us to do so too if you feel like putting a PR together. (Or someone else does.)

@fwcd
Copy link

fwcd commented Oct 26, 2024

Note that Apple's @available checks are runtime checks and generally still assume that you're building with the latest SDK/Xcode version, even when back-deploying to some older macOS version (which is generally encouraged).

To support building with an older SDK, we would have to cond-compile the constant out, e.g. using the __MAC_OS_X_VERSION_MAX_ALLOWED macro: https://stackoverflow.com/a/78050635

NSBezelStyleAccessoryBarAction is actually an interesting case, the API seems to have been added in the macOS 14 SDK, but does not require an available check (as other APIs like NSBezelStyleBadge, for example):

image

This can happen if the API existed as a private API before being added to the public SDK, so NSBezelStyleAccessoryBarAction might be present in macOS 12's runtime frameworks (AppKit in this case) and happily back-deploy to that macOS version, but still require the macOS 14 SDK to compile.

@fwcd fwcd linked a pull request Oct 26, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants