Building Asterisk on macOS Montery 12.3.1 results in error

The following error is logged during running make command

[pjproject]  Compiling libpj-arm-apple-darwin21.4.0.a
make[2]: *** [source/pjlib/lib/libpj-arm-apple-darwin21.4.0.a] Error 2
make[1]: *** [pjproject] Error 2
make: *** [third-party] Error 2

When configured with NOISY_BUILD=yes flag specified, the error becomes more descriptive

/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSTextLineFragment.h:32:12: error: unknown property attribute 'strong'
   32 | @property (strong, readonly) NSAttributedString *attributedString;
      |            ^~~~~~
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/AppKit.framework/Headers/AppKit.h:272,
                 from ../src/pj/os_core_darwin.m:33:
/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSTextViewportLayoutController.h:61:22: error: unknown property attribute 'weak'
   61 | @property (nullable, weak) id <NSTextViewportLayoutControllerDelegate> delegate;
      |                      ^~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSTextViewportLayoutController.h:61:72: note: 'assign' can be unsafe for Objective-C objects; please state explicitly if you need it
   61 | @property (nullable, weak) id <NSTextViewportLayoutControllerDelegate> delegate;
      | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSTextViewportLayoutController.h:64:12: error: unknown property attribute 'weak'

I’m compiling with gcc-11 (not clang).

MacOS is not a core supported platform, and I am not aware of any active developer using it. It is entirely possible something got broken and noone has fixed it.