Alright, thank you Thomas, thank you Erik! Using JDK 19 as boot JDK does make the JDK 20 build work; I didn't know the recommendation was to use the previous JDK as a boot JDK.
On Fri, 15 Mar 2024 at 17:55, <erik.joels...@oracle.com> wrote: > The configure flag --disable-warnings-as-errors only applies to native > compilation, where the C/C++ compiler is used. For Java compilation, > most of the source code is built using the interim javac, which is > itself built from the JDK src, so we have full control over what > warnings should or shouldn't be enabled. The rest of the Java source > code is compiled using the javac in the bootjdk, which is also well > defined. > > Your build is failing when compiling the interim javac using the > bootjdk. That could only happen if you use a bootjdk that isn't > appropriate for the version of the JDK src. We generally allow bootjdk > of version N-1 or N for building JDK N. However, using a newer build of > JDK N than the source in question does run the risk of having new > warnings that haven't been fixed in the older source. So using bootjdk > version N isn't recommended unless you know what you are doing. > > The recommendation is to always use JDK N-1 for bootjdk. That's the > officially supported version. > > /Erik > > On 3/15/24 08:27, S A wrote: > > Hi all, > > > > how do I disable warnings treated as errors during the OpenJDK 19+ build? > > > > In order to better understand changes in behavior between OpenJDK > > versions, I've been bisecting and compiling OpenJDK 19 and OpenJDK 20 > > in the recent months. > > > > One problem that I run into a lot is warnings failing the build. How > > do I disable this behavior? Due to different work environments, I > > compile with a few versions of gcc, so the warnings differ based on > > the gcc version. So far I've been changing the gcc version in order to > > be able to compile, but this is tiresome. > > > > According to the guide, the behavior can be configured away: > > > > https://openjdk.org/groups/build/doc/building.html > > > > > By default, the JDK has a strict approach where warnings from the > > compiler is considered errors which fail the build. For very new or > > very old compiler versions, this can trigger new classes of warnings, > > which thus fails the build. Run configure with > > --disable-warnings-as-errors to turn of this behavior. (The warnings > > will still show, but not make the build fail.) > > > > Unfortunately, e.g. with OpenJDK 20, the build still fails due to > > warnings. Has the configuration option changed? > > > > E.g. using gcc: > > > > gcc version 10.2.1 > > > > Building at commit: > > > > commit 388a56e4c4278f2a3da31946b15a45f3aee25e58 (HEAD, tag: jdk-20+20) > > > > I run into warnings that cause the build to fail: > > > > ERROR: Build failed for target 'images' in configuration > > 'linux-x86_64-server-release' (exit code 2) > > > > === Output from failing command(s) repeated here === > > * For target > > > buildtools_interim_langtools_modules_jdk.compiler.interim__the.BUILD_jdk.compiler.interim_batch: > > > /data/git/jdk/src/jdk.compiler/share/classes/com/sun/tools/javac/file/FSInfo.java:140: > > > warning: [deprecation] URL(URL,String) in URL has been deprecated > > URL retVal = new URL(base, input); > > ^ > > error: warnings found and -Werror specified > > > /data/git/jdk/src/jdk.compiler/share/classes/com/sun/tools/javac/launcher/Main.java:693: > > > warning: [deprecation] URL(String,String,int,String,URLStreamHandler) > > in URL has been deprecated > > return new URL(PROTOCOL, null, -1, name, handler); > > ^ > > > /data/git/jdk/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/ServiceProxy.java:141: > > > warning: [deprecation] URL(URL,String) in URL has been deprecated > > URL u = new URL(url, fullName); > > ^ > > 1 error > > 3 warnings > > > > Despite configuration: > > > > using configure arguments '--disable-warnings-as-errors > > --with-boot-jdk=/data/jdk/openjdk-20.0.2_linux-x64_bin/jdk-20.0.2/ > > --with-toolchain-type=gcc' > > > > Best regards and thanks, > > Simeon >