Re: About compiling on macOS
Hi Jaikiran > If you cannot use any other XCode other than 16.3, then you can build the JDK > by using the "--disable-warnings-as-errors" configure option (more details > here > https://github.com/openjdk/jdk/blob/master/doc/building.md#problems-with-the-build-environment). > Another user has reported previously that this option allowed them to > successfully build with XCode 16.3. I was able to successfully compile using this method. Thank you. > 2025/04/27 16:34、Jaikiran Pai のメール: > > A previous report too suggests that the JDK build fails (due to compiler > warnings) when using 16.3 of Xcode on macos. Do you have access to a 15.4 > version of Xcode instead? If so, then you can use "--with-xcode-path" during > configure to point to that installation of Xcode and build the JDK (more > details in the documentation here > https://github.com/openjdk/jdk/blob/master/doc/building.md#apple-xcode). I > believe that version should be fine. > > If you cannot use any other XCode other than 16.3, then you can build the JDK > by using the "--disable-warnings-as-errors" configure option (more details > here > https://github.com/openjdk/jdk/blob/master/doc/building.md#problems-with-the-build-environment). > Another user has reported previously that this option allowed them to > successfully build with XCode 16.3. > > Long term, the warnings from that part of the code will have to be > investigated in the JDK. > > -Jaikiran > > On 27/04/25 11:30 am, mit...@daisuke2.com wrote: >> I have just compiled in the master branch. As a result, I am struggling with >> the following compilation errors. >> >> Configuration summary: >> * Name: macosx-aarch64-server-release >> * Debug level:release >> * HS debug level: product >> * JVM variants: server >> -n * JVM features: >> -n server: 'cds compiler1 compiler2 dtrace epsilongc g1gc jfr jni-check >> jvmci jvmti management parallelgc serialgc services shenandoahgc vm-structs >> zgc' >> >> * OpenJDK target: OS: macosx, CPU architecture: aarch64, address length: 64 >> * Version string: 25-internal-adhoc.mitani.jdk (25-internal) >> * Source date:1745733212 (2025-04-27T05:53:32Z) >> >> Tools summary: >> * Boot JDK: openjdk version "24.0.1" 2025-04-15 OpenJDK Runtime >> Environment Corretto-24.0.1.9.1 (build 24.0.1+9-FR) OpenJDK 64-Bit Server VM >> Corretto-24.0.1.9.1 (build 24.0.1+9-FR, mixed mode, sharing) (at >> /Library/Java/JavaVirtualMachines/amazon-corretto-24.jdk/Contents/Home) >> * Toolchain: clang (clang/LLVM from Xcode 16.3) >> * Sysroot: >> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.4.sdk >> * C Compiler: Version 17.0.0 (at /usr/bin/clang) >> * C++ Compiler: Version 17.0.0 (at /usr/bin/clang++) >> >> >> >> git/jdk/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp:127:39: >> error: variable length arrays in C++ are a Clang extension >> [-Werror,-Wvla-cxx-extension] >> 127 | AudioDeviceID devices[count]; >> | ^ >> git/jdk/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp:127:39: >> note: read of non-const variable 'count' is not allowed in a constant >> expression >> git/jdk/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp:126:21: >> note: declared here >> 126 | int count = size/sizeof(AudioDeviceID); >> | ^ >> git/jdk/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp:151:42: >> error: variable length arrays in C++ are a Clang extension >> [-Werror,-Wvla-cxx-extension] >> 151 | AudioObjectID controlIDs[count]; >> | ^ >> git/jdk/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp:151:42: >> note: read of non-const variable 'count' is not allowed in a constant >> expression >> git/jdk/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp:150:21: >> note: declared here >> 150 | int count = size / sizeof(AudioObjectID); >> | ^ >> git/jdk/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp:483:38: >> error: variable length arrays in C++ are a Clang extension >> [-Werror,-Wvla-cxx-extension] >> 483 | AudioObjectID controlIDs[mixer->deviceControlCount]; >> | ^ >> git/jdk/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp:483:38: >> note: read of non-constexpr variable 'mixer' is not allowed in a constant >> expression >> git/jdk/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp:458:16: >> note: declared here >> 458 | PortMixer *mixer = (PortMixer *)id; >> | ^ >> git/jdk/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp:527:34: >> error: variable length arrays in C++ are a Clang extension >> [-Werror,-Wvla-cxx-extension] >> 527 | AudioControl* volumeControls[totalChannels+1]; // 0 - for master >> channel >> | ^~~ >> git/jdk/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp:527:34
About compiling on macOS
I have just compiled in the master branch. As a result, I am struggling with the following compilation errors. Configuration summary: * Name: macosx-aarch64-server-release * Debug level:release * HS debug level: product * JVM variants: server -n * JVM features: -n server: 'cds compiler1 compiler2 dtrace epsilongc g1gc jfr jni-check jvmci jvmti management parallelgc serialgc services shenandoahgc vm-structs zgc' * OpenJDK target: OS: macosx, CPU architecture: aarch64, address length: 64 * Version string: 25-internal-adhoc.mitani.jdk (25-internal) * Source date:1745733212 (2025-04-27T05:53:32Z) Tools summary: * Boot JDK: openjdk version "24.0.1" 2025-04-15 OpenJDK Runtime Environment Corretto-24.0.1.9.1 (build 24.0.1+9-FR) OpenJDK 64-Bit Server VM Corretto-24.0.1.9.1 (build 24.0.1+9-FR, mixed mode, sharing) (at /Library/Java/JavaVirtualMachines/amazon-corretto-24.jdk/Contents/Home) * Toolchain: clang (clang/LLVM from Xcode 16.3) * Sysroot: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.4.sdk * C Compiler: Version 17.0.0 (at /usr/bin/clang) * C++ Compiler: Version 17.0.0 (at /usr/bin/clang++) git/jdk/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp:127:39: error: variable length arrays in C++ are a Clang extension [-Werror,-Wvla-cxx-extension] 127 | AudioDeviceID devices[count]; | ^ git/jdk/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp:127:39: note: read of non-const variable 'count' is not allowed in a constant expression git/jdk/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp:126:21: note: declared here 126 | int count = size/sizeof(AudioDeviceID); | ^ git/jdk/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp:151:42: error: variable length arrays in C++ are a Clang extension [-Werror,-Wvla-cxx-extension] 151 | AudioObjectID controlIDs[count]; | ^ git/jdk/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp:151:42: note: read of non-const variable 'count' is not allowed in a constant expression git/jdk/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp:150:21: note: declared here 150 | int count = size / sizeof(AudioObjectID); | ^ git/jdk/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp:483:38: error: variable length arrays in C++ are a Clang extension [-Werror,-Wvla-cxx-extension] 483 | AudioObjectID controlIDs[mixer->deviceControlCount]; | ^ git/jdk/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp:483:38: note: read of non-constexpr variable 'mixer' is not allowed in a constant expression git/jdk/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp:458:16: note: declared here 458 | PortMixer *mixer = (PortMixer *)id; | ^ git/jdk/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp:527:34: error: variable length arrays in C++ are a Clang extension [-Werror,-Wvla-cxx-extension] 527 | AudioControl* volumeControls[totalChannels+1]; // 0 - for master channel | ^~~ git/jdk/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp:527:34: note: read of non-const variable 'totalChannels' is not allowed in a constant expression git/jdk/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp:524:9: note: declared here 524 | int totalChannels = GetChannelCount(mixer->deviceID, port->scope == kAudioDevicePropertyScopeOutput ? 1 : 0); | ^ git/jdk/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp:529:32: error: variable length arrays in C++ are a Clang extension [-Werror,-Wvla-cxx-extension] 529 | AudioControl* muteControls[totalChannels+1]; // 0 - for master channel | ^~~ git/jdk/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp:529:32: note: read of non-const variable 'totalChannels' is not allowed in a constant expression git/jdk/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp:524:9: note: declared here 524 | int totalChannels = GetChannelCount(mixer->deviceID, port->scope == kAudioDevicePropertyScopeOutput ? 1 : 0); | ^ git/jdk/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp:775:24: error: variable length arrays in C++ are a Clang extension [-Werror,-Wvla-cxx-extension] 775 | Float32 subVolumes[control->controlCount]; | ^ git/jdk/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp:775:24: note: read of non-constexpr variable 'control' is not allowed in a constant expression git/jdk/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp:772:18: note: declared here 772 | PortControl *control = (PortControl *)controlIDV; | ^ git/jdk/src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp:824:24: error: variable length arrays in C++ are a Cl