1 <!DOCTYPE html>
   2 <html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
   3 <head>
   4   <meta charset="utf-8" />
   5   <meta name="generator" content="pandoc" />
   6   <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
   7   <title>Building the JDK</title>
   8   <style>
   9     code{white-space: pre-wrap;}
  10     span.smallcaps{font-variant: small-caps;}
  11     div.columns{display: flex; gap: min(4vw, 1.5em);}
  12     div.column{flex: auto; overflow-x: auto;}
  13     div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
  14     ul.task-list{list-style: none;}
  15     ul.task-list li input[type="checkbox"] {
  16       width: 0.8em;
  17       margin: 0 0.8em 0.2em -1.6em;
  18       vertical-align: middle;
  19     }
  20     .display.math{display: block; text-align: center; margin: 0.5rem auto;}
  21   </style>
  22   <link rel="stylesheet" href="../make/data/docs-resources/resources/jdk-default.css" />
  23   <style type="text/css">pre, code, tt { color: #1d6ae5; }</style>
  24   <!--[if lt IE 9]>
  25     <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
  26   <![endif]-->
  27 </head>
  28 <body>
  29 <header id="title-block-header">
  30 <h1 class="title">Building the JDK</h1>
  31 </header>
  32 <nav id="TOC" role="doc-toc">
  33 <ul>
  34 <li><a href="#tldr-instructions-for-the-impatient"
  35 id="toc-tldr-instructions-for-the-impatient">TL;DR (Instructions for the
  36 Impatient)</a></li>
  37 <li><a href="#introduction" id="toc-introduction">Introduction</a></li>
  38 <li><a href="#getting-the-source-code"
  39 id="toc-getting-the-source-code">Getting the Source Code</a>
  40 <ul>
  41 <li><a href="#special-considerations"
  42 id="toc-special-considerations">Special Considerations</a></li>
  43 </ul></li>
  44 <li><a href="#build-hardware-requirements"
  45 id="toc-build-hardware-requirements">Build Hardware Requirements</a>
  46 <ul>
  47 <li><a href="#building-on-x86" id="toc-building-on-x86">Building on
  48 x86</a></li>
  49 <li><a href="#building-on-aarch64" id="toc-building-on-aarch64">Building
  50 on aarch64</a></li>
  51 <li><a href="#building-on-32-bit-arm"
  52 id="toc-building-on-32-bit-arm">Building on 32-bit arm</a></li>
  53 </ul></li>
  54 <li><a href="#operating-system-requirements"
  55 id="toc-operating-system-requirements">Operating System Requirements</a>
  56 <ul>
  57 <li><a href="#windows" id="toc-windows">Windows</a></li>
  58 <li><a href="#macos" id="toc-macos">macOS</a></li>
  59 <li><a href="#linux" id="toc-linux">Linux</a></li>
  60 <li><a href="#aix" id="toc-aix">AIX</a></li>
  61 </ul></li>
  62 <li><a href="#native-compiler-toolchain-requirements"
  63 id="toc-native-compiler-toolchain-requirements">Native Compiler
  64 (Toolchain) Requirements</a>
  65 <ul>
  66 <li><a href="#gcc" id="toc-gcc">gcc</a></li>
  67 <li><a href="#clang" id="toc-clang">clang</a></li>
  68 <li><a href="#apple-xcode" id="toc-apple-xcode">Apple Xcode</a></li>
  69 <li><a href="#microsoft-visual-studio"
  70 id="toc-microsoft-visual-studio">Microsoft Visual Studio</a></li>
  71 <li><a href="#ibm-xl-cc" id="toc-ibm-xl-cc">IBM XL C/C++</a></li>
  72 </ul></li>
  73 <li><a href="#boot-jdk-requirements" id="toc-boot-jdk-requirements">Boot
  74 JDK Requirements</a>
  75 <ul>
  76 <li><a href="#getting-jdk-binaries"
  77 id="toc-getting-jdk-binaries">Getting JDK binaries</a></li>
  78 </ul></li>
  79 <li><a href="#external-library-requirements"
  80 id="toc-external-library-requirements">External Library Requirements</a>
  81 <ul>
  82 <li><a href="#freetype" id="toc-freetype">FreeType</a></li>
  83 <li><a href="#cups" id="toc-cups">CUPS</a></li>
  84 <li><a href="#x11" id="toc-x11">X11</a></li>
  85 <li><a href="#alsa" id="toc-alsa">ALSA</a></li>
  86 <li><a href="#libffi" id="toc-libffi">libffi</a></li>
  87 </ul></li>
  88 <li><a href="#build-tools-requirements"
  89 id="toc-build-tools-requirements">Build Tools Requirements</a>
  90 <ul>
  91 <li><a href="#autoconf" id="toc-autoconf">Autoconf</a></li>
  92 <li><a href="#gnu-make" id="toc-gnu-make">GNU Make</a></li>
  93 <li><a href="#gnu-bash" id="toc-gnu-bash">GNU Bash</a></li>
  94 </ul></li>
  95 <li><a href="#running-configure" id="toc-running-configure">Running
  96 Configure</a>
  97 <ul>
  98 <li><a href="#common-configure-arguments"
  99 id="toc-common-configure-arguments">Common Configure Arguments</a></li>
 100 <li><a href="#configure-control-variables"
 101 id="toc-configure-control-variables">Configure Control
 102 Variables</a></li>
 103 </ul></li>
 104 <li><a href="#running-make" id="toc-running-make">Running Make</a>
 105 <ul>
 106 <li><a href="#common-make-targets" id="toc-common-make-targets">Common
 107 Make Targets</a></li>
 108 <li><a href="#make-control-variables"
 109 id="toc-make-control-variables">Make Control Variables</a></li>
 110 </ul></li>
 111 <li><a href="#running-tests" id="toc-running-tests">Running
 112 Tests</a></li>
 113 <li><a href="#signing" id="toc-signing">Signing</a>
 114 <ul>
 115 <li><a href="#macos-1" id="toc-macos-1">macOS</a></li>
 116 </ul></li>
 117 <li><a href="#cross-compiling"
 118 id="toc-cross-compiling">Cross-compiling</a>
 119 <ul>
 120 <li><a href="#cross-compiling-the-easy-way-with-openjdk-devkits"
 121 id="toc-cross-compiling-the-easy-way-with-openjdk-devkits">Cross
 122 compiling the easy way with OpenJDK devkits</a></li>
 123 <li><a href="#boot-jdk-and-build-jdk"
 124 id="toc-boot-jdk-and-build-jdk">Boot JDK and Build JDK</a></li>
 125 <li><a href="#specifying-the-target-platform"
 126 id="toc-specifying-the-target-platform">Specifying the Target
 127 Platform</a></li>
 128 <li><a href="#toolchain-considerations"
 129 id="toc-toolchain-considerations">Toolchain Considerations</a></li>
 130 <li><a href="#native-libraries" id="toc-native-libraries">Native
 131 Libraries</a></li>
 132 <li><a href="#cross-compiling-with-debian-sysroots"
 133 id="toc-cross-compiling-with-debian-sysroots">Cross compiling with
 134 Debian sysroots</a></li>
 135 <li><a href="#building-for-armaarch64"
 136 id="toc-building-for-armaarch64">Building for ARM/aarch64</a></li>
 137 <li><a href="#building-for-musl" id="toc-building-for-musl">Building for
 138 musl</a></li>
 139 <li><a href="#verifying-the-build"
 140 id="toc-verifying-the-build">Verifying the Build</a></li>
 141 </ul></li>
 142 <li><a href="#build-performance" id="toc-build-performance">Build
 143 Performance</a>
 144 <ul>
 145 <li><a href="#disk-speed" id="toc-disk-speed">Disk Speed</a></li>
 146 <li><a href="#virus-checking" id="toc-virus-checking">Virus
 147 Checking</a></li>
 148 <li><a href="#ccache" id="toc-ccache">Ccache</a></li>
 149 <li><a href="#precompiled-headers"
 150 id="toc-precompiled-headers">Precompiled Headers</a></li>
 151 <li><a href="#icecc-icecream" id="toc-icecc-icecream">Icecc /
 152 icecream</a></li>
 153 <li><a href="#using-the-javac-server"
 154 id="toc-using-the-javac-server">Using the javac server</a></li>
 155 <li><a href="#building-the-right-target"
 156 id="toc-building-the-right-target">Building the Right Target</a></li>
 157 </ul></li>
 158 <li><a href="#troubleshooting"
 159 id="toc-troubleshooting">Troubleshooting</a>
 160 <ul>
 161 <li><a href="#locating-the-source-of-the-error"
 162 id="toc-locating-the-source-of-the-error">Locating the Source of the
 163 Error</a></li>
 164 <li><a href="#fixing-unexpected-build-failures"
 165 id="toc-fixing-unexpected-build-failures">Fixing Unexpected Build
 166 Failures</a></li>
 167 <li><a href="#specific-build-issues"
 168 id="toc-specific-build-issues">Specific Build Issues</a></li>
 169 <li><a href="#getting-help" id="toc-getting-help">Getting Help</a></li>
 170 </ul></li>
 171 <li><a href="#reproducible-builds"
 172 id="toc-reproducible-builds">Reproducible Builds</a></li>
 173 <li><a href="#hints-and-suggestions-for-advanced-users"
 174 id="toc-hints-and-suggestions-for-advanced-users">Hints and Suggestions
 175 for Advanced Users</a>
 176 <ul>
 177 <li><a href="#bash-completion" id="toc-bash-completion">Bash
 178 Completion</a></li>
 179 <li><a href="#using-multiple-configurations"
 180 id="toc-using-multiple-configurations">Using Multiple
 181 Configurations</a></li>
 182 <li><a href="#handling-reconfigurations"
 183 id="toc-handling-reconfigurations">Handling Reconfigurations</a></li>
 184 <li><a href="#using-fine-grained-make-targets"
 185 id="toc-using-fine-grained-make-targets">Using Fine-Grained Make
 186 Targets</a></li>
 187 </ul></li>
 188 <li><a href="#understanding-the-build-system"
 189 id="toc-understanding-the-build-system">Understanding the Build
 190 System</a>
 191 <ul>
 192 <li><a href="#configurations"
 193 id="toc-configurations">Configurations</a></li>
 194 <li><a href="#build-output-structure"
 195 id="toc-build-output-structure">Build Output Structure</a></li>
 196 <li><a href="#fixpath" id="toc-fixpath">Fixpath</a></li>
 197 <li><a href="#native-debug-symbols" id="toc-native-debug-symbols">Native
 198 Debug Symbols</a></li>
 199 <li><a href="#autoconf-details" id="toc-autoconf-details">Autoconf
 200 Details</a></li>
 201 <li><a href="#developing-the-build-system-itself"
 202 id="toc-developing-the-build-system-itself">Developing the Build System
 203 Itself</a></li>
 204 </ul></li>
 205 <li><a href="#contributing-to-the-jdk"
 206 id="toc-contributing-to-the-jdk">Contributing to the JDK</a></li>
 207 <li><a href="#editing-this-document"
 208 id="toc-editing-this-document">Editing this document</a></li>
 209 </ul>
 210 </nav>
 211 <h2 id="tldr-instructions-for-the-impatient">TL;DR (Instructions for the
 212 Impatient)</h2>
 213 <p>If you are eager to try out building the JDK, these simple steps
 214 works most of the time. They assume that you have installed Git (and
 215 Cygwin if running on Windows) and cloned the top-level JDK repository
 216 that you want to build.</p>
 217 <ol type="1">
 218 <li><p><a href="#getting-the-source-code">Get the complete source
 219 code</a>:<br />
 220 <code>git clone https://git.openjdk.org/jdk/</code></p></li>
 221 <li><p><a href="#running-configure">Run configure</a>:<br />
 222 <code>bash configure</code></p>
 223 <p>If <code>configure</code> fails due to missing dependencies (to
 224 either the <a
 225 href="#native-compiler-toolchain-requirements">toolchain</a>, <a
 226 href="#build-tools-requirements">build tools</a>, <a
 227 href="#external-library-requirements">external libraries</a> or the <a
 228 href="#boot-jdk-requirements">boot JDK</a>), most of the time it prints
 229 a suggestion on how to resolve the situation on your platform. Follow
 230 the instructions, and try running <code>bash configure</code>
 231 again.</p></li>
 232 <li><p><a href="#running-make">Run make</a>:<br />
 233 <code>make images</code></p></li>
 234 <li><p>Verify your newly built JDK:<br />
 235 <code>./build/*/images/jdk/bin/java -version</code></p></li>
 236 <li><p><a href="##running-tests">Run basic tests</a>:<br />
 237 <code>make run-test-tier1</code></p></li>
 238 </ol>
 239 <p>If any of these steps failed, or if you want to know more about build
 240 requirements or build functionality, please continue reading this
 241 document.</p>
 242 <h2 id="introduction">Introduction</h2>
 243 <p>The JDK is a complex software project. Building it requires a certain
 244 amount of technical expertise, a fair number of dependencies on external
 245 software, and reasonably powerful hardware.</p>
 246 <p>If you just want to use the JDK and not build it yourself, this
 247 document is not for you. See for instance <a
 248 href="http://openjdk.org/install">OpenJDK installation</a> for some
 249 methods of installing a prebuilt JDK.</p>
 250 <h2 id="getting-the-source-code">Getting the Source Code</h2>
 251 <p>Make sure you are getting the correct version. As of JDK 10, the
 252 source is no longer split into separate repositories so you only need to
 253 clone one single repository. At the <a
 254 href="https://git.openjdk.org/">OpenJDK Git site</a> you can see a list
 255 of all available repositories. If you want to build an older version,
 256 e.g. JDK 11, it is recommended that you get the <code>jdk11u</code>
 257 repo, which contains incremental updates, instead of the
 258 <code>jdk11</code> repo, which was frozen at JDK 11 GA.</p>
 259 <p>If you are new to Git, a good place to start is the book <a
 260 href="https://git-scm.com/book/en/v2">Pro Git</a>. The rest of this
 261 document assumes a working knowledge of Git.</p>
 262 <h3 id="special-considerations">Special Considerations</h3>
 263 <p>For a smooth building experience, it is recommended that you follow
 264 these rules on where and how to check out the source code.</p>
 265 <ul>
 266 <li><p>Do not check out the source code in a path which contains spaces.
 267 Chances are the build will not work. This is most likely to be an issue
 268 on Windows systems.</p></li>
 269 <li><p>Do not check out the source code in a path which has a very long
 270 name or is nested many levels deep. Chances are you will hit an OS
 271 limitation during the build.</p></li>
 272 <li><p>Put the source code on a local disk, not a network share. If
 273 possible, use an SSD. The build process is very disk intensive, and
 274 having slow disk access will significantly increase build times. If you
 275 need to use a network share for the source code, see below for
 276 suggestions on how to keep the build artifacts on a local disk.</p></li>
 277 <li><p>On Windows, if using <a href="#cygwin">Cygwin</a>, extra care
 278 must be taken to make sure the environment is consistent. It is
 279 recommended that you follow this procedure:</p>
 280 <ul>
 281 <li><p>Create the directory that is going to contain the top directory
 282 of the JDK clone by using the <code>mkdir</code> command in the Cygwin
 283 bash shell. That is, do <em>not</em> create it using Windows Explorer.
 284 This will ensure that it will have proper Cygwin attributes, and that
 285 it's children will inherit those attributes.</p></li>
 286 <li><p>Do not put the JDK clone in a path under your Cygwin home
 287 directory. This is especially important if your user name contains
 288 spaces and/or mixed upper and lower case letters.</p></li>
 289 <li><p>You need to install a git client. You have two choices, Cygwin
 290 git or Git for Windows. Unfortunately there are pros and cons with each
 291 choice.</p>
 292 <ul>
 293 <li><p>The Cygwin <code>git</code> client has no line ending issues and
 294 understands Cygwin paths (which are used throughout the JDK build
 295 system). However, it does not currently work well with the Skara CLI
 296 tooling. Please see the <a
 297 href="https://wiki.openjdk.org/display/SKARA/Skara#Skara-Git">Skara wiki
 298 on Git clients</a> for up-to-date information about the Skara git client
 299 support.</p></li>
 300 <li><p>The <a href="https://gitforwindows.org">Git for Windows</a>
 301 client has issues with line endings, and do not understand Cygwin paths.
 302 It does work well with the Skara CLI tooling, however. To alleviate the
 303 line ending problems, make sure you set <code>core.autocrlf</code> to
 304 <code>false</code> (this is asked during installation).</p></li>
 305 </ul></li>
 306 </ul>
 307 <p>Failure to follow this procedure might result in hard-to-debug build
 308 problems.</p></li>
 309 </ul>
 310 <h2 id="build-hardware-requirements">Build Hardware Requirements</h2>
 311 <p>The JDK is a massive project, and require machines ranging from
 312 decent to powerful to be able to build in a reasonable amount of time,
 313 or to be able to complete a build at all.</p>
 314 <p>We <em>strongly</em> recommend usage of an SSD disk for the build,
 315 since disk speed is one of the limiting factors for build
 316 performance.</p>
 317 <h3 id="building-on-x86">Building on x86</h3>
 318 <p>At a minimum, a machine with 2-4 cores is advisable, as well as 2-4
 319 GB of RAM. (The more cores to use, the more memory you need.) At least 6
 320 GB of free disk space is required.</p>
 321 <p>Even for 32-bit builds, it is recommended to use a 64-bit build
 322 machine, and instead create a 32-bit target using
 323 <code>--with-target-bits=32</code>.</p>
 324 <p>Note: The Windows x86 port is deprecated.</p>
 325 <h3 id="building-on-aarch64">Building on aarch64</h3>
 326 <p>At a minimum, a machine with 8 cores is advisable, as well as 8 GB of
 327 RAM. (The more cores to use, the more memory you need.) At least 6 GB of
 328 free disk space is required.</p>
 329 <p>If you do not have access to sufficiently powerful hardware, it is
 330 also possible to use <a href="#cross-compiling">cross-compiling</a>.</p>
 331 <h4 id="branch-protection">Branch Protection</h4>
 332 <p>In order to use Branch Protection features in the VM,
 333 <code>--enable-branch-protection</code> must be used. This option
 334 requires C++ compiler support (GCC 9.1.0+ or Clang 10+). The resulting
 335 build can be run on both machines with and without support for branch
 336 protection in hardware. Branch Protection is only supported for Linux
 337 targets.</p>
 338 <h3 id="building-on-32-bit-arm">Building on 32-bit arm</h3>
 339 <p>This is not recommended. Instead, see the section on <a
 340 href="#cross-compiling">Cross-compiling</a>.</p>
 341 <h2 id="operating-system-requirements">Operating System
 342 Requirements</h2>
 343 <p>The mainline JDK project supports Linux, macOS, AIX and Windows.
 344 Support for other operating system, e.g. BSD, exists in separate "port"
 345 projects.</p>
 346 <p>In general, the JDK can be built on a wide range of versions of these
 347 operating systems, but the further you deviate from what is tested on a
 348 daily basis, the more likely you are to run into problems.</p>
 349 <p>This table lists the OS versions used by Oracle when building the
 350 JDK. Such information is always subject to change, but this table is up
 351 to date at the time of writing.</p>
 352 <table>
 353 <thead>
 354 <tr class="header">
 355 <th style="text-align: left;">Operating system</th>
 356 <th style="text-align: left;">Vendor/version used</th>
 357 </tr>
 358 </thead>
 359 <tbody>
 360 <tr class="odd">
 361 <td style="text-align: left;">Linux</td>
 362 <td style="text-align: left;">Oracle Enterprise Linux 6.4 / 7.6</td>
 363 </tr>
 364 <tr class="even">
 365 <td style="text-align: left;">macOS</td>
 366 <td style="text-align: left;">Mac OS X 10.13 (High Sierra)</td>
 367 </tr>
 368 <tr class="odd">
 369 <td style="text-align: left;">Windows</td>
 370 <td style="text-align: left;">Windows Server 2012 R2</td>
 371 </tr>
 372 </tbody>
 373 </table>
 374 <p>The double version numbers for Linux are due to the hybrid model used
 375 at Oracle, where header files and external libraries from an older
 376 version are used when building on a more modern version of the OS.</p>
 377 <p>The Build Group has a wiki page with <a
 378 href="https://wiki.openjdk.org/display/Build/Supported+Build+Platforms">Supported
 379 Build Platforms</a>. From time to time, this is updated by contributors
 380 to list successes or failures of building on different platforms.</p>
 381 <h3 id="windows">Windows</h3>
 382 <p>Windows XP is not a supported platform, but all newer Windows should
 383 be able to build the JDK.</p>
 384 <p>On Windows, it is important that you pay attention to the
 385 instructions in the <a href="#special-considerations">Special
 386 Considerations</a>.</p>
 387 <p>Windows is the only non-POSIX OS supported by the JDK, and as such,
 388 requires some extra care. A POSIX support layer is required to build on
 389 Windows. Currently, the only supported such layers are Cygwin, Windows
 390 Subsystem for Linux (WSL), and MSYS2. (MSYS is no longer supported due
 391 to an outdated bash; While OpenJDK can be built with MSYS2, support for
 392 it is still experimental, so build failures and unusual errors are not
 393 uncommon.)</p>
 394 <p>Internally in the build system, all paths are represented as
 395 Unix-style paths, e.g. <code>/cygdrive/c/git/jdk/Makefile</code> rather
 396 than <code>C:\git\jdk\Makefile</code>. This rule also applies to input
 397 to the build system, e.g. in arguments to <code>configure</code>. So,
 398 use <code>--with-msvcr-dll=/cygdrive/c/msvcr100.dll</code> rather than
 399 <code>--with-msvcr-dll=c:\msvcr100.dll</code>. For details on this
 400 conversion, see the section on <a href="#fixpath">Fixpath</a>.</p>
 401 <p>Note: The Windows x86 port is deprecated.</p>
 402 <h4 id="cygwin">Cygwin</h4>
 403 <p>A functioning <a href="http://www.cygwin.com/">Cygwin</a> environment
 404 is required for building the JDK on Windows. If you have a 64-bit OS, we
 405 strongly recommend using the 64-bit version of Cygwin.</p>
 406 <p><strong>Note:</strong> Cygwin has a model of continuously updating
 407 all packages without any easy way to install or revert to a specific
 408 version of a package. This means that whenever you add or update a
 409 package in Cygwin, you might (inadvertently) update tools that are used
 410 by the JDK build process, and that can cause unexpected build
 411 problems.</p>
 412 <p>The JDK requires GNU Make 4.0 or greater in Cygwin. This is usually
 413 not a problem, since Cygwin currently only distributes GNU Make at a
 414 version above 4.0.</p>
 415 <p>Apart from the basic Cygwin installation, the following packages must
 416 also be installed:</p>
 417 <ul>
 418 <li><code>autoconf</code></li>
 419 <li><code>make</code></li>
 420 <li><code>zip</code></li>
 421 <li><code>unzip</code></li>
 422 </ul>
 423 <p>Often, you can install these packages using the following command
 424 line:</p>
 425 <pre><code>&lt;path to Cygwin setup&gt;/setup-x86_64 -q -P autoconf -P make -P unzip -P zip</code></pre>
 426 <p>Unfortunately, Cygwin can be unreliable in certain circumstances. If
 427 you experience build tool crashes or strange issues when building on
 428 Windows, please check the Cygwin FAQ on the <a
 429 href="https://cygwin.com/faq/faq.html#faq.using.bloda">"BLODA" list</a>
 430 and the section on <a
 431 href="https://cygwin.com/faq/faq.html#faq.using.fixing-fork-failures">fork()
 432 failures</a>.</p>
 433 <h4 id="windows-subsystem-for-linux-wsl">Windows Subsystem for Linux
 434 (WSL)</h4>
 435 <p>Windows 10 1809 or newer is supported due to a dependency on the
 436 wslpath utility and support for environment variable sharing through
 437 WSLENV. Version 1803 can work but intermittent build failures have been
 438 observed.</p>
 439 <p>It's possible to build both Windows and Linux binaries from WSL. To
 440 build Windows binaries, you must use a Windows boot JDK (located in a
 441 Windows-accessible directory). To build Linux binaries, you must use a
 442 Linux boot JDK. The default behavior is to build for Windows. To build
 443 for Linux, pass
 444 <code>--build=x86_64-unknown-linux-gnu --openjdk-target=x86_64-unknown-linux-gnu</code>
 445 to <code>configure</code>.</p>
 446 <p>If building Windows binaries, the source code must be located in a
 447 Windows- accessible directory. This is because Windows executables (such
 448 as Visual Studio and the boot JDK) must be able to access the source
 449 code. Also, the drive where the source is stored must be mounted as
 450 case-insensitive by changing either /etc/fstab or /etc/wsl.conf in WSL.
 451 Individual directories may be corrected using the fsutil tool in case
 452 the source was cloned before changing the mount options.</p>
 453 <p>Note that while it's possible to build on WSL, testing is still not
 454 fully supported.</p>
 455 <h3 id="macos">macOS</h3>
 456 <p>Apple is using a quite aggressive scheme of pushing OS updates, and
 457 coupling these updates with required updates of Xcode. Unfortunately,
 458 this makes it difficult for a project such as the JDK to keep pace with
 459 a continuously updated machine running macOS. See the section on <a
 460 href="#apple-xcode">Apple Xcode</a> on some strategies to deal with
 461 this.</p>
 462 <p>It is recommended that you use at least Mac OS X 10.13 (High Sierra).
 463 At the time of writing, the JDK has been successfully compiled on macOS
 464 10.12 (Sierra).</p>
 465 <p>The standard macOS environment contains the basic tooling needed to
 466 build, but for external libraries a package manager is recommended. The
 467 JDK uses <a href="https://brew.sh/">homebrew</a> in the examples, but
 468 feel free to use whatever manager you want (or none).</p>
 469 <h3 id="linux">Linux</h3>
 470 <p>It is often not much problem to build the JDK on Linux. The only
 471 general advice is to try to use the compilers, external libraries and
 472 header files as provided by your distribution.</p>
 473 <p>The basic tooling is provided as part of the core operating system,
 474 but you will most likely need to install developer packages.</p>
 475 <p>For apt-based distributions (Debian, Ubuntu, etc), try this:</p>
 476 <pre><code>sudo apt-get install build-essential</code></pre>
 477 <p>For rpm-based distributions (Fedora, Red Hat, etc), try this:</p>
 478 <pre><code>sudo yum groupinstall &quot;Development Tools&quot;</code></pre>
 479 <p>For Alpine Linux, aside from basic tooling, install the GNU versions
 480 of some programs:</p>
 481 <pre><code>sudo apk add build-base bash grep zip</code></pre>
 482 <h3 id="aix">AIX</h3>
 483 <p>Please consult the AIX section of the <a
 484 href="https://wiki.openjdk.org/display/Build/Supported+Build+Platforms">Supported
 485 Build Platforms</a> OpenJDK Build Wiki page for details about which
 486 versions of AIX are supported.</p>
 487 <h2 id="native-compiler-toolchain-requirements">Native Compiler
 488 (Toolchain) Requirements</h2>
 489 <p>Large portions of the JDK consists of native code, that needs to be
 490 compiled to be able to run on the target platform. In theory, toolchain
 491 and operating system should be independent factors, but in practice
 492 there's more or less a one-to-one correlation between target operating
 493 system and toolchain. There are ongoing efforts to loosen this strict
 494 coupling between compiler and operating system (see <a
 495 href="https://bugs.openjdk.org/browse/JDK-8288293">JDK-8288293</a>) but
 496 it will likely be a very long time before this goal can be realized.</p>
 497 <table>
 498 <thead>
 499 <tr class="header">
 500 <th>Operating system</th>
 501 <th>Supported toolchain</th>
 502 </tr>
 503 </thead>
 504 <tbody>
 505 <tr class="odd">
 506 <td>Linux</td>
 507 <td>gcc, clang</td>
 508 </tr>
 509 <tr class="even">
 510 <td>macOS</td>
 511 <td>Apple Xcode (using clang)</td>
 512 </tr>
 513 <tr class="odd">
 514 <td>AIX</td>
 515 <td>IBM XL C/C++</td>
 516 </tr>
 517 <tr class="even">
 518 <td>Windows</td>
 519 <td>Microsoft Visual Studio</td>
 520 </tr>
 521 </tbody>
 522 </table>
 523 <p>Please see the individual sections on the toolchains for version
 524 recommendations. As a reference, these versions of the toolchains are
 525 used, at the time of writing, by Oracle for the daily builds of the JDK.
 526 It should be possible to compile the JDK with both older and newer
 527 versions, but the closer you stay to this list, the more likely you are
 528 to compile successfully without issues.</p>
 529 <table>
 530 <thead>
 531 <tr class="header">
 532 <th>Operating system</th>
 533 <th>Toolchain version</th>
 534 </tr>
 535 </thead>
 536 <tbody>
 537 <tr class="odd">
 538 <td>Linux</td>
 539 <td>gcc 11.2.0</td>
 540 </tr>
 541 <tr class="even">
 542 <td>macOS</td>
 543 <td>Apple Xcode 10.1 (using clang 10.0.0)</td>
 544 </tr>
 545 <tr class="odd">
 546 <td>Windows</td>
 547 <td>Microsoft Visual Studio 2022 update 17.1.0</td>
 548 </tr>
 549 </tbody>
 550 </table>
 551 <p>All compilers are expected to be able to compile to the C99 language
 552 standard, as some C99 features are used in the source code. Microsoft
 553 Visual Studio doesn't fully support C99 so in practice shared code is
 554 limited to using C99 features that it does support.</p>
 555 <h3 id="gcc">gcc</h3>
 556 <p>The minimum accepted version of gcc is 5.0. Older versions will
 557 generate a warning by <code>configure</code> and are unlikely to
 558 work.</p>
 559 <p>The JDK is currently known to be able to compile with at least
 560 version 11.2 of gcc.</p>
 561 <p>In general, any version between these two should be usable.</p>
 562 <h3 id="clang">clang</h3>
 563 <p>The minimum accepted version of clang is 3.5. Older versions will not
 564 be accepted by <code>configure</code>.</p>
 565 <p>To use clang instead of gcc on Linux, use
 566 <code>--with-toolchain-type=clang</code>.</p>
 567 <h3 id="apple-xcode">Apple Xcode</h3>
 568 <p>The oldest supported version of Xcode is 8.</p>
 569 <p>You will need the Xcode command line developer tools to be able to
 570 build the JDK. (Actually, <em>only</em> the command line tools are
 571 needed, not the IDE.) The simplest way to install these is to run:</p>
 572 <pre><code>xcode-select --install</code></pre>
 573 <p>When updating Xcode, it is advisable to keep an older version for
 574 building the JDK. To use a specific version of Xcode you have multiple
 575 options:</p>
 576 <ul>
 577 <li>Use <code>xcode-select -s</code> before running
 578 <code>configure</code>, e.g.
 579 <code>xcode-select -s /Applications/Xcode13.1.app</code>. The drawback
 580 is that the setting is system wide and you may have to revert it after
 581 an OpenJDK build.</li>
 582 <li>Use configure option <code>--with-xcode-path</code>, e.g.
 583 <code>configure --with-xcode-path=/Applications/Xcode13.1.app</code>
 584 This allows using a specific Xcode version for an OpenJDK build,
 585 independently of the active Xcode version by
 586 <code>xcode-select</code>.</li>
 587 </ul>
 588 <p>If you have recently (inadvertently) updated your OS and/or Xcode
 589 version, and the JDK can no longer be built, please see the section on
 590 <a href="#problems-with-the-build-environment">Problems with the Build
 591 Environment</a>, and <a href="#getting-help">Getting Help</a> to find
 592 out if there are any recent, non-merged patches available for this
 593 update.</p>
 594 <h3 id="microsoft-visual-studio">Microsoft Visual Studio</h3>
 595 <p>The minimum accepted version is Visual Studio 2019 version 16.8.
 596 (Note that this version is often presented as "MSVC 14.28", and reported
 597 by cl.exe as 19.28.) Older versions will not be accepted by
 598 <code>configure</code> and will not work. The maximum accepted version
 599 of Visual Studio is 2022.</p>
 600 <p>If you have multiple versions of Visual Studio installed,
 601 <code>configure</code> will by default pick the latest. You can request
 602 a specific version to be used by setting
 603 <code>--with-toolchain-version</code>, e.g.
 604 <code>--with-toolchain-version=2022</code>.</p>
 605 <p>If you have Visual Studio installed but <code>configure</code> fails
 606 to detect it, it may be because of <a href="#spaces-in-path">spaces in
 607 path</a>.</p>
 608 <h3 id="ibm-xl-cc">IBM XL C/C++</h3>
 609 <p>Please consult the AIX section of the <a
 610 href="https://wiki.openjdk.org/display/Build/Supported+Build+Platforms">Supported
 611 Build Platforms</a> OpenJDK Build Wiki page for details about which
 612 versions of XLC are supported.</p>
 613 <h2 id="boot-jdk-requirements">Boot JDK Requirements</h2>
 614 <p>Paradoxically, building the JDK requires a pre-existing JDK. This is
 615 called the "boot JDK". The boot JDK does not, however, have to be a JDK
 616 built directly from the source code available in the OpenJDK Community.
 617 If you are porting the JDK to a new platform, chances are that there
 618 already exists another JDK for that platform that is usable as boot
 619 JDK.</p>
 620 <p>The rule of thumb is that the boot JDK for building JDK major version
 621 <em>N</em> should be a JDK of major version <em>N-1</em>, so for
 622 building JDK 9 a JDK 8 would be suitable as boot JDK. However, the JDK
 623 should be able to "build itself", so an up-to-date build of the current
 624 JDK source is an acceptable alternative. If you are following the
 625 <em>N-1</em> rule, make sure you've got the latest update version, since
 626 JDK 8 GA might not be able to build JDK 9 on all platforms.</p>
 627 <p>Early in the release cycle, version <em>N-1</em> may not yet have
 628 been released. In that case, the preferred boot JDK will be version
 629 <em>N-2</em> until version <em>N-1</em> is available.</p>
 630 <p>If the boot JDK is not automatically detected, or the wrong JDK is
 631 picked, use <code>--with-boot-jdk</code> to point to the JDK to use.</p>
 632 <h3 id="getting-jdk-binaries">Getting JDK binaries</h3>
 633 <p>JDK binaries for Linux, Windows and macOS can be downloaded from <a
 634 href="http://jdk.java.net">jdk.java.net</a>. An alternative is to
 635 download the <a
 636 href="http://www.oracle.com/technetwork/java/javase/downloads">Oracle
 637 JDK</a>. Another is the <a href="https://adoptopenjdk.net/">Adopt
 638 OpenJDK Project</a>, which publishes experimental prebuilt binaries for
 639 various platforms.</p>
 640 <p>On Linux you can also get a JDK from the Linux distribution. On
 641 apt-based distros (like Debian and Ubuntu),
 642 <code>sudo apt-get install openjdk-&lt;VERSION&gt;-jdk</code> is
 643 typically enough to install a JDK &lt;VERSION&gt;. On rpm-based distros
 644 (like Fedora and Red Hat), try
 645 <code>sudo yum install java-&lt;VERSION&gt;-openjdk-devel</code>.</p>
 646 <h2 id="external-library-requirements">External Library
 647 Requirements</h2>
 648 <p>Different platforms require different external libraries. In general,
 649 libraries are not optional - that is, they are either required or not
 650 used.</p>
 651 <p>If a required library is not detected by <code>configure</code>, you
 652 need to provide the path to it. There are two forms of the
 653 <code>configure</code> arguments to point to an external library:
 654 <code>--with-&lt;LIB&gt;=&lt;path&gt;</code> or
 655 <code>--with-&lt;LIB&gt;-include=&lt;path to include&gt; --with-&lt;LIB&gt;-lib=&lt;path to lib&gt;</code>.
 656 The first variant is more concise, but require the include files and
 657 library files to reside in a default hierarchy under this directory. In
 658 most cases, it works fine.</p>
 659 <p>As a fallback, the second version allows you to point to the include
 660 directory and the lib directory separately.</p>
 661 <h3 id="freetype">FreeType</h3>
 662 <p>FreeType2 from <a href="http://www.freetype.org/">The FreeType
 663 Project</a> is not required on any platform. The exception is on
 664 Unix-based platforms when configuring such that the build artifacts will
 665 reference a system installed library, rather than bundling the JDK's own
 666 copy.</p>
 667 <ul>
 668 <li>To install on an apt-based Linux, try running
 669 <code>sudo apt-get install     libfreetype6-dev</code>.</li>
 670 <li>To install on an rpm-based Linux, try running
 671 <code>sudo yum install     freetype-devel</code>.</li>
 672 <li>To install on Alpine Linux, try running
 673 <code>sudo apk add freetype-dev</code>.</li>
 674 <li>To install on macOS, try running
 675 <code>brew install freetype</code>.</li>
 676 </ul>
 677 <p>Use <code>--with-freetype-include=&lt;path&gt;</code> and
 678 <code>--with-freetype-lib=&lt;path&gt;</code> if <code>configure</code>
 679 does not automatically locate the platform FreeType files.</p>
 680 <h3 id="cups">CUPS</h3>
 681 <p>CUPS, <a href="http://www.cups.org">Common UNIX Printing System</a>
 682 header files are required on all platforms, except Windows. Often these
 683 files are provided by your operating system.</p>
 684 <ul>
 685 <li>To install on an apt-based Linux, try running
 686 <code>sudo apt-get install     libcups2-dev</code>.</li>
 687 <li>To install on an rpm-based Linux, try running
 688 <code>sudo yum install     cups-devel</code>.</li>
 689 <li>To install on Alpine Linux, try running
 690 <code>sudo apk add cups-dev</code>.</li>
 691 </ul>
 692 <p>Use <code>--with-cups=&lt;path&gt;</code> if <code>configure</code>
 693 does not properly locate your CUPS files.</p>
 694 <h3 id="x11">X11</h3>
 695 <p>Certain <a href="http://www.x.org/">X11</a> libraries and include
 696 files are required on Linux.</p>
 697 <ul>
 698 <li>To install on an apt-based Linux, try running
 699 <code>sudo apt-get install     libx11-dev libxext-dev libxrender-dev libxrandr-dev libxtst-dev libxt-dev</code>.</li>
 700 <li>To install on an rpm-based Linux, try running
 701 <code>sudo yum install     libXtst-devel libXt-devel libXrender-devel libXrandr-devel libXi-devel</code>.</li>
 702 <li>To install on Alpine Linux, try running
 703 <code>sudo apk add libx11-dev     libxext-dev libxrender-dev libxrandr-dev libxtst-dev libxt-dev</code>.</li>
 704 </ul>
 705 <p>Use <code>--with-x=&lt;path&gt;</code> if <code>configure</code> does
 706 not properly locate your X11 files.</p>
 707 <h3 id="alsa">ALSA</h3>
 708 <p>ALSA, <a href="https://www.alsa-project.org/">Advanced Linux Sound
 709 Architecture</a> is required on Linux. At least version 0.9.1 of ALSA is
 710 required.</p>
 711 <ul>
 712 <li>To install on an apt-based Linux, try running
 713 <code>sudo apt-get install     libasound2-dev</code>.</li>
 714 <li>To install on an rpm-based Linux, try running
 715 <code>sudo yum install     alsa-lib-devel</code>.</li>
 716 <li>To install on Alpine Linux, try running
 717 <code>sudo apk add alsa-lib-dev</code>.</li>
 718 </ul>
 719 <p>Use <code>--with-alsa=&lt;path&gt;</code> if <code>configure</code>
 720 does not properly locate your ALSA files.</p>
 721 <h3 id="libffi">libffi</h3>
 722 <p>libffi, the <a href="http://sourceware.org/libffi">Portable Foreign
 723 Function Interface Library</a> is required when building the Zero
 724 version of Hotspot.</p>
 725 <ul>
 726 <li>To install on an apt-based Linux, try running
 727 <code>sudo apt-get install     libffi-dev</code>.</li>
 728 <li>To install on an rpm-based Linux, try running
 729 <code>sudo yum install     libffi-devel</code>.</li>
 730 <li>To install on Alpine Linux, try running
 731 <code>sudo apk add libffi-dev</code>.</li>
 732 </ul>
 733 <p>Use <code>--with-libffi=&lt;path&gt;</code> if <code>configure</code>
 734 does not properly locate your libffi files.</p>
 735 <h2 id="build-tools-requirements">Build Tools Requirements</h2>
 736 <h3 id="autoconf">Autoconf</h3>
 737 <p>The JDK requires <a
 738 href="http://www.gnu.org/software/autoconf">Autoconf</a> on all
 739 platforms. At least version 2.69 is required.</p>
 740 <ul>
 741 <li>To install on an apt-based Linux, try running
 742 <code>sudo apt-get install     autoconf</code>.</li>
 743 <li>To install on an rpm-based Linux, try running
 744 <code>sudo yum install     autoconf</code>.</li>
 745 <li>To install on Alpine Linux, try running
 746 <code>sudo apk add autoconf</code>.</li>
 747 <li>To install on macOS, try running
 748 <code>brew install autoconf</code>.</li>
 749 <li>To install on Windows, try running
 750 <code>&lt;path to Cygwin setup&gt;/setup-x86_64 -q     -P autoconf</code>.</li>
 751 </ul>
 752 <p>If <code>configure</code> has problems locating your installation of
 753 autoconf, you can specify it using the <code>AUTOCONF</code> environment
 754 variable, like this:</p>
 755 <pre><code>AUTOCONF=&lt;path to autoconf&gt; configure ...</code></pre>
 756 <h3 id="gnu-make">GNU Make</h3>
 757 <p>The JDK requires <a href="http://www.gnu.org/software/make">GNU
 758 Make</a>. No other flavors of make are supported.</p>
 759 <p>At least version 3.81 of GNU Make must be used. For distributions
 760 supporting GNU Make 4.0 or above, we strongly recommend it. GNU Make 4.0
 761 contains useful functionality to handle parallel building (supported by
 762 <code>--with-output-sync</code>) and speed and stability
 763 improvements.</p>
 764 <p>Note that <code>configure</code> locates and verifies a properly
 765 functioning version of <code>make</code> and stores the path to this
 766 <code>make</code> binary in the configuration. If you start a build
 767 using <code>make</code> on the command line, you will be using the
 768 version of make found first in your <code>PATH</code>, and not
 769 necessarily the one stored in the configuration. This initial make will
 770 be used as "bootstrap make", and in a second stage, the make located by
 771 <code>configure</code> will be called. Normally, this will present no
 772 issues, but if you have a very old <code>make</code>, or a non-GNU Make
 773 <code>make</code> in your path, this might cause issues.</p>
 774 <p>If you want to override the default make found by
 775 <code>configure</code>, use the <code>MAKE</code> configure variable,
 776 e.g. <code>configure MAKE=/opt/gnu/make</code>.</p>
 777 <h3 id="gnu-bash">GNU Bash</h3>
 778 <p>The JDK requires <a href="http://www.gnu.org/software/bash">GNU
 779 Bash</a>. No other shells are supported.</p>
 780 <p>At least version 3.2 of GNU Bash must be used.</p>
 781 <h2 id="running-configure">Running Configure</h2>
 782 <p>To build the JDK, you need a "configuration", which consists of a
 783 directory where to store the build output, coupled with information
 784 about the platform, the specific build machine, and choices that affect
 785 how the JDK is built.</p>
 786 <p>The configuration is created by the <code>configure</code> script.
 787 The basic invocation of the <code>configure</code> script looks like
 788 this:</p>
 789 <pre><code>bash configure [options]</code></pre>
 790 <p>This will create an output directory containing the configuration and
 791 setup an area for the build result. This directory typically looks like
 792 <code>build/linux-x64-server-release</code>, but the actual name depends
 793 on your specific configuration. (It can also be set directly, see <a
 794 href="#using-multiple-configurations">Using Multiple
 795 Configurations</a>). This directory is referred to as
 796 <code>$BUILD</code> in this documentation.</p>
 797 <p><code>configure</code> will try to figure out what system you are
 798 running on and where all necessary build components are. If you have all
 799 prerequisites for building installed, it should find everything. If it
 800 fails to detect any component automatically, it will exit and inform you
 801 about the problem.</p>
 802 <p>Some command line examples:</p>
 803 <ul>
 804 <li><p>Create a 32-bit build for Windows with FreeType2 in
 805 <code>C:\freetype-i586</code>:
 806 <code>bash configure --with-freetype=/cygdrive/c/freetype-i586 --with-target-bits=32</code></p></li>
 807 <li><p>Create a debug build with the <code>server</code> JVM and DTrace
 808 enabled:
 809 <code>bash configure --enable-debug --with-jvm-variants=server --enable-dtrace</code></p></li>
 810 </ul>
 811 <h3 id="common-configure-arguments">Common Configure Arguments</h3>
 812 <p>Here follows some of the most common and important
 813 <code>configure</code> argument.</p>
 814 <p>To get up-to-date information on <em>all</em> available
 815 <code>configure</code> argument, please run:</p>
 816 <pre><code>bash configure --help</code></pre>
 817 <p>(Note that this help text also include general autoconf options, like
 818 <code>--dvidir</code>, that is not relevant to the JDK. To list only
 819 JDK-specific features, use <code>bash configure --help=short</code>
 820 instead.)</p>
 821 <h4 id="configure-arguments-for-tailoring-the-build">Configure Arguments
 822 for Tailoring the Build</h4>
 823 <ul>
 824 <li><code>--enable-debug</code> - Set the debug level to
 825 <code>fastdebug</code> (this is a shorthand for
 826 <code>--with-debug-level=fastdebug</code>)</li>
 827 <li><code>--with-debug-level=&lt;level&gt;</code> - Set the debug level,
 828 which can be <code>release</code>, <code>fastdebug</code>,
 829 <code>slowdebug</code> or <code>optimized</code>. Default is
 830 <code>release</code>. <code>optimized</code> is variant of
 831 <code>release</code> with additional Hotspot debug code.</li>
 832 <li><code>--with-native-debug-symbols=&lt;method&gt;</code> - Specify if
 833 and how native debug symbols should be built. Available methods are
 834 <code>none</code>, <code>internal</code>, <code>external</code>,
 835 <code>zipped</code>. Default behavior depends on platform. See <a
 836 href="#native-debug-symbols">Native Debug Symbols</a> for more
 837 details.</li>
 838 <li><code>--with-version-string=&lt;string&gt;</code> - Specify the
 839 version string this build will be identified with.</li>
 840 <li><code>--with-version-&lt;part&gt;=&lt;value&gt;</code> - A group of
 841 options, where <code>&lt;part&gt;</code> can be any of <code>pre</code>,
 842 <code>opt</code>, <code>build</code>, <code>major</code>,
 843 <code>minor</code>, <code>security</code> or <code>patch</code>. Use
 844 these options to modify just the corresponding part of the version
 845 string from the default, or the value provided by
 846 <code>--with-version-string</code>.</li>
 847 <li><code>--with-jvm-variants=&lt;variant&gt;[,&lt;variant&gt;...]</code>
 848 - Build the specified variant (or variants) of Hotspot. Valid variants
 849 are: <code>server</code>, <code>client</code>, <code>minimal</code>,
 850 <code>core</code>, <code>zero</code>, <code>custom</code>. Note that not
 851 all variants are possible to combine in a single build.</li>
 852 <li><code>--enable-jvm-feature-&lt;feature&gt;</code> or
 853 <code>--disable-jvm-feature-&lt;feature&gt;</code> - Include (or
 854 exclude) <code>&lt;feature&gt;</code> as a JVM feature in Hotspot. You
 855 can also specify a list of features to be enabled, separated by space or
 856 comma, as
 857 <code>--with-jvm-features=&lt;feature&gt;[,&lt;feature&gt;...]</code>.
 858 If you prefix <code>&lt;feature&gt;</code> with a <code>-</code>, it
 859 will be disabled. These options will modify the default list of features
 860 for the JVM variant(s) you are building. For the <code>custom</code> JVM
 861 variant, the default list is empty. A complete list of valid JVM
 862 features can be found using <code>bash configure --help</code>.</li>
 863 <li><code>--with-target-bits=&lt;bits&gt;</code> - Create a target
 864 binary suitable for running on a <code>&lt;bits&gt;</code> platform. Use
 865 this to create 32-bit output on a 64-bit build platform, instead of
 866 doing a full cross-compile. (This is known as a <em>reduced</em>
 867 build.)</li>
 868 </ul>
 869 <p>On Linux, BSD and AIX, it is possible to override where Java by
 870 default searches for runtime/JNI libraries. This can be useful in
 871 situations where there is a special shared directory for system JNI
 872 libraries. This setting can in turn be overridden at runtime by setting
 873 the <code>java.library.path</code> property.</p>
 874 <ul>
 875 <li><code>--with-jni-libpath=&lt;path&gt;</code> - Use the specified
 876 path as a default when searching for runtime libraries.</li>
 877 </ul>
 878 <h4 id="configure-arguments-for-native-compilation">Configure Arguments
 879 for Native Compilation</h4>
 880 <ul>
 881 <li><code>--with-devkit=&lt;path&gt;</code> - Use this devkit for
 882 compilers, tools and resources</li>
 883 <li><code>--with-sysroot=&lt;path&gt;</code> - Use this directory as
 884 sysroot</li>
 885 <li><code>--with-extra-path=&lt;path&gt;[;&lt;path&gt;]</code> - Prepend
 886 these directories to the default path when searching for all kinds of
 887 binaries</li>
 888 <li><code>--with-toolchain-path=&lt;path&gt;[;&lt;path&gt;]</code> -
 889 Prepend these directories when searching for toolchain binaries
 890 (compilers etc)</li>
 891 <li><code>--with-extra-cflags=&lt;flags&gt;</code> - Append these flags
 892 when compiling JDK C files</li>
 893 <li><code>--with-extra-cxxflags=&lt;flags&gt;</code> - Append these
 894 flags when compiling JDK C++ files</li>
 895 <li><code>--with-extra-ldflags=&lt;flags&gt;</code> - Append these flags
 896 when linking JDK libraries</li>
 897 </ul>
 898 <h4 id="configure-arguments-for-external-dependencies">Configure
 899 Arguments for External Dependencies</h4>
 900 <ul>
 901 <li><code>--with-boot-jdk=&lt;path&gt;</code> - Set the path to the <a
 902 href="#boot-jdk-requirements">Boot JDK</a></li>
 903 <li><code>--with-freetype=&lt;path&gt;</code> - Set the path to <a
 904 href="#freetype">FreeType</a></li>
 905 <li><code>--with-cups=&lt;path&gt;</code> - Set the path to <a
 906 href="#cups">CUPS</a></li>
 907 <li><code>--with-x=&lt;path&gt;</code> - Set the path to <a
 908 href="#x11">X11</a></li>
 909 <li><code>--with-alsa=&lt;path&gt;</code> - Set the path to <a
 910 href="#alsa">ALSA</a></li>
 911 <li><code>--with-libffi=&lt;path&gt;</code> - Set the path to <a
 912 href="#libffi">libffi</a></li>
 913 <li><code>--with-jtreg=&lt;path&gt;</code> - Set the path to JTReg. See
 914 <a href="#running-tests">Running Tests</a></li>
 915 </ul>
 916 <p>Certain third-party libraries used by the JDK (libjpeg, giflib,
 917 libpng, lcms and zlib) are included in the JDK repository. The default
 918 behavior of the JDK build is to use the included ("bundled") versions of
 919 libjpeg, giflib, libpng and lcms. For zlib, the system lib (if present)
 920 is used except on Windows and AIX. However the bundled libraries may be
 921 replaced by an external version. To do so, specify <code>system</code>
 922 as the <code>&lt;source&gt;</code> option in these arguments. (The
 923 default is <code>bundled</code>).</p>
 924 <ul>
 925 <li><code>--with-libjpeg=&lt;source&gt;</code> - Use the specified
 926 source for libjpeg</li>
 927 <li><code>--with-giflib=&lt;source&gt;</code> - Use the specified source
 928 for giflib</li>
 929 <li><code>--with-libpng=&lt;source&gt;</code> - Use the specified source
 930 for libpng</li>
 931 <li><code>--with-lcms=&lt;source&gt;</code> - Use the specified source
 932 for lcms</li>
 933 <li><code>--with-zlib=&lt;source&gt;</code> - Use the specified source
 934 for zlib</li>
 935 </ul>
 936 <p>On Linux, it is possible to select either static or dynamic linking
 937 of the C++ runtime. The default is static linking, with dynamic linking
 938 as fallback if the static library is not found.</p>
 939 <ul>
 940 <li><code>--with-stdc++lib=&lt;method&gt;</code> - Use the specified
 941 method (<code>static</code>, <code>dynamic</code> or
 942 <code>default</code>) for linking the C++ runtime.</li>
 943 </ul>
 944 <h3 id="configure-control-variables">Configure Control Variables</h3>
 945 <p>It is possible to control certain aspects of <code>configure</code>
 946 by overriding the value of <code>configure</code> variables, either on
 947 the command line or in the environment.</p>
 948 <p>Normally, this is <strong>not recommended</strong>. If used
 949 improperly, it can lead to a broken configuration. Unless you're well
 950 versed in the build system, this is hard to use properly. Therefore,
 951 <code>configure</code> will print a warning if this is detected.</p>
 952 <p>However, there are a few <code>configure</code> variables, known as
 953 <em>control variables</em> that are supposed to be overridden on the
 954 command line. These are variables that describe the location of tools
 955 needed by the build, like <code>MAKE</code> or <code>GREP</code>. If any
 956 such variable is specified, <code>configure</code> will use that value
 957 instead of trying to autodetect the tool. For instance,
 958 <code>bash configure MAKE=/opt/gnumake4.0/bin/make</code>.</p>
 959 <p>If a configure argument exists, use that instead, e.g. use
 960 <code>--with-jtreg</code> instead of setting <code>JTREGEXE</code>.</p>
 961 <p>Also note that, despite what autoconf claims, setting
 962 <code>CFLAGS</code> will not accomplish anything. Instead use
 963 <code>--with-extra-cflags</code> (and similar for <code>cxxflags</code>
 964 and <code>ldflags</code>).</p>
 965 <h2 id="running-make">Running Make</h2>
 966 <p>When you have a proper configuration, all you need to do to build the
 967 JDK is to run <code>make</code>. (But see the warning at <a
 968 href="#gnu-make">GNU Make</a> about running the correct version of
 969 make.)</p>
 970 <p>When running <code>make</code> without any arguments, the default
 971 target is used, which is the same as running <code>make default</code>
 972 or <code>make jdk</code>. This will build a minimal (or roughly minimal)
 973 set of compiled output (known as an "exploded image") needed for a
 974 developer to actually execute the newly built JDK. The idea is that in
 975 an incremental development fashion, when doing a normal make, you should
 976 only spend time recompiling what's changed (making it purely
 977 incremental) and only do the work that's needed to actually run and test
 978 your code.</p>
 979 <p>The output of the exploded image resides in <code>$BUILD/jdk</code>.
 980 You can test the newly built JDK like this:
 981 <code>$BUILD/jdk/bin/java -version</code>.</p>
 982 <h3 id="common-make-targets">Common Make Targets</h3>
 983 <p>Apart from the default target, here are some common make targets:</p>
 984 <ul>
 985 <li><code>hotspot</code> - Build all of hotspot (but only hotspot)</li>
 986 <li><code>hotspot-&lt;variant&gt;</code> - Build just the specified jvm
 987 variant</li>
 988 <li><code>images</code> or <code>product-images</code> - Build the JDK
 989 image</li>
 990 <li><code>docs</code> or <code>docs-image</code> - Build the
 991 documentation image</li>
 992 <li><code>test-image</code> - Build the test image</li>
 993 <li><code>all</code> or <code>all-images</code> - Build all images
 994 (product, docs and test)</li>
 995 <li><code>bootcycle-images</code> - Build images twice, second time with
 996 newly built JDK (good for testing)</li>
 997 <li><code>clean</code> - Remove all files generated by make, but not
 998 those generated by configure</li>
 999 <li><code>dist-clean</code> - Remove all files, including
1000 configuration</li>
1001 </ul>
1002 <p>Run <code>make help</code> to get an up-to-date list of important
1003 make targets and make control variables.</p>
1004 <p>It is possible to build just a single module, a single phase, or a
1005 single phase of a single module, by creating make targets according to
1006 these followin patterns. A phase can be either of <code>gensrc</code>,
1007 <code>gendata</code>, <code>copy</code>, <code>java</code>,
1008 <code>launchers</code>, or <code>libs</code>. See <a
1009 href="#using-fine-grained-make-targets">Using Fine-Grained Make
1010 Targets</a> for more details about this functionality.</p>
1011 <ul>
1012 <li><code>&lt;phase&gt;</code> - Build the specified phase and
1013 everything it depends on</li>
1014 <li><code>&lt;module&gt;</code> - Build the specified module and
1015 everything it depends on</li>
1016 <li><code>&lt;module&gt;-&lt;phase&gt;</code> - Compile the specified
1017 phase for the specified module and everything it depends on</li>
1018 </ul>
1019 <p>Similarly, it is possible to clean just a part of the build by
1020 creating make targets according to these patterns:</p>
1021 <ul>
1022 <li><code>clean-&lt;outputdir&gt;</code> - Remove the subdir in the
1023 output dir with the name</li>
1024 <li><code>clean-&lt;phase&gt;</code> - Remove all build results related
1025 to a certain build phase</li>
1026 <li><code>clean-&lt;module&gt;</code> - Remove all build results related
1027 to a certain module</li>
1028 <li><code>clean-&lt;module&gt;-&lt;phase&gt;</code> - Remove all build
1029 results related to a certain module and phase</li>
1030 </ul>
1031 <h3 id="make-control-variables">Make Control Variables</h3>
1032 <p>It is possible to control <code>make</code> behavior by overriding
1033 the value of <code>make</code> variables, either on the command line or
1034 in the environment.</p>
1035 <p>Normally, this is <strong>not recommended</strong>. If used
1036 improperly, it can lead to a broken build. Unless you're well versed in
1037 the build system, this is hard to use properly. Therefore,
1038 <code>make</code> will print a warning if this is detected.</p>
1039 <p>However, there are a few <code>make</code> variables, known as
1040 <em>control variables</em> that are supposed to be overridden on the
1041 command line. These make up the "make time" configuration, as opposed to
1042 the "configure time" configuration.</p>
1043 <h4 id="general-make-control-variables">General Make Control
1044 Variables</h4>
1045 <ul>
1046 <li><code>JOBS</code> - Specify the number of jobs to build with. See <a
1047 href="#build-performance">Build Performance</a>.</li>
1048 <li><code>LOG</code> - Specify the logging level and functionality. See
1049 <a href="#checking-the-build-log-file">Checking the Build Log
1050 File</a></li>
1051 <li><code>CONF</code> and <code>CONF_NAME</code> - Selecting the
1052 configuration(s) to use. See <a
1053 href="#using-multiple-configurations">Using Multiple
1054 Configurations</a></li>
1055 </ul>
1056 <h4 id="test-make-control-variables">Test Make Control Variables</h4>
1057 <p>These make control variables only make sense when running tests.
1058 Please see <strong>Testing the JDK</strong> (<a
1059 href="testing.html">html</a>, <a href="testing.md">markdown</a>) for
1060 details.</p>
1061 <ul>
1062 <li><code>TEST</code></li>
1063 <li><code>TEST_JOBS</code></li>
1064 <li><code>JTREG</code></li>
1065 <li><code>GTEST</code></li>
1066 </ul>
1067 <h4 id="advanced-make-control-variables">Advanced Make Control
1068 Variables</h4>
1069 <p>These advanced make control variables can be potentially unsafe. See
1070 <a href="#hints-and-suggestions-for-advanced-users">Hints and
1071 Suggestions for Advanced Users</a> and <a
1072 href="#understanding-the-build-system">Understanding the Build
1073 System</a> for details.</p>
1074 <ul>
1075 <li><code>SPEC</code></li>
1076 <li><code>CONF_CHECK</code></li>
1077 <li><code>COMPARE_BUILD</code></li>
1078 <li><code>JDK_FILTER</code></li>
1079 <li><code>SPEC_FILTER</code></li>
1080 </ul>
1081 <h2 id="running-tests">Running Tests</h2>
1082 <p>Most of the JDK tests are using the <a
1083 href="http://openjdk.org/jtreg">JTReg</a> test framework. Make sure that
1084 your configuration knows where to find your installation of JTReg. If
1085 this is not picked up automatically, use the
1086 <code>--with-jtreg=&lt;path to jtreg home&gt;</code> option to point to
1087 the JTReg framework. Note that this option should point to the JTReg
1088 home, i.e. the top directory, containing <code>lib/jtreg.jar</code>
1089 etc.</p>
1090 <p>The <a href="https://wiki.openjdk.org/display/Adoption">Adoption
1091 Group</a> provides recent builds of jtreg <a
1092 href="https://ci.adoptopenjdk.net/view/Dependencies/job/dependency_pipeline/lastSuccessfulBuild/artifact/jtreg/">here</a>.
1093 Download the latest <code>.tar.gz</code> file, unpack it, and point
1094 <code>--with-jtreg</code> to the <code>jtreg</code> directory that you
1095 just unpacked.</p>
1096 <p>Building of Hotspot Gtest suite requires the source code of Google
1097 Test framework. The top directory, which contains both
1098 <code>googletest</code> and <code>googlemock</code> directories, should
1099 be specified via <code>--with-gtest</code>. The minimum supported
1100 version of Google Test is 1.13.0, whose source code can be obtained:</p>
1101 <ul>
1102 <li>by downloading and unpacking the source bundle from <a
1103 href="https://github.com/google/googletest/releases/tag/v1.13.0">here</a></li>
1104 <li>or by checking out <code>v1.13.0</code> tag of
1105 <code>googletest</code> project:
1106 <code>git clone -b v1.13.0 https://github.com/google/googletest</code></li>
1107 </ul>
1108 <p>To execute the most basic tests (tier 1), use:</p>
1109 <pre><code>make run-test-tier1</code></pre>
1110 <p>For more details on how to run tests, please see <strong>Testing the
1111 JDK</strong> (<a href="testing.html">html</a>, <a
1112 href="testing.md">markdown</a>).</p>
1113 <h2 id="signing">Signing</h2>
1114 <h3 id="macos-1">macOS</h3>
1115 <p>Modern versions of macOS require applications to be signed and
1116 notarizied before distribution. See Apple's documentation for more
1117 background on what this means and how it works. To help support this,
1118 the JDK build can be configured to automatically sign all native
1119 binaries, and the JDK bundle, with all the options needed for successful
1120 notarization, as well as all the entitlements required by the JDK. To
1121 enable <code>hardened</code> signing, use configure parameter
1122 <code>--with-macosx-codesign=hardened</code> and configure the signing
1123 identity you wish to use with
1124 <code>--with-macosx-codesign-identity=&lt;identity&gt;</code>. The
1125 identity refers to a signing identity from Apple that needs to be
1126 preinstalled on the build host.</p>
1127 <p>When not signing for distribution with the hardened option, the JDK
1128 build will still attempt to perform <code>adhoc</code> signing to add
1129 the special entitlement <code>com.apple.security.get-task-allow</code>
1130 to each binary. This entitlement is required to be able to dump core
1131 files from a process. Note that adding this entitlement makes the build
1132 invalid for notarization, so it is only added when signing in
1133 <code>debug</code> mode. To explicitly enable this kind of adhoc
1134 signing, use configure parameter
1135 <code>--with-macosx-codesign=debug</code>. It will be enabled by default
1136 in most cases.</p>
1137 <p>It's also possible to completely disable any explicit codesign
1138 operations done by the JDK build using the configure parameter
1139 <code>--without-macosx-codesign</code>. The exact behavior then depends
1140 on the architecture. For macOS on x64, it (at least at the time of this
1141 writing) results in completely unsigned binaries that should still work
1142 fine for development and debugging purposes. On aarch64, the Xcode
1143 linker will apply a default "adhoc" signing, without any entitlements.
1144 Such a build does not allow dumping core files.</p>
1145 <p>The default mode "auto" will try for <code>hardened</code> signing if
1146 the debug level is <code>release</code> and either the default identity
1147 or the specified identity is valid. If hardened isn't possible, then
1148 <code>debug</code> signing is chosen if it works. If nothing works, the
1149 codesign build step is disabled.</p>
1150 <h2 id="cross-compiling">Cross-compiling</h2>
1151 <p>Cross-compiling means using one platform (the <em>build</em>
1152 platform) to generate output that can ran on another platform (the
1153 <em>target</em> platform).</p>
1154 <p>The typical reason for cross-compiling is that the build is performed
1155 on a more powerful desktop computer, but the resulting binaries will be
1156 able to run on a different, typically low-performing system. Most of the
1157 complications that arise when building for embedded is due to this
1158 separation of <em>build</em> and <em>target</em> systems.</p>
1159 <p>This requires a more complex setup and build procedure. This section
1160 assumes you are familiar with cross-compiling in general, and will only
1161 deal with the particularities of cross-compiling the JDK. If you are new
1162 to cross-compiling, please see the <a
1163 href="https://en.wikipedia.org/wiki/Cross_compiler#External_links">external
1164 links at Wikipedia</a> for a good start on reading materials.</p>
1165 <p>Cross-compiling the JDK requires you to be able to build both for the
1166 build platform and for the target platform. The reason for the former is
1167 that we need to build and execute tools during the build process, both
1168 native tools and Java tools.</p>
1169 <p>If all you want to do is to compile a 32-bit version, for the same
1170 OS, on a 64-bit machine, consider using
1171 <code>--with-target-bits=32</code> instead of doing a full-blown
1172 cross-compilation. (While this surely is possible, it's a lot more work
1173 and will take much longer to build.)</p>
1174 <h3 id="cross-compiling-the-easy-way-with-openjdk-devkits">Cross
1175 compiling the easy way with OpenJDK devkits</h3>
1176 <p>The OpenJDK build system provides out-of-the box support for creating
1177 and using so called devkits. A <code>devkit</code> is basically a
1178 collection of a cross-compiling toolchain and a sysroot environment
1179 which can easily be used together with the <code>--with-devkit</code>
1180 configure option to cross compile the OpenJDK. On Linux/x86_64, the
1181 following command:</p>
1182 <pre><code>bash configure --with-devkit=&lt;devkit-path&gt; --openjdk-target=ppc64-linux-gnu &amp;&amp; make</code></pre>
1183 <p>will configure and build OpenJDK for Linux/ppc64 assuming that
1184 <code>&lt;devkit-path&gt;</code> points to a Linux/x86_64 to Linux/ppc64
1185 devkit.</p>
1186 <p>Devkits can be created from the <code>make/devkit</code> directory by
1187 executing:</p>
1188 <pre><code>make [ TARGETS=&quot;&lt;TARGET_TRIPLET&gt;+&quot; ] [ BASE_OS=&lt;OS&gt; ] [ BASE_OS_VERSION=&lt;VER&gt; ]</code></pre>
1189 <p>where <code>TARGETS</code> contains one or more
1190 <code>TARGET_TRIPLET</code>s of the form described in <a
1191 href="https://sourceware.org/autobook/autobook/autobook_17.html">section
1192 3.4 of the GNU Autobook</a>. If no targets are given, a native toolchain
1193 for the current platform will be created. Currently, at least the
1194 following targets are known to work:</p>
1195 <table>
1196 <thead>
1197 <tr class="header">
1198 <th style="text-align: left;">Supported devkit targets</th>
1199 </tr>
1200 </thead>
1201 <tbody>
1202 <tr class="odd">
1203 <td style="text-align: left;">x86_64-linux-gnu</td>
1204 </tr>
1205 <tr class="even">
1206 <td style="text-align: left;">aarch64-linux-gnu</td>
1207 </tr>
1208 <tr class="odd">
1209 <td style="text-align: left;">arm-linux-gnueabihf</td>
1210 </tr>
1211 <tr class="even">
1212 <td style="text-align: left;">ppc64-linux-gnu</td>
1213 </tr>
1214 <tr class="odd">
1215 <td style="text-align: left;">ppc64le-linux-gnu</td>
1216 </tr>
1217 <tr class="even">
1218 <td style="text-align: left;">s390x-linux-gnu</td>
1219 </tr>
1220 </tbody>
1221 </table>
1222 <p><code>BASE_OS</code> must be one of "OEL6" for Oracle Enterprise
1223 Linux 6 or "Fedora" (if not specified "OEL6" will be the default). If
1224 the base OS is "Fedora" the corresponding Fedora release can be
1225 specified with the help of the <code>BASE_OS_VERSION</code> option (with
1226 "27" as default version). If the build is successful, the new devkits
1227 can be found in the <code>build/devkit/result</code> subdirectory:</p>
1228 <pre><code>cd make/devkit
1229 make TARGETS=&quot;ppc64le-linux-gnu aarch64-linux-gnu&quot; BASE_OS=Fedora BASE_OS_VERSION=21
1230 ls -1 ../../build/devkit/result/
1231 x86_64-linux-gnu-to-aarch64-linux-gnu
1232 x86_64-linux-gnu-to-ppc64le-linux-gnu</code></pre>
1233 <p>Notice that devkits are not only useful for targeting different build
1234 platforms. Because they contain the full build dependencies for a system
1235 (i.e. compiler and root file system), they can easily be used to build
1236 well-known, reliable and reproducible build environments. You can for
1237 example create and use a devkit with GCC 7.3 and a Fedora 12 sysroot
1238 environment (with glibc 2.11) on Ubuntu 14.04 (which doesn't have GCC
1239 7.3 by default) to produce OpenJDK binaries which will run on all Linux
1240 systems with runtime libraries newer than the ones from Fedora 12 (e.g.
1241 Ubuntu 16.04, SLES 11 or RHEL 6).</p>
1242 <h3 id="boot-jdk-and-build-jdk">Boot JDK and Build JDK</h3>
1243 <p>When cross-compiling, make sure you use a boot JDK that runs on the
1244 <em>build</em> system, and not on the <em>target</em> system.</p>
1245 <p>To be able to build, we need a "Build JDK", which is a JDK built from
1246 the current sources (that is, the same as the end result of the entire
1247 build process), but able to run on the <em>build</em> system, and not
1248 the <em>target</em> system. (In contrast, the Boot JDK should be from an
1249 older release, e.g. JDK 8 when building JDK 9.)</p>
1250 <p>The build process will create a minimal Build JDK for you, as part of
1251 building. To speed up the build, you can use
1252 <code>--with-build-jdk</code> to <code>configure</code> to point to a
1253 pre-built Build JDK. Please note that the build result is unpredictable,
1254 and can possibly break in subtle ways, if the Build JDK does not
1255 <strong>exactly</strong> match the current sources.</p>
1256 <h3 id="specifying-the-target-platform">Specifying the Target
1257 Platform</h3>
1258 <p>You <em>must</em> specify the target platform when cross-compiling.
1259 Doing so will also automatically turn the build into a cross-compiling
1260 mode. The simplest way to do this is to use the
1261 <code>--openjdk-target</code> argument, e.g.
1262 <code>--openjdk-target=arm-linux-gnueabihf</code>. or
1263 <code>--openjdk-target=aarch64-oe-linux</code>. This will automatically
1264 set the <code>--host</code> and <code>--target</code> options for
1265 autoconf, which can otherwise be confusing. (In autoconf terminology,
1266 the "target" is known as "host", and "target" is used for building a
1267 Canadian cross-compiler.)</p>
1268 <p>If <code>--build</code> has not been explicitly passed to configure,
1269 <code>--openjdk-target</code> will autodetect the build platform and
1270 internally set the flag automatically, otherwise the platform that was
1271 explicitly passed to <code>--build</code> will be used instead.</p>
1272 <h3 id="toolchain-considerations">Toolchain Considerations</h3>
1273 <p>You will need two copies of your toolchain, one which generates
1274 output that can run on the target system (the normal, or
1275 <em>target</em>, toolchain), and one that generates output that can run
1276 on the build system (the <em>build</em> toolchain). Note that
1277 cross-compiling is only supported for gcc at the time being. The gcc
1278 standard is to prefix cross-compiling toolchains with the target
1279 denominator. If you follow this standard, <code>configure</code> is
1280 likely to pick up the toolchain correctly.</p>
1281 <p>The <em>build</em> toolchain will be autodetected just the same way
1282 the normal <em>build</em>/<em>target</em> toolchain will be autodetected
1283 when not cross-compiling. If this is not what you want, or if the
1284 autodetection fails, you can specify a devkit containing the
1285 <em>build</em> toolchain using <code>--with-build-devkit</code> to
1286 <code>configure</code>, or by giving <code>BUILD_CC</code> and
1287 <code>BUILD_CXX</code> arguments.</p>
1288 <p>It is often helpful to locate the cross-compilation tools, headers
1289 and libraries in a separate directory, outside the normal path, and
1290 point out that directory to <code>configure</code>. Do this by setting
1291 the sysroot (<code>--with-sysroot</code>) and appending the directory
1292 when searching for cross-compilations tools
1293 (<code>--with-toolchain-path</code>). As a compact form, you can also
1294 use <code>--with-devkit</code> to point to a single directory, if it is
1295 correctly setup. (See <code>basics.m4</code> for details.)</p>
1296 <h3 id="native-libraries">Native Libraries</h3>
1297 <p>You will need copies of external native libraries for the
1298 <em>target</em> system, present on the <em>build</em> machine while
1299 building.</p>
1300 <p>Take care not to replace the <em>build</em> system's version of these
1301 libraries by mistake, since that can render the <em>build</em> machine
1302 unusable.</p>
1303 <p>Make sure that the libraries you point to (ALSA, X11, etc) are for
1304 the <em>target</em>, not the <em>build</em>, platform.</p>
1305 <h4 id="alsa-1">ALSA</h4>
1306 <p>You will need alsa libraries suitable for your <em>target</em>
1307 system. For most cases, using Debian's pre-built libraries work
1308 fine.</p>
1309 <p>Note that alsa is needed even if you only want to build a headless
1310 JDK.</p>
1311 <ul>
1312 <li><p>Go to <a href="https://www.debian.org/distrib/packages">Debian
1313 Package Search</a> and search for the <code>libasound2</code> and
1314 <code>libasound2-dev</code> packages for your <em>target</em> system.
1315 Download them to /tmp.</p></li>
1316 <li><p>Install the libraries into the cross-compilation toolchain. For
1317 instance:</p></li>
1318 </ul>
1319 <pre><code>cd /tools/gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux/arm-linux-gnueabihf/libc
1320 dpkg-deb -x /tmp/libasound2_1.0.25-4_armhf.deb .
1321 dpkg-deb -x /tmp/libasound2-dev_1.0.25-4_armhf.deb .</code></pre>
1322 <ul>
1323 <li>If alsa is not properly detected by <code>configure</code>, you can
1324 point it out by <code>--with-alsa</code>.</li>
1325 </ul>
1326 <h4 id="x11-1">X11</h4>
1327 <p>You will need X11 libraries suitable for your <em>target</em> system.
1328 For most cases, using Debian's pre-built libraries work fine.</p>
1329 <p>Note that X11 is needed even if you only want to build a headless
1330 JDK.</p>
1331 <ul>
1332 <li><p>Go to <a href="https://www.debian.org/distrib/packages">Debian
1333 Package Search</a>, search for the following packages for your
1334 <em>target</em> system, and download them to /tmp/target-x11:</p>
1335 <ul>
1336 <li>libxi</li>
1337 <li>libxi-dev</li>
1338 <li>x11proto-core-dev</li>
1339 <li>x11proto-input-dev</li>
1340 <li>x11proto-kb-dev</li>
1341 <li>x11proto-render-dev</li>
1342 <li>x11proto-xext-dev</li>
1343 <li>libice-dev</li>
1344 <li>libxrender</li>
1345 <li>libxrender-dev</li>
1346 <li>libxrandr-dev</li>
1347 <li>libsm-dev</li>
1348 <li>libxt-dev</li>
1349 <li>libx11</li>
1350 <li>libx11-dev</li>
1351 <li>libxtst</li>
1352 <li>libxtst-dev</li>
1353 <li>libxext</li>
1354 <li>libxext-dev</li>
1355 </ul></li>
1356 <li><p>Install the libraries into the cross-compilation toolchain. For
1357 instance:</p>
1358 <pre><code>    cd /tools/gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux/arm-linux-gnueabihf/libc/usr
1359     mkdir X11R6
1360     cd X11R6
1361     for deb in /tmp/target-x11/*.deb ; do dpkg-deb -x $deb . ; done
1362     mv usr/* .
1363     cd lib
1364     cp arm-linux-gnueabihf/* .
1365     ```
1366 
1367 You can ignore the following messages. These libraries are not needed to
1368 successfully complete a full JDK build.</code></pre>
1369 <p>cp: cannot stat
1370 <code>arm-linux-gnueabihf/libICE.so': No such file or directory cp: cannot stat</code>arm-linux-gnueabihf/libSM.so':
1371 No such file or directory cp: cannot stat
1372 `arm-linux-gnueabihf/libXt.so': No such file or directory ```</p></li>
1373 <li><p>If the X11 libraries are not properly detected by
1374 <code>configure</code>, you can point them out by
1375 <code>--with-x</code>.</p></li>
1376 </ul>
1377 <h3 id="cross-compiling-with-debian-sysroots">Cross compiling with
1378 Debian sysroots</h3>
1379 <p>Fortunately, you can create sysroots for foreign architectures with
1380 tools provided by your OS. On Debian/Ubuntu systems, one could use
1381 <code>qemu-deboostrap</code> to create the <em>target</em> system
1382 chroot, which would have the native libraries and headers specific to
1383 that <em>target</em> system. After that, we can use the cross-compiler
1384 on the <em>build</em> system, pointing into chroot to get the build
1385 dependencies right. This allows building for foreign architectures with
1386 native compilation speed.</p>
1387 <p>For example, cross-compiling to AArch64 from x86_64 could be done
1388 like this:</p>
1389 <ul>
1390 <li><p>Install cross-compiler on the <em>build</em> system:
1391 <code>apt install g++-aarch64-linux-gnu gcc-aarch64-linux-gnu</code></p></li>
1392 <li><p>Create chroot on the <em>build</em> system, configuring it for
1393 <em>target</em> system:
1394 <code>sudo qemu-debootstrap \       --arch=arm64 \       --verbose \       --include=fakeroot,symlinks,build-essential,libx11-dev,libxext-dev,libxrender-dev,libxrandr-dev,libxtst-dev,libxt-dev,libcups2-dev,libfontconfig1-dev,libasound2-dev,libfreetype6-dev,libpng-dev,libffi-dev \       --resolve-deps \       buster \       ~/sysroot-arm64 \       http://httpredir.debian.org/debian/</code></p></li>
1395 <li><p>Make sure the symlinks inside the newly created chroot point to
1396 proper locations:
1397 <code>sudo chroot ~/sysroot-arm64 symlinks -cr .</code></p></li>
1398 <li><p>Configure and build with newly created chroot as
1399 sysroot/toolchain-path:
1400 <code>sh ./configure \       --openjdk-target=aarch64-linux-gnu \       --with-sysroot=~/sysroot-arm64     make images     ls build/linux-aarch64-server-release/</code></p></li>
1401 </ul>
1402 <p>The build does not create new files in that chroot, so it can be
1403 reused for multiple builds without additional cleanup.</p>
1404 <p>The build system should automatically detect the toolchain paths and
1405 dependencies, but sometimes it might require a little nudge with:</p>
1406 <ul>
1407 <li><p>Native compilers: override <code>CC</code> or <code>CXX</code>
1408 for <code>./configure</code></p></li>
1409 <li><p>Freetype lib location: override <code>--with-freetype-lib</code>,
1410 for example <code>${sysroot}/usr/lib/${target}/</code></p></li>
1411 <li><p>Freetype includes location: override
1412 <code>--with-freetype-include</code> for example
1413 <code>${sysroot}/usr/include/freetype2/</code></p></li>
1414 <li><p>X11 libraries location: override <code>--x-libraries</code>, for
1415 example <code>${sysroot}/usr/lib/${target}/</code></p></li>
1416 </ul>
1417 <p>Architectures that are known to successfully cross-compile like this
1418 are:</p>
1419 <table>
1420 <thead>
1421 <tr class="header">
1422 <th style="text-align: left;">Target</th>
1423 <th style="text-align: left;">Debian tree</th>
1424 <th style="text-align: left;">Debian arch</th>
1425 <th style="text-align: left;"><code>--openjdk-target=...</code></th>
1426 <th><code>--with-jvm-variants=...</code></th>
1427 </tr>
1428 </thead>
1429 <tbody>
1430 <tr class="odd">
1431 <td style="text-align: left;">x86</td>
1432 <td style="text-align: left;">buster</td>
1433 <td style="text-align: left;">i386</td>
1434 <td style="text-align: left;">i386-linux-gnu</td>
1435 <td>(all)</td>
1436 </tr>
1437 <tr class="even">
1438 <td style="text-align: left;">arm</td>
1439 <td style="text-align: left;">buster</td>
1440 <td style="text-align: left;">armhf</td>
1441 <td style="text-align: left;">arm-linux-gnueabihf</td>
1442 <td>(all)</td>
1443 </tr>
1444 <tr class="odd">
1445 <td style="text-align: left;">aarch64</td>
1446 <td style="text-align: left;">buster</td>
1447 <td style="text-align: left;">arm64</td>
1448 <td style="text-align: left;">aarch64-linux-gnu</td>
1449 <td>(all)</td>
1450 </tr>
1451 <tr class="even">
1452 <td style="text-align: left;">ppc64le</td>
1453 <td style="text-align: left;">buster</td>
1454 <td style="text-align: left;">ppc64el</td>
1455 <td style="text-align: left;">powerpc64le-linux-gnu</td>
1456 <td>(all)</td>
1457 </tr>
1458 <tr class="odd">
1459 <td style="text-align: left;">s390x</td>
1460 <td style="text-align: left;">buster</td>
1461 <td style="text-align: left;">s390x</td>
1462 <td style="text-align: left;">s390x-linux-gnu</td>
1463 <td>(all)</td>
1464 </tr>
1465 <tr class="even">
1466 <td style="text-align: left;">mipsle</td>
1467 <td style="text-align: left;">buster</td>
1468 <td style="text-align: left;">mipsel</td>
1469 <td style="text-align: left;">mipsel-linux-gnu</td>
1470 <td>zero</td>
1471 </tr>
1472 <tr class="odd">
1473 <td style="text-align: left;">mips64le</td>
1474 <td style="text-align: left;">buster</td>
1475 <td style="text-align: left;">mips64el</td>
1476 <td style="text-align: left;">mips64el-linux-gnueabi64</td>
1477 <td>zero</td>
1478 </tr>
1479 <tr class="even">
1480 <td style="text-align: left;">armel</td>
1481 <td style="text-align: left;">buster</td>
1482 <td style="text-align: left;">arm</td>
1483 <td style="text-align: left;">arm-linux-gnueabi</td>
1484 <td>zero</td>
1485 </tr>
1486 <tr class="odd">
1487 <td style="text-align: left;">ppc</td>
1488 <td style="text-align: left;">sid</td>
1489 <td style="text-align: left;">powerpc</td>
1490 <td style="text-align: left;">powerpc-linux-gnu</td>
1491 <td>zero</td>
1492 </tr>
1493 <tr class="even">
1494 <td style="text-align: left;">ppc64be</td>
1495 <td style="text-align: left;">sid</td>
1496 <td style="text-align: left;">ppc64</td>
1497 <td style="text-align: left;">powerpc64-linux-gnu</td>
1498 <td>(all)</td>
1499 </tr>
1500 <tr class="odd">
1501 <td style="text-align: left;">m68k</td>
1502 <td style="text-align: left;">sid</td>
1503 <td style="text-align: left;">m68k</td>
1504 <td style="text-align: left;">m68k-linux-gnu</td>
1505 <td>zero</td>
1506 </tr>
1507 <tr class="even">
1508 <td style="text-align: left;">alpha</td>
1509 <td style="text-align: left;">sid</td>
1510 <td style="text-align: left;">alpha</td>
1511 <td style="text-align: left;">alpha-linux-gnu</td>
1512 <td>zero</td>
1513 </tr>
1514 <tr class="odd">
1515 <td style="text-align: left;">sh4</td>
1516 <td style="text-align: left;">sid</td>
1517 <td style="text-align: left;">sh4</td>
1518 <td style="text-align: left;">sh4-linux-gnu</td>
1519 <td>zero</td>
1520 </tr>
1521 </tbody>
1522 </table>
1523 <h3 id="building-for-armaarch64">Building for ARM/aarch64</h3>
1524 <p>A common cross-compilation target is the ARM CPU. When building for
1525 ARM, it is useful to set the ABI profile. A number of pre-defined ABI
1526 profiles are available using <code>--with-abi-profile</code>:
1527 arm-vfp-sflt, arm-vfp-hflt, arm-sflt, armv5-vfp-sflt, armv6-vfp-hflt.
1528 Note that soft-float ABIs are no longer properly supported by the
1529 JDK.</p>
1530 <h3 id="building-for-musl">Building for musl</h3>
1531 <p>Just like it's possible to cross-compile for a different CPU, it's
1532 possible to cross-compile for musl libc on a glibc-based <em>build</em>
1533 system. A devkit suitable for most target CPU architectures can be
1534 obtained from <a href="https://musl.cc">musl.cc</a>. After installing
1535 the required packages in the sysroot, configure the build with
1536 <code>--openjdk-target</code>:</p>
1537 <pre><code>sh ./configure --with-jvm-variants=server \
1538 --with-boot-jdk=$BOOT_JDK \
1539 --with-build-jdk=$BUILD_JDK \
1540 --openjdk-target=x86_64-unknown-linux-musl \
1541 --with-devkit=$DEVKIT \
1542 --with-sysroot=$SYSROOT</code></pre>
1543 <p>and run <code>make</code> normally.</p>
1544 <h3 id="verifying-the-build">Verifying the Build</h3>
1545 <p>The build will end up in a directory named like
1546 <code>build/linux-arm-normal-server-release</code>.</p>
1547 <p>Inside this build output directory, the <code>images/jdk</code> will
1548 contain the newly built JDK, for your <em>target</em> system.</p>
1549 <p>Copy these folders to your <em>target</em> system. Then you can run
1550 e.g. <code>images/jdk/bin/java -version</code>.</p>
1551 <h2 id="build-performance">Build Performance</h2>
1552 <p>Building the JDK requires a lot of horsepower. Some of the build
1553 tools can be adjusted to utilize more or less of resources such as
1554 parallel threads and memory. The <code>configure</code> script analyzes
1555 your system and selects reasonable values for such options based on your
1556 hardware. If you encounter resource problems, such as out of memory
1557 conditions, you can modify the detected values with:</p>
1558 <ul>
1559 <li><p><code>--with-num-cores</code> -- number of cores in the build
1560 system, e.g. <code>--with-num-cores=8</code>.</p></li>
1561 <li><p><code>--with-memory-size</code> -- memory (in MB) available in
1562 the build system, e.g. <code>--with-memory-size=1024</code></p></li>
1563 </ul>
1564 <p>You can also specify directly the number of build jobs to use with
1565 <code>--with-jobs=N</code> to <code>configure</code>, or
1566 <code>JOBS=N</code> to <code>make</code>. Do not use the <code>-j</code>
1567 flag to <code>make</code>. In most cases it will be ignored by the
1568 makefiles, but it can cause problems for some make targets.</p>
1569 <p>It might also be necessary to specify the JVM arguments passed to the
1570 Boot JDK, using e.g. <code>--with-boot-jdk-jvmargs="-Xmx8G"</code>.
1571 Doing so will override the default JVM arguments passed to the Boot
1572 JDK.</p>
1573 <p>At the end of a successful execution of <code>configure</code>, you
1574 will get a performance summary, indicating how well the build will
1575 perform. Here you will also get performance hints. If you want to build
1576 fast, pay attention to those!</p>
1577 <p>If you want to tweak build performance, run with
1578 <code>make LOG=info</code> to get a build time summary at the end of the
1579 build process.</p>
1580 <h3 id="disk-speed">Disk Speed</h3>
1581 <p>If you are using network shares, e.g. via NFS, for your source code,
1582 make sure the build directory is situated on local disk (e.g. by
1583 <code>ln -s /localdisk/jdk-build $JDK-SHARE/build</code>). The
1584 performance penalty is extremely high for building on a network share;
1585 close to unusable.</p>
1586 <p>Also, make sure that your build tools (including Boot JDK and
1587 toolchain) is located on a local disk and not a network share.</p>
1588 <p>As has been stressed elsewhere, do use SSD for source code and build
1589 directory, as well as (if possible) the build tools.</p>
1590 <h3 id="virus-checking">Virus Checking</h3>
1591 <p>The use of virus checking software, especially on Windows, can
1592 <em>significantly</em> slow down building of the JDK. If possible, turn
1593 off such software, or exclude the directory containing the JDK source
1594 code from on-the-fly checking.</p>
1595 <h3 id="ccache">Ccache</h3>
1596 <p>The JDK build supports building with ccache when using gcc or clang.
1597 Using ccache can radically speed up compilation of native code if you
1598 often rebuild the same sources. Your milage may vary however, so we
1599 recommend evaluating it for yourself. To enable it, make sure it's on
1600 the path and configure with <code>--enable-ccache</code>.</p>
1601 <h3 id="precompiled-headers">Precompiled Headers</h3>
1602 <p>By default, the Hotspot build uses preccompiled headers (PCH) on the
1603 toolchains were it is properly supported (clang, gcc, and Visual
1604 Studio). Normally, this speeds up the build process, but in some
1605 circumstances, it can actually slow things down.</p>
1606 <p>You can experiment by disabling precompiled headers using
1607 <code>--disable-precompiled-headers</code>.</p>
1608 <h3 id="icecc-icecream">Icecc / icecream</h3>
1609 <p><a href="http://github.com/icecc/icecream">icecc/icecream</a> is a
1610 simple way to setup a distributed compiler network. If you have multiple
1611 machines available for building the JDK, you can drastically cut
1612 individual build times by utilizing it.</p>
1613 <p>To use, setup an icecc network, and install icecc on the build
1614 machine. Then run <code>configure</code> using
1615 <code>--enable-icecc</code>.</p>
1616 <h3 id="using-the-javac-server">Using the javac server</h3>
1617 <p>To speed up compilation of Java code, especially during incremental
1618 compilations, the javac server is automatically enabled in the
1619 configuration step by default. To explicitly enable or disable the javac
1620 server, use either <code>--enable-javac-server</code> or
1621 <code>--disable-javac-server</code>.</p>
1622 <h3 id="building-the-right-target">Building the Right Target</h3>
1623 <p>Selecting the proper target to build can have dramatic impact on
1624 build time. For normal usage, <code>jdk</code> or the default target is
1625 just fine. You only need to build <code>images</code> for shipping, or
1626 if your tests require it.</p>
1627 <p>See also <a href="#using-fine-grained-make-targets">Using
1628 Fine-Grained Make Targets</a> on how to build an even smaller subset of
1629 the product.</p>
1630 <h2 id="troubleshooting">Troubleshooting</h2>
1631 <p>If your build fails, it can sometimes be difficult to pinpoint the
1632 problem or find a proper solution.</p>
1633 <h3 id="locating-the-source-of-the-error">Locating the Source of the
1634 Error</h3>
1635 <p>When a build fails, it can be hard to pinpoint the actual cause of
1636 the error. In a typical build process, different parts of the product
1637 build in parallel, with the output interlaced.</p>
1638 <h4 id="build-failure-summary">Build Failure Summary</h4>
1639 <p>To help you, the build system will print a failure summary at the
1640 end. It looks like this:</p>
1641 <pre><code>ERROR: Build failed for target &#39;hotspot&#39; in configuration &#39;linux-x64&#39; (exit code 2)
1642 
1643 === Output from failing command(s) repeated here ===
1644 * For target hotspot_variant-server_libjvm_objs_psMemoryPool.o:
1645 /localhome/git/jdk-sandbox/hotspot/src/share/vm/services/psMemoryPool.cpp:1:1: error: &#39;failhere&#39; does not name a type
1646    ... (rest of output omitted)
1647 
1648 * All command lines available in /localhome/git/jdk-sandbox/build/linux-x64/make-support/failure-logs.
1649 === End of repeated output ===
1650 
1651 === Make failed targets repeated here ===
1652 lib/CompileJvm.gmk:207: recipe for target &#39;/localhome/git/jdk-sandbox/build/linux-x64/hotspot/variant-server/libjvm/objs/psMemoryPool.o&#39; failed
1653 make/Main.gmk:263: recipe for target &#39;hotspot-server-libs&#39; failed
1654 === End of repeated output ===
1655 
1656 Hint: Try searching the build log for the name of the first failed target.
1657 Hint: If caused by a warning, try configure --disable-warnings-as-errors.</code></pre>
1658 <p>Let's break it down! First, the selected configuration, and the
1659 top-level target you entered on the command line that caused the failure
1660 is printed.</p>
1661 <p>Then, between the
1662 <code>Output from failing command(s) repeated here</code> and
1663 <code>End of repeated output</code> the first lines of output (stdout
1664 and stderr) from the actual failing command is repeated. In most cases,
1665 this is the error message that caused the build to fail. If multiple
1666 commands were failing (this can happen in a parallel build), output from
1667 all failed commands will be printed here.</p>
1668 <p>The path to the <code>failure-logs</code> directory is printed. In
1669 this file you will find a <code>&lt;target&gt;.log</code> file that
1670 contains the output from this command in its entirety, and also a
1671 <code>&lt;target&gt;.cmd</code>, which contain the complete command line
1672 used for running this command. You can re-run the failing command by
1673 executing <code>. &lt;path to failure-logs&gt;/&lt;target&gt;.cmd</code>
1674 in your shell.</p>
1675 <p>Another way to trace the failure is to follow the chain of make
1676 targets, from top-level targets to individual file targets. Between
1677 <code>Make failed targets repeated here</code> and
1678 <code>End of repeated output</code> the output from make showing this
1679 chain is repeated. The first failed recipe will typically contain the
1680 full path to the file in question that failed to compile. Following
1681 lines will show a trace of make targets why we ended up trying to
1682 compile that file.</p>
1683 <p>Finally, some hints are given on how to locate the error in the
1684 complete log. In this example, we would try searching the log file for
1685 "<code>psMemoryPool.o</code>". Another way to quickly locate make errors
1686 in the log is to search for "<code>] Error</code>" or
1687 "<code>***</code>".</p>
1688 <p>Note that the build failure summary will only help you if the issue
1689 was a compilation failure or similar. If the problem is more esoteric,
1690 or is due to errors in the build machinery, you will likely get empty
1691 output logs, and <code>No indication of failed target found</code>
1692 instead of the make target chain.</p>
1693 <h4 id="checking-the-build-log-file">Checking the Build Log File</h4>
1694 <p>The output (stdout and stderr) from the latest build is always stored
1695 in <code>$BUILD/build.log</code>. The previous build log is stored as
1696 <code>build.log.old</code>. This means that it is not necessary to
1697 redirect the build output yourself if you want to process it.</p>
1698 <p>You can increase the verbosity of the log file, by the
1699 <code>LOG</code> control variable to <code>make</code>. If you want to
1700 see the command lines used in compilations, use
1701 <code>LOG=cmdlines</code>. To increase the general verbosity, use
1702 <code>LOG=info</code>, <code>LOG=debug</code> or <code>LOG=trace</code>.
1703 Both of these can be combined with <code>cmdlines</code>, e.g.
1704 <code>LOG=info,cmdlines</code>. The <code>debug</code> log level will
1705 show most shell commands executed by make, and <code>trace</code> will
1706 show all. Beware that both these log levels will produce a massive build
1707 log!</p>
1708 <h3 id="fixing-unexpected-build-failures">Fixing Unexpected Build
1709 Failures</h3>
1710 <p>Most of the time, the build will fail due to incorrect changes in the
1711 source code.</p>
1712 <p>Sometimes the build can fail with no apparent changes that have
1713 caused the failure. If this is the first time you are building the JDK
1714 on this particular computer, and the build fails, the problem is likely
1715 with your build environment. But even if you have previously built the
1716 JDK with success, and it now fails, your build environment might have
1717 changed (perhaps due to OS upgrades or similar). But most likely, such
1718 failures are due to problems with the incremental rebuild.</p>
1719 <h4 id="problems-with-the-build-environment">Problems with the Build
1720 Environment</h4>
1721 <p>Make sure your configuration is correct. Re-run
1722 <code>configure</code>, and look for any warnings. Warnings that appear
1723 in the middle of the <code>configure</code> output is also repeated at
1724 the end, after the summary. The entire log is stored in
1725 <code>$BUILD/configure.log</code>.</p>
1726 <p>Verify that the summary at the end looks correct. Are you indeed
1727 using the Boot JDK and native toolchain that you expect?</p>
1728 <p>By default, the JDK has a strict approach where warnings from the
1729 compiler is considered errors which fail the build. For very new or very
1730 old compiler versions, this can trigger new classes of warnings, which
1731 thus fails the build. Run <code>configure</code> with
1732 <code>--disable-warnings-as-errors</code> to turn of this behavior. (The
1733 warnings will still show, but not make the build fail.)</p>
1734 <h4 id="problems-with-incremental-rebuilds">Problems with Incremental
1735 Rebuilds</h4>
1736 <p>Incremental rebuilds mean that when you modify part of the product,
1737 only the affected parts get rebuilt. While this works great in most
1738 cases, and significantly speed up the development process, from time to
1739 time complex interdependencies will result in an incorrect build result.
1740 This is the most common cause for unexpected build problems.</p>
1741 <p>Here are a suggested list of things to try if you are having
1742 unexpected build problems. Each step requires more time than the one
1743 before, so try them in order. Most issues will be solved at step 1 or
1744 2.</p>
1745 <ol type="1">
1746 <li><p>Make sure your repository is up-to-date</p>
1747 <p>Run <code>git pull origin master</code> to make sure you have the
1748 latest changes.</p></li>
1749 <li><p>Clean build results</p>
1750 <p>The simplest way to fix incremental rebuild issues is to run
1751 <code>make clean</code>. This will remove all build results, but not the
1752 configuration or any build system support artifacts. In most cases, this
1753 will solve build errors resulting from incremental build
1754 mismatches.</p></li>
1755 <li><p>Completely clean the build directory.</p>
1756 <p>If this does not work, the next step is to run
1757 <code>make dist-clean</code>, or removing the build output directory
1758 (<code>$BUILD</code>). This will clean all generated output, including
1759 your configuration. You will need to re-run <code>configure</code> after
1760 this step. A good idea is to run <code>make print-configuration</code>
1761 before running <code>make dist-clean</code>, as this will print your
1762 current <code>configure</code> command line. Here's a way to do
1763 this:</p>
1764 <pre><code>make print-configuration &gt; current-configuration
1765 make dist-clean
1766 bash configure $(cat current-configuration)
1767 make</code></pre></li>
1768 <li><p>Re-clone the Git repository</p>
1769 <p>Sometimes the Git repository gets in a state that causes the product
1770 to be un-buildable. In such a case, the simplest solution is often the
1771 "sledgehammer approach": delete the entire repository, and re-clone it.
1772 If you have local changes, save them first to a different location using
1773 <code>git format-patch</code>.</p></li>
1774 </ol>
1775 <h3 id="specific-build-issues">Specific Build Issues</h3>
1776 <h4 id="clock-skew">Clock Skew</h4>
1777 <p>If you get an error message like this:</p>
1778 <pre><code>File &#39;xxx&#39; has modification time in the future.
1779 Clock skew detected. Your build may be incomplete.</code></pre>
1780 <p>then the clock on your build machine is out of sync with the
1781 timestamps on the source files. Other errors, apparently unrelated but
1782 in fact caused by the clock skew, can occur along with the clock skew
1783 warnings. These secondary errors may tend to obscure the fact that the
1784 true root cause of the problem is an out-of-sync clock.</p>
1785 <p>If you see these warnings, reset the clock on the build machine, run
1786 <code>make clean</code> and restart the build.</p>
1787 <h4 id="out-of-memory-errors">Out of Memory Errors</h4>
1788 <p>On Windows, you might get error messages like this:</p>
1789 <pre><code>fatal error - couldn&#39;t allocate heap
1790 cannot create ... Permission denied
1791 spawn failed</code></pre>
1792 <p>This can be a sign of a Cygwin problem. See the information about
1793 solving problems in the <a href="#cygwin">Cygwin</a> section. Rebooting
1794 the computer might help temporarily.</p>
1795 <h4 id="spaces-in-path">Spaces in Path</h4>
1796 <p>On Windows, when configuring, <code>fixpath.sh</code> may report that
1797 some directory names have spaces. Usually, it assumes those directories
1798 have <a
1799 href="https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/fsutil-8dot3name">short
1800 paths</a>. You can run <code>fsutil file setshortname</code> in
1801 <code>cmd</code> on certain directories, such as
1802 <code>Microsoft Visual Studio</code> or <code>Windows Kits</code>, to
1803 assign arbitrary short paths so <code>configure</code> can access
1804 them.</p>
1805 <h3 id="getting-help">Getting Help</h3>
1806 <p>If none of the suggestions in this document helps you, or if you find
1807 what you believe is a bug in the build system, please contact the Build
1808 Group by sending a mail to <a
1809 href="mailto:build-dev@openjdk.org">build-dev@openjdk.org</a>. Please
1810 include the relevant parts of the configure and/or build log.</p>
1811 <p>If you need general help or advice about developing for the JDK, you
1812 can also contact the Adoption Group. See the section on <a
1813 href="#contributing-to-openjdk">Contributing to OpenJDK</a> for more
1814 information.</p>
1815 <h2 id="reproducible-builds">Reproducible Builds</h2>
1816 <p>Build reproducibility is the property of getting exactly the same
1817 bits out when building, every time, independent on who builds the
1818 product, or where. This is for many reasons a harder goal than it
1819 initially appears, but it is an important goal, for security reasons and
1820 others. Please see <a
1821 href="https://reproducible-builds.org">Reproducible Builds</a> for more
1822 information about the background and reasons for reproducible
1823 builds.</p>
1824 <p>Currently, it is not possible to build OpenJDK fully reproducibly,
1825 but getting there is an ongoing effort.</p>
1826 <p>An absolute prerequisite for building reproducible is to speficy a
1827 fixed build time, since time stamps are embedded in many file formats.
1828 This is done by setting the <code>SOURCE_DATE_EPOCH</code> environment
1829 variable, which is an <a
1830 href="https://reproducible-builds.org/docs/source-date-epoch/">industry
1831 standard</a>, that many tools, such as gcc, recognize, and use in place
1832 of the current time when generating output.</p>
1833 <p>To generate reproducible builds, you must set
1834 <code>SOURCE_DATE_EPOCH</code> before running <code>configure</code>.
1835 The value in <code>SOURCE_DATE_EPOCH</code> will be stored in the
1836 configuration, and used by <code>make</code>. Setting
1837 <code>SOURCE_DATE_EPOCH</code> before running <code>make</code> will
1838 have no effect on the build.</p>
1839 <p>You must also make sure your build does not rely on
1840 <code>configure</code>'s default adhoc version strings. Default adhoc
1841 version strings <code>OPT</code> segment include user name and source
1842 directory. You can either override just the <code>OPT</code> segment
1843 using <code>--with-version-opt=&lt;any fixed string&gt;</code>, or you
1844 can specify the entire version string using
1845 <code>--with-version-string=&lt;your version&gt;</code>.</p>
1846 <p>This is a typical example of how to build the JDK in a reproducible
1847 way:</p>
1848 <pre><code>export SOURCE_DATE_EPOCH=946684800
1849 bash configure --with-version-opt=adhoc
1850 make</code></pre>
1851 <p>Note that regardless if you specify a source date for
1852 <code>configure</code> or not, the JDK build system will set
1853 <code>SOURCE_DATE_EPOCH</code> for all build tools when building. If
1854 <code>--with-source-date</code> has the value <code>current</code>
1855 (which is the default unless <code>SOURCE_DATE_EPOCH</code> is found by
1856 in the environment by <code>configure</code>), the source date value
1857 will be determined at configure time.</p>
1858 <p>There are several aspects of reproducible builds that can be
1859 individually adjusted by <code>configure</code> arguments. If any of
1860 these are given, they will override the value derived from
1861 <code>SOURCE_DATE_EPOCH</code>. These arguments are:</p>
1862 <ul>
1863 <li><p><code>--with-source-date</code></p>
1864 <p>This option controls how the JDK build sets
1865 <code>SOURCE_DATE_EPOCH</code> when building. It can be set to a value
1866 describing a date, either an epoch based timestamp as an integer, or a
1867 valid ISO-8601 date.</p>
1868 <p>It can also be set to one of the special values <code>current</code>,
1869 <code>updated</code> or <code>version</code>. <code>current</code> means
1870 that the time of running <code>configure</code> will be used.
1871 <code>version</code> will use the nominal release date for the current
1872 JDK version. <code>updated</code>, which means that
1873 <code>SOURCE_DATE_EPOCH</code> will be set to the current time each time
1874 you are running <code>make</code>. All choices, except for
1875 <code>updated</code>, will set a fixed value for the source date
1876 timestamp.</p>
1877 <p>When <code>SOURCE_DATE_EPOCH</code> is set, the default value for
1878 <code>--with-source-date</code> will be the value given by
1879 <code>SOURCE_DATE_EPOCH</code>. Otherwise, the default value is
1880 <code>current</code>.</p></li>
1881 <li><p><code>--with-hotspot-build-time</code></p>
1882 <p>This option controls the build time string that will be included in
1883 the hotspot library (<code>libjvm.so</code> or <code>jvm.dll</code>).
1884 When the source date is fixed (e.g. by setting
1885 <code>SOURCE_DATE_EPOCH</code>), the default value for
1886 <code>--with-hotspot-build-time</code> will be an ISO 8601
1887 representation of that time stamp. Otherwise the default value will be
1888 the current time when building hotspot.</p></li>
1889 <li><p><code>--with-copyright-year</code></p>
1890 <p>This option controls the copyright year in some generated text files.
1891 When the source date is fixed (e.g. by setting
1892 <code>SOURCE_DATE_EPOCH</code>), the default value for
1893 <code>--with-copyright-year</code> will be the year of that time stamp.
1894 Otherwise the default is the current year at the time of running
1895 configure. This can be overridden by
1896 <code>--with-copyright-year=&lt;year&gt;</code>.</p></li>
1897 <li><p><code>--enable-reproducible-build</code></p>
1898 <p>This option controls some additional behavior needed to make the
1899 build reproducible. When the source date is fixed (e.g. by setting
1900 <code>SOURCE_DATE_EPOCH</code>), this flag will be turned on by default.
1901 Otherwise, the value is determined by heuristics. If it is explicitly
1902 turned off, the build might not be reproducible.</p></li>
1903 </ul>
1904 <h2 id="hints-and-suggestions-for-advanced-users">Hints and Suggestions
1905 for Advanced Users</h2>
1906 <h3 id="bash-completion">Bash Completion</h3>
1907 <p>The <code>configure</code> and <code>make</code> commands tries to
1908 play nice with bash command-line completion (using
1909 <code>&lt;tab&gt;</code> or <code>&lt;tab&gt;&lt;tab&gt;</code>). To use
1910 this functionality, make sure you enable completion in your
1911 <code>~/.bashrc</code> (see instructions for bash in your operating
1912 system).</p>
1913 <p>Make completion will work out of the box, and will complete valid
1914 make targets. For instance, typing <code>make jdk-i&lt;tab&gt;</code>
1915 will complete to <code>make jdk-image</code>.</p>
1916 <p>The <code>configure</code> script can get completion for options, but
1917 for this to work you need to help <code>bash</code> on the way. The
1918 standard way of running the script, <code>bash configure</code>, will
1919 not be understood by bash completion. You need <code>configure</code> to
1920 be the command to run. One way to achieve this is to add a simple helper
1921 script to your path:</p>
1922 <pre><code>cat &lt;&lt; EOT &gt; /tmp/configure
1923 #!/bin/bash
1924 if [ \$(pwd) = \$(cd \$(dirname \$0); pwd) ] ; then
1925   echo &gt;&amp;2 &quot;Abort: Trying to call configure helper recursively&quot;
1926   exit 1
1927 fi
1928 
1929 bash \$PWD/configure &quot;\$@&quot;
1930 EOT
1931 chmod +x /tmp/configure
1932 sudo mv /tmp/configure /usr/local/bin</code></pre>
1933 <p>Now <code>configure --en&lt;tab&gt;-dt&lt;tab&gt;</code> will result
1934 in <code>configure --enable-dtrace</code>.</p>
1935 <h3 id="using-multiple-configurations">Using Multiple
1936 Configurations</h3>
1937 <p>You can have multiple configurations for a single source repository.
1938 When you create a new configuration, run
1939 <code>configure --with-conf-name=&lt;name&gt;</code> to create a
1940 configuration with the name <code>&lt;name&gt;</code>. Alternatively,
1941 you can create a directory under <code>build</code> and run
1942 <code>configure</code> from there, e.g.
1943 <code>mkdir build/&lt;name&gt; &amp;&amp; cd build/&lt;name&gt; &amp;&amp; bash ../../configure</code>.</p>
1944 <p>Then you can build that configuration using
1945 <code>make CONF_NAME=&lt;name&gt;</code> or
1946 <code>make CONF=&lt;pattern&gt;</code>, where
1947 <code>&lt;pattern&gt;</code> is a substring matching one or several
1948 configurations, e.g. <code>CONF=debug</code>. The special empty pattern
1949 (<code>CONF=</code>) will match <em>all</em> available configuration, so
1950 <code>make CONF= hotspot</code> will build the <code>hotspot</code>
1951 target for all configurations. Alternatively, you can execute
1952 <code>make</code> in the configuration directory, e.g.
1953 <code>cd build/&lt;name&gt; &amp;&amp; make</code>.</p>
1954 <h3 id="handling-reconfigurations">Handling Reconfigurations</h3>
1955 <p>If you update the repository and part of the configure script has
1956 changed, the build system will force you to re-run
1957 <code>configure</code>.</p>
1958 <p>Most of the time, you will be fine by running <code>configure</code>
1959 again with the same arguments as the last time, which can easily be
1960 performed by <code>make reconfigure</code>. To simplify this, you can
1961 use the <code>CONF_CHECK</code> make control variable, either as
1962 <code>make CONF_CHECK=auto</code>, or by setting an environment
1963 variable. For instance, if you add <code>export CONF_CHECK=auto</code>
1964 to your <code>.bashrc</code> file, <code>make</code> will always run
1965 <code>reconfigure</code> automatically whenever the configure script has
1966 changed.</p>
1967 <p>You can also use <code>CONF_CHECK=ignore</code> to skip the check for
1968 a needed configure update. This might speed up the build, but comes at
1969 the risk of an incorrect build result. This is only recommended if you
1970 know what you're doing.</p>
1971 <p>From time to time, you will also need to modify the command line to
1972 <code>configure</code> due to changes. Use
1973 <code>make print-configuration</code> to show the command line used for
1974 your current configuration.</p>
1975 <h3 id="using-fine-grained-make-targets">Using Fine-Grained Make
1976 Targets</h3>
1977 <p>The default behavior for make is to create consistent and correct
1978 output, at the expense of build speed, if necessary.</p>
1979 <p>If you are prepared to take some risk of an incorrect build, and know
1980 enough of the system to understand how things build and interact, you
1981 can speed up the build process considerably by instructing make to only
1982 build a portion of the product.</p>
1983 <h4 id="building-individual-modules">Building Individual Modules</h4>
1984 <p>The safe way to use fine-grained make targets is to use the module
1985 specific make targets. All source code in the JDK is organized so it
1986 belongs to a module, e.g. <code>java.base</code> or
1987 <code>jdk.jdwp.agent</code>. You can build only a specific module, by
1988 giving it as make target: <code>make jdk.jdwp.agent</code>. If the
1989 specified module depends on other modules (e.g. <code>java.base</code>),
1990 those modules will be built first.</p>
1991 <p>You can also specify a set of modules, just as you can always specify
1992 a set of make targets:
1993 <code>make jdk.crypto.cryptoki jdk.crypto.ec jdk.crypto.mscapi</code></p>
1994 <h4 id="building-individual-module-phases">Building Individual Module
1995 Phases</h4>
1996 <p>The build process for each module is divided into separate phases.
1997 Not all modules need all phases. Which are needed depends on what kind
1998 of source code and other artifact the module consists of. The phases
1999 are:</p>
2000 <ul>
2001 <li><code>gensrc</code> (Generate source code to compile)</li>
2002 <li><code>gendata</code> (Generate non-source code artifacts)</li>
2003 <li><code>copy</code> (Copy resource artifacts)</li>
2004 <li><code>java</code> (Compile Java code)</li>
2005 <li><code>launchers</code> (Compile native executables)</li>
2006 <li><code>libs</code> (Compile native libraries)</li>
2007 </ul>
2008 <p>You can build only a single phase for a module by using the notation
2009 <code>$MODULE-$PHASE</code>. For instance, to build the
2010 <code>gensrc</code> phase for <code>java.base</code>, use
2011 <code>make java.base-gensrc</code>.</p>
2012 <p>Note that some phases may depend on others, e.g. <code>java</code>
2013 depends on <code>gensrc</code> (if present). Make will build all needed
2014 prerequisites before building the requested phase.</p>
2015 <h4 id="skipping-the-dependency-check">Skipping the Dependency
2016 Check</h4>
2017 <p>When using an iterative development style with frequent quick
2018 rebuilds, the dependency check made by make can take up a significant
2019 portion of the time spent on the rebuild. In such cases, it can be
2020 useful to bypass the dependency check in make.</p>
2021 <blockquote>
2022 <p><strong>Note that if used incorrectly, this can lead to a broken
2023 build!</strong></p>
2024 </blockquote>
2025 <p>To achieve this, append <code>-only</code> to the build target. For
2026 instance, <code>make jdk.jdwp.agent-java-only</code> will <em>only</em>
2027 build the <code>java</code> phase of the <code>jdk.jdwp.agent</code>
2028 module. If the required dependencies are not present, the build can
2029 fail. On the other hand, the execution time measures in
2030 milliseconds.</p>
2031 <p>A useful pattern is to build the first time normally (e.g.
2032 <code>make jdk.jdwp.agent</code>) and then on subsequent builds, use the
2033 <code>-only</code> make target.</p>
2034 <h4 id="rebuilding-part-of-java.base-jdk_filter">Rebuilding Part of
2035 java.base (JDK_FILTER)</h4>
2036 <p>If you are modifying files in <code>java.base</code>, which is the by
2037 far largest module in the JDK, then you need to rebuild all those files
2038 whenever a single file has changed. (This inefficiency will hopefully be
2039 addressed in JDK 10.)</p>
2040 <p>As a hack, you can use the make control variable
2041 <code>JDK_FILTER</code> to specify a pattern that will be used to limit
2042 the set of files being recompiled. For instance,
2043 <code>make java.base JDK_FILTER=javax/crypto</code> (or, to combine
2044 methods, <code>make java.base-java-only JDK_FILTER=javax/crypto</code>)
2045 will limit the compilation to files in the <code>javax.crypto</code>
2046 package.</p>
2047 <h2 id="understanding-the-build-system">Understanding the Build
2048 System</h2>
2049 <p>This section will give you a more technical description on the
2050 details of the build system.</p>
2051 <h3 id="configurations">Configurations</h3>
2052 <p>The build system expects to find one or more configuration. These are
2053 technically defined by the <code>spec.gmk</code> in a subdirectory to
2054 the <code>build</code> subdirectory. The <code>spec.gmk</code> file is
2055 generated by <code>configure</code>, and contains in principle the
2056 configuration (directly or by files included by
2057 <code>spec.gmk</code>).</p>
2058 <p>You can, in fact, select a configuration to build by pointing to the
2059 <code>spec.gmk</code> file with the <code>SPEC</code> make control
2060 variable, e.g. <code>make SPEC=$BUILD/spec.gmk</code>. While this is not
2061 the recommended way to call <code>make</code> as a user, it is what is
2062 used under the hood by the build system.</p>
2063 <h3 id="build-output-structure">Build Output Structure</h3>
2064 <p>The build output for a configuration will end up in
2065 <code>build/&lt;configuration name&gt;</code>, which we refer to as
2066 <code>$BUILD</code> in this document. The <code>$BUILD</code> directory
2067 contains the following important directories:</p>
2068 <pre><code>buildtools/
2069 configure-support/
2070 hotspot/
2071 images/
2072 jdk/
2073 make-support/
2074 support/
2075 test-results/
2076 test-support/</code></pre>
2077 <p>This is what they are used for:</p>
2078 <ul>
2079 <li><p><code>images</code>: This is the directory were the output of the
2080 <code>*-image</code> make targets end up. For instance,
2081 <code>make jdk-image</code> ends up in <code>images/jdk</code>.</p></li>
2082 <li><p><code>jdk</code>: This is the "exploded image". After
2083 <code>make jdk</code>, you will be able to launch the newly built JDK by
2084 running <code>$BUILD/jdk/bin/java</code>.</p></li>
2085 <li><p><code>test-results</code>: This directory contains the results
2086 from running tests.</p></li>
2087 <li><p><code>support</code>: This is an area for intermediate files
2088 needed during the build, e.g. generated source code, object files and
2089 class files. Some noteworthy directories in <code>support</code> is
2090 <code>gensrc</code>, which contains the generated source code, and the
2091 <code>modules_*</code> directories, which contains the files in a
2092 per-module hierarchy that will later be collapsed into the
2093 <code>jdk</code> directory of the exploded image.</p></li>
2094 <li><p><code>buildtools</code>: This is an area for tools compiled for
2095 the build platform that are used during the rest of the build.</p></li>
2096 <li><p><code>hotspot</code>: This is an area for intermediate files
2097 needed when building hotspot.</p></li>
2098 <li><p><code>configure-support</code>, <code>make-support</code> and
2099 <code>test-support</code>: These directories contain files that are
2100 needed by the build system for <code>configure</code>, <code>make</code>
2101 and for running tests.</p></li>
2102 </ul>
2103 <h3 id="fixpath">Fixpath</h3>
2104 <p>Windows path typically look like <code>C:\User\foo</code>, while Unix
2105 paths look like <code>/home/foo</code>. Tools with roots from Unix often
2106 experience issues related to this mismatch when running on Windows.</p>
2107 <p>In the JDK build, we always use Unix paths internally, and only just
2108 before calling a tool that does not understand Unix paths do we convert
2109 them to Windows paths.</p>
2110 <p>This conversion is done by the <code>fixpath</code> tool, which is a
2111 small wrapper that modifies unix-style paths to Windows-style paths in
2112 command lines. Fixpath is compiled automatically by
2113 <code>configure</code>.</p>
2114 <h3 id="native-debug-symbols">Native Debug Symbols</h3>
2115 <p>Native libraries and executables can have debug symbol (and other
2116 debug information) associated with them. How this works is very much
2117 platform dependent, but a common problem is that debug symbol
2118 information takes a lot of disk space, but is rarely needed by the end
2119 user.</p>
2120 <p>The JDK supports different methods on how to handle debug symbols.
2121 The method used is selected by <code>--with-native-debug-symbols</code>,
2122 and available methods are <code>none</code>, <code>internal</code>,
2123 <code>external</code>, <code>zipped</code>.</p>
2124 <ul>
2125 <li><p><code>none</code> means that no debug symbols will be generated
2126 during the build.</p></li>
2127 <li><p><code>internal</code> means that debug symbols will be generated
2128 during the build, and they will be stored in the generated
2129 binary.</p></li>
2130 <li><p><code>external</code> means that debug symbols will be generated
2131 during the build, and after the compilation, they will be moved into a
2132 separate <code>.debuginfo</code> file. (This was previously known as
2133 FDS, Full Debug Symbols).</p></li>
2134 <li><p><code>zipped</code> is like <code>external</code>, but the
2135 .debuginfo file will also be zipped into a <code>.diz</code>
2136 file.</p></li>
2137 </ul>
2138 <p>When building for distribution, <code>zipped</code> is a good
2139 solution. Binaries built with <code>internal</code> is suitable for use
2140 by developers, since they facilitate debugging, but should be stripped
2141 before distributed to end users.</p>
2142 <h3 id="autoconf-details">Autoconf Details</h3>
2143 <p>The <code>configure</code> script is based on the autoconf framework,
2144 but in some details deviate from a normal autoconf
2145 <code>configure</code> script.</p>
2146 <p>The <code>configure</code> script in the top level directory of the
2147 JDK is just a thin wrapper that calls
2148 <code>make/autoconf/configure</code>. This in turn will run
2149 <code>autoconf</code> to create the runnable (generated) configure
2150 script, as <code>.build/generated-configure.sh</code>. Apart from being
2151 responsible for the generation of the runnable script, the
2152 <code>configure</code> script also provides functionality that is not
2153 easily expressed in the normal Autoconf framework. As part of this
2154 functionality, the generated script is called.</p>
2155 <p>The build system will detect if the Autoconf source files have
2156 changed, and will trigger a regeneration of the generated script if
2157 needed. You can also manually request such an update by
2158 <code>bash configure autogen</code>.</p>
2159 <p>In previous versions of the JDK, the generated script was checked in
2160 at <code>make/autoconf/generated-configure.sh</code>. This is no longer
2161 the case.</p>
2162 <h3 id="developing-the-build-system-itself">Developing the Build System
2163 Itself</h3>
2164 <p>This section contains a few remarks about how to develop for the
2165 build system itself. It is not relevant if you are only making changes
2166 in the product source code.</p>
2167 <p>While technically using <code>make</code>, the make source files of
2168 the JDK does not resemble most other Makefiles. Instead of listing
2169 specific targets and actions (perhaps using patterns), the basic modus
2170 operandi is to call a high-level function (or properly, macro) from the
2171 API in <code>make/common</code>. For instance, to compile all classes in
2172 the <code>jdk.internal.foo</code> package in the <code>jdk.foo</code>
2173 module, a call like this would be made:</p>
2174 <pre><code>$(eval $(call SetupJavaCompilation, BUILD_FOO_CLASSES, \
2175     SETUP := GENERATE_OLDBYTECODE, \
2176     SRC := $(TOPDIR)/src/jkd.foo/share/classes, \
2177     INCLUDES := jdk/internal/foo, \
2178     BIN := $(SUPPORT_OUTPUTDIR)/foo_classes, \
2179 ))</code></pre>
2180 <p>By encapsulating and expressing the high-level knowledge of
2181 <em>what</em> should be done, rather than <em>how</em> it should be done
2182 (as is normal in Makefiles), we can build a much more powerful and
2183 flexible build system.</p>
2184 <p>Correct dependency tracking is paramount. Sloppy dependency tracking
2185 will lead to improper parallelization, or worse, race conditions.</p>
2186 <p>To test for/debug race conditions, try running
2187 <code>make JOBS=1</code> and <code>make JOBS=100</code> and see if it
2188 makes any difference. (It shouldn't).</p>
2189 <p>To compare the output of two different builds and see if, and how,
2190 they differ, run <code>$BUILD1/compare.sh -o $BUILD2</code>, where
2191 <code>$BUILD1</code> and <code>$BUILD2</code> are the two builds you
2192 want to compare.</p>
2193 <p>To automatically build two consecutive versions and compare them, use
2194 <code>COMPARE_BUILD</code>. The value of <code>COMPARE_BUILD</code> is a
2195 set of variable=value assignments, like this:</p>
2196 <pre><code>make COMPARE_BUILD=CONF=--enable-new-hotspot-feature:MAKE=hotspot</code></pre>
2197 <p>See <code>make/InitSupport.gmk</code> for details on how to use
2198 <code>COMPARE_BUILD</code>.</p>
2199 <p>To analyze build performance, run with <code>LOG=trace</code> and
2200 check <code>$BUILD/build-trace-time.log</code>. Use <code>JOBS=1</code>
2201 to avoid parallelism.</p>
2202 <p>Please check that you adhere to the <a
2203 href="http://openjdk.org/groups/build/doc/code-conventions.html">Code
2204 Conventions for the Build System</a> before submitting patches.</p>
2205 <h2 id="contributing-to-the-jdk">Contributing to the JDK</h2>
2206 <p>So, now you've built your JDK, and made your first patch, and want to
2207 contribute it back to the OpenJDK Community.</p>
2208 <p>First of all: Thank you! We gladly welcome your contribution.
2209 However, please bear in mind that the JDK is a massive project, and we
2210 must ask you to follow our rules and guidelines to be able to accept
2211 your contribution.</p>
2212 <p>The official place to start is the <a
2213 href="http://openjdk.org/contribute/">'How to contribute' page</a>.
2214 There is also an official (but somewhat outdated and skimpy on details)
2215 <a href="http://openjdk.org/guide/">Developer's Guide</a>.</p>
2216 <p>If this seems overwhelming to you, the Adoption Group is there to
2217 help you! A good place to start is their <a
2218 href="https://wiki.openjdk.org/display/Adoption/New+Contributor">'New
2219 Contributor' page</a>, or start reading the comprehensive <a
2220 href="https://adoptopenjdk.gitbooks.io/adoptopenjdk-getting-started-kit/en/">Getting
2221 Started Kit</a>. The Adoption Group will also happily answer any
2222 questions you have about contributing. Contact them by <a
2223 href="http://mail.openjdk.org/mailman/listinfo/adoption-discuss">mail</a>
2224 or <a href="http://openjdk.org/irc/">IRC</a>.</p>
2225 <h2 id="editing-this-document">Editing this document</h2>
2226 <p>If you want to contribute changes to this document, edit
2227 <code>doc/building.md</code> and then run
2228 <code>make update-build-docs</code> to generate the same changes in
2229 <code>doc/building.html</code>.</p>
2230 </body>
2231 </html>