Opened 3 weeks ago

Closed 3 weeks ago

Last modified 2 days ago

#70819 closed defect (fixed)

openjdk22 @22.0.2_0+release+server Does not build with Xcode 16, Sequoia (15)

Reported by: EvilJordan (Jordan Holberg) Owned by: breun (Nils Breunese)
Priority: Normal Milestone:
Component: ports Version: 2.10.1
Keywords: sequoia, xcode Cc:
Port: openjdk22

Description

--->  Cleaning openjdk22
--->  Computing dependencies for openjdk22
--->  Fetching archive for openjdk22
--->  Attempting to fetch openjdk22-22.0.2_0+release+server.darwin_24.arm64.tbz2 from https://packages.macports.org/openjdk22
--->  Attempting to fetch openjdk22-22.0.2_0+release+server.darwin_24.arm64.tbz2 from http://mirror.fcix.net/macports/packages/openjdk22
--->  Attempting to fetch openjdk22-22.0.2_0+release+server.darwin_24.arm64.tbz2 from https://ywg.ca.packages.macports.org/mirror/macports/packages/openjdk22
--->  Fetching distfiles for openjdk22
--->  Verifying checksums for openjdk22
--->  Extracting openjdk22
--->  Configuring openjdk22
--->  Building openjdk22                                 
Error: Failed to build openjdk22: command execution failed
Error: See /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_macports_release_tarballs_ports_java_openjdk22/openjdk22/main.log for details.

Later at the end of the install process...

- openjdk22 
       Failed: Unable to execute target 'activate' for port openjdk22 - see its log for details

Attachments (1)

main.log (140.6 KB) - added by EvilJordan (Jordan Holberg) 3 weeks ago.

Download all attachments as: .zip

Change History (13)

Changed 3 weeks ago by EvilJordan (Jordan Holberg)

Attachment: main.log added

comment:1 Changed 3 weeks ago by jmroot (Joshua Root)

Owner: set to breun
Status: newassigned
Summary: Does not build with Xcode 16, Sequoia (15)openjdk22 @22.0.2_0+release+server Does not build with Xcode 16, Sequoia (15)
:info:build Exception in thread "main" java.lang.ClassFormatError: StackMapTable format error: bad verification type
:info:build     at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:64)
:info:build     at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:52)

comment:2 Changed 3 weeks ago by breun (Nils Breunese)

According to this upstream OpenJDK bug this is caused by a bug in Xcode 16’s clang++ compiler: https://bugs.openjdk.org/browse/JDK-8340341

Last edited 3 weeks ago by breun (Nils Breunese) (previous) (diff)

comment:3 in reply to:  1 Changed 3 weeks ago by breun (Nils Breunese)

I just read UsingTheRightCompiler, but the world of C/C++ compilers is relatively foreign to me. Should I use compiler.blacklist to not use Apple’s clang on Xcode 16 somehow?

comment:4 Changed 3 weeks ago by breun (Nils Breunese)

According to https://wiki.openjdk.org/display/Build/Supported+Build+Platforms Oracle’s build platform for JDK 22 uses clang 14.3.1 on macOS 13.

comment:5 Changed 3 weeks ago by cjones051073 (Chris Jones)

Using macports clang-14 is not an option here, as the minimum currently supported on macOS is clang-18

comment:6 in reply to:  5 ; Changed 3 weeks ago by breun (Nils Breunese)

Replying to cjones051073:

Using macports clang-14 is not an option here, as the minimum currently supported on macOS is clang-18

I'm new to the world of compiler selection, but when attempting to install the clang-14, clang-16 or clang-17 ports I indeed get a messages saying that that is known to fail.

But the brand new Xcode 16 on macOS 15 seems to come with clang 16?

~ ❯ /usr/bin/clang --version 
Apple clang version 16.0.0 (clang-1600.0.26.3)
Target: arm64-apple-darwin24.0.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
~ ❯ /usr/bin/clang++ --version
Apple clang version 16.0.0 (clang-1600.0.26.3)
Target: arm64-apple-darwin24.0.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

But yeah, if clang 16 is still too new, then I don't know what can be done to maken OpenJDK build on macOS 15.

The same issue seems to apply to the other openjdk* ports that build OpenJDK from source on macOS 15.

Version 0, edited 3 weeks ago by breun (Nils Breunese) (next)

comment:7 Changed 3 weeks ago by breun (Nils Breunese)

Here is a temporary workaround patch: https://bugs.openjdk.org/browse/JDK-8340574

comment:8 Changed 3 weeks ago by Nils Breunese <breun@…>

Resolution: fixed
Status: assignedclosed

comment:9 Changed 3 weeks ago by breun (Nils Breunese)

comment:10 in reply to:  6 Changed 3 weeks ago by jmroot (Joshua Root)

Replying to breun:

But the brand new Xcode 16 on macOS 15 seems to come with clang 16?

One 16 is not always the same as another 16, unfortunately. The version reported by Apple clang has no relationship to the version of llvm.org clang that it is based on. Compare the "Clang version string" and "LLVM" columns here: https://en.wikipedia.org/wiki/Xcode#Toolchain_versions

comment:11 Changed 3 days ago by saagarjha (Saagar Jha)

This also applies to openjdk20 at the very least. FWIW, I bisected this earlier and the patch I have been carrying is smaller:

@@ -0,0 +1,12 @@
diff --git src/hotspot/share/classfile/stackMapTable.cpp src/hotspot/share/classfile/stackMapTable.cpp
index fa2a57f96b4..527f1c6e32e 100644
--- src/hotspot/share/classfile/stackMapTable.cpp
+++ src/hotspot/share/classfile/stackMapTable.cpp
@@ -211,6 +211,7 @@ VerificationType StackMapReader::parse_verification_type(u1* flags, TRAPS) {
   return VerificationType::bogus_type();
 }
 
+[[clang::optnone]]
 StackMapFrame* StackMapReader::next(
     StackMapFrame* pre_frame, bool first, u2 max_locals, u2 max_stack, TRAPS) {
   StackMapFrame* frame;

It's up to you whether you want this one or not.

comment:12 Changed 2 days ago by breun (Nils Breunese)

OpenJDK 20 reached end of support in September 2023 and I am not the maintainer of the openjdk20 port, but feel free to create a pull request for it.

Note: See TracTickets for help on using tickets.