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