[MacPorts] #71049: openjdk21 @21.0.4+7: error: use of undeclared identifier 'NSBundleExecutableArchitectureARM64' on 10.14 and 10.15

MacPorts noreply at macports.org
Mon Oct 7 02:24:14 UTC 2024


#71049: openjdk21 @21.0.4+7: error: use of undeclared identifier
'NSBundleExecutableArchitectureARM64' on 10.14 and 10.15
---------------------------+-----------------------------
  Reporter:  sambthompson  |      Owner:  breun
      Type:  defect        |     Status:  assigned
  Priority:  Normal        |  Milestone:
 Component:  ports         |    Version:  2.10.2
Resolution:                |   Keywords:  catalina mojave
      Port:  openjdk21     |
---------------------------+-----------------------------
Description changed by sambthompson:

Old description:

> See:
> https://build.macports.org/builders/ports-10.15_x86_64-builder/builds/196610/steps
> /install-port/logs/stdio
>
> {{{
> :info:build
> src/java.desktop/macosx/native/libawt_lwawt/awt/CGraphicsDevice.m:69:29:
> error: use of undeclared identifier
> 'NSBundleExecutableArchitectureARM64'; did you mean
> 'NSBundleExecutableArchitecturePPC64'?
> :info:build         if (architecture ==
> NSBundleExecutableArchitectureARM64) {
> :info:build
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> :info:build
> NSBundleExecutableArchitecturePPC64
> :info:build
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSBundle.h:123:5:
> note: 'NSBundleExecutableArchitecturePPC64' declared here
> :info:build     NSBundleExecutableArchitecturePPC64     = 0x01000012
> :info:build     ^
> :info:build 1 error generated.
> }}}
>
> It's unclear whether this is an upstream issue; the failing code in
> question is not tagged upstream for `openjdk21`, but is delivered in the
> tarball anyway. Upstream still claims to support from `10.12` for
> `openjdk21`.
>
> However, I don't think it should not fail in any case (and clearly other
> builds of `openjdk21` e.g. from IBM, Azul, etc. are successful/usable on
> `10.15` and `10.14`), because the fragment in question is guarded with
> Objective C pragma `@available`, viz.
>
> {{{
> static BOOL isValidDisplayMode(CGDisplayModeRef mode) {
>     // Workaround for apple bug FB13261205, since it only affects arm
> based macs
>     // and arm support started with macOS 11 ignore the workaround for
> previous versions
>     if (@available(macOS 11, *)) {
>         if (architecture == -1) {
>             architecture = [[NSRunningApplication currentApplication]
> executableArchitecture];
>         }
>         if (architecture == NSBundleExecutableArchitectureARM64) {
>             return (CGDisplayModeGetPixelWidth(mode) >= 800);
>         }
>     }
>     return (1 < CGDisplayModeGetWidth(mode) && 1 <
> CGDisplayModeGetHeight(mode));
> }
> }}}
>
> However, it's not clear why this is not being honoured on builds on 10.14
> and 10.15. I have to assume there is compiler support for this
> `@available` syntax (apparently since
> [https://stackoverflow.com/questions/46965347/objective-c-available-
> guard-anded-with-more-conditions Xcode 9 / LLVM 5]), since that does not
> generate an error.

New description:

 See:
 https://build.macports.org/builders/ports-10.15_x86_64-builder/builds/196610/steps
 /install-port/logs/stdio

 {{{
 :info:build
 src/java.desktop/macosx/native/libawt_lwawt/awt/CGraphicsDevice.m:69:29:
 error: use of undeclared identifier 'NSBundleExecutableArchitectureARM64';
 did you mean 'NSBundleExecutableArchitecturePPC64'?
 :info:build         if (architecture ==
 NSBundleExecutableArchitectureARM64) {
 :info:build
 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 :info:build
 NSBundleExecutableArchitecturePPC64
 :info:build
 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSBundle.h:123:5:
 note: 'NSBundleExecutableArchitecturePPC64' declared here
 :info:build     NSBundleExecutableArchitecturePPC64     = 0x01000012
 :info:build     ^
 :info:build 1 error generated.
 }}}

 ~~It's unclear whether this is an upstream issue; the failing code in
 question is not tagged upstream for `openjdk21`, but is delivered in the
 tarball anyway. Upstream still claims to support from `10.12` for
 `openjdk21`.~~ EDIT: Was backported.

 ~~However, I don't think it should not fail in any case (and clearly other
 builds of `openjdk21` e.g. from IBM, Azul, etc. are successful/usable on
 `10.15` and `10.14`), because the fragment in question is guarded with
 Objective C pragma `@available`, viz.~~ EDIT: Wrong again, doesn't work
 like `#ifdef`.

 {{{
 static BOOL isValidDisplayMode(CGDisplayModeRef mode) {
     // Workaround for apple bug FB13261205, since it only affects arm
 based macs
     // and arm support started with macOS 11 ignore the workaround for
 previous versions
     if (@available(macOS 11, *)) {
         if (architecture == -1) {
             architecture = [[NSRunningApplication currentApplication]
 executableArchitecture];
         }
         if (architecture == NSBundleExecutableArchitectureARM64) {
             return (CGDisplayModeGetPixelWidth(mode) >= 800);
         }
     }
     return (1 < CGDisplayModeGetWidth(mode) && 1 <
 CGDisplayModeGetHeight(mode));
 }
 }}}

 ~~However, it's not clear why this is not being honoured on builds on
 10.14 and 10.15. I have to assume there is compiler support for this
 `@available` syntax (apparently since
 [https://stackoverflow.com/questions/46965347/objective-c-available-guard-
 anded-with-more-conditions Xcode 9 / LLVM 5]), since that does not
 generate an error.~~

--

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


More information about the macports-tickets mailing list