Hi Simeon, not a direct help, and I don't know the answer either, but I ran into exactly the same problem today and switched to JDK 19 as boot jdk, which proved a valid workaround.
Cheers, Thomas On Fri, Mar 15, 2024 at 4:28 PM S A <simeon.danailov.andr...@gmail.com> 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 >