Recommended GCC version for JDK17+?

erik.joelsson at erik.joelsson at
Wed Jan 5 14:25:34 UTC 2022

Hello Stewart,

The short answer is no, there is no official or definitive recommended 
compiler version for OpenJDK. The wiki page you linked as the closest 
thing we have, a page where different distributors of OpenJDK may list 
the versions they use and test with. Choosing the same or similar for 
your build is more likely to work well. Reading your email I was 
reminded that I had neglected to update that wiki with Oracle build 
platforms for a while, which I have now done.

The sentence about 10.2 is intentionally vague, but you are right, it 
should have been updated to reference 10.3 when Oracle switched GCC 
version in JDK 17.

It should also be noted that there is more to a compiler toolchain than 
just the version number of the compiler. If you use the GCC/binutils 
from a particular Linux distribution, it often comes with a set of 
patches on top of the official source distribution. The versions of 
system headers and libraries that you possibly statically link against 
(optional) may also affect the final product. In the end, only testing 
can verify that a particular build of OpenJDK works as well as it should.

If you would like to emulate the toolchains Oracle uses exactly, the 
scripts we used to generate our "devkits" (portable toolchains) are 
available in make/devkit/ in the relevant repo.


On 2021-12-22 06:21, Stewart Addison wrote:
> Hi everyone,
> What is the definitive "recommended" version of GCC to use for building
> JDK17 and later?
> The reason for asking is because the OpenJDK wiki seems to recommend the
> (Red Hat vendor branch) GCC 8.2.1:
> The JDK17+, however, seems to reference 10.2 as the "known to
> work" version:
> (But also
> states that anything at 5.0 and above /should/ also work)
> Looking at what some of the different openjdk providers use there seems to
> be a mix of versions in use although 7.3.1 seems particularly popular -
> possibly because 7.3 is listed in the devkits section of the document, or
> because 7.3.0 is the one listed in the for jdk11u and some
> vendors have just stuck with it for now. Oracle's current JDK17 seems to
> use a more recent version than other providers - 10.3 from what I can tell.
> While different versions obviously work, is there a formal "recommended"
> version of GCC that should be used for compiling production versions of
> JDK17 on Linux? My gut feel is that it should possibly be 10.2 or a later
> 10 as the one listed as being known to work, but Oracle seems to have gone
> one up from that too so perhaps 10.2 should be replaced with 10.3 in the
> docs now ... And should the wiki be adjusted to be in sync with the level
> mentioned in And I guess one final question would be whether
> anyone has done any comparisons with JDKs compiled with different versions
> that might sway any decisions?
> Regards,
> Stewart...
> --
> Working on Adoptium Temurin <> for Red Hat
> <> <>

More information about the jdk-dev mailing list