--- a/common/doc/building.html Tue Jun 20 13:12:42 2017 +0200
+++ b/common/doc/building.html Wed Jun 21 12:51:25 2017 +0200
@@ -4,149 +4,345 @@
<meta charset="utf-8">
<meta name="generator" content="pandoc">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
- <title>OpenJDK Build README</title>
+ <title>Building OpenJDK</title>
<style type="text/css">code{white-space: pre;}</style>
- <link rel="stylesheet" href="../../jdk/make/data/docs-resources/specs/resources/jdk-default.css">
+ <link rel="stylesheet" href="../../jdk/make/data/docs-resources/resources/jdk-default.css">
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
<![endif]-->
+ <style type="text/css">pre, code, tt { color: #1d6ae5; }</style>
</head>
<body>
<header>
-<h1 class="title">OpenJDK Build README</h1>
+<h1 class="title">Building OpenJDK</h1>
</header>
-<figure>
-<img src="http://openjdk.java.net/images/openjdk.png" alt="OpenJDK" /><figcaption>OpenJDK</figcaption>
-</figure>
-<hr />
-<h2 id="introduction">Introduction</h2>
-<p>This README file contains build instructions for the <a href="http://openjdk.java.net">OpenJDK</a>. Building the source code for the OpenJDK requires a certain degree of technical expertise.</p>
-<h3 id="this-is-a-major-re-write-of-this-document.">!!!!!!!!!!!!!!! THIS IS A MAJOR RE-WRITE of this document. !!!!!!!!!!!!!</h3>
-<p>Some Headlines:</p>
-<ul>
-<li>The build is now a "<code>configure && make</code>" style build</li>
-<li>Any GNU make 3.81 or newer should work, except on Windows where 4.0 or newer is recommended.</li>
-<li>The build should scale, i.e. more processors should cause the build to be done in less wall-clock time</li>
-<li>Nested or recursive make invocations have been significantly reduced, as has the total fork/exec or spawning of sub processes during the build</li>
-<li>Windows MKS usage is no longer supported</li>
-<li>Windows Visual Studio <code>vsvars*.bat</code> and <code>vcvars*.bat</code> files are run automatically</li>
-<li>Ant is no longer used when building the OpenJDK</li>
-<li>Use of ALT_* environment variables for configuring the build is no longer supported</li>
-</ul>
-<hr />
-<h2 id="contents">Contents</h2>
-<ul>
-<li><a href="#introduction">Introduction</a></li>
-<li><a href="#hg">Use of Mercurial</a>
+<nav id="TOC">
<ul>
-<li><a href="#get_source">Getting the Source</a></li>
-<li><a href="#repositories">Repositories</a></li>
+<li><a href="#tldr-instructions-for-the-impatient">TL;DR (Instructions for the Impatient)</a></li>
+<li><a href="#introduction">Introduction</a></li>
+<li><a href="#getting-the-source-code">Getting the Source Code</a><ul>
+<li><a href="#special-considerations">Special Considerations</a></li>
+<li><a href="#using-get_source.sh">Using get_source.sh</a></li>
+<li><a href="#using-hgforest.sh">Using hgforest.sh</a></li>
+<li><a href="#using-the-trees-extension">Using the Trees Extension</a></li>
+</ul></li>
+<li><a href="#build-hardware-requirements">Build Hardware Requirements</a><ul>
+<li><a href="#building-on-x86">Building on x86</a></li>
+<li><a href="#building-on-sparc">Building on sparc</a></li>
+<li><a href="#building-on-armaarch64">Building on arm/aarch64</a></li>
+</ul></li>
+<li><a href="#operating-system-requirements">Operating System Requirements</a><ul>
+<li><a href="#windows">Windows</a></li>
+<li><a href="#solaris">Solaris</a></li>
+<li><a href="#macos">macOS</a></li>
+<li><a href="#linux">Linux</a></li>
+<li><a href="#aix">AIX</a></li>
+</ul></li>
+<li><a href="#native-compiler-toolchain-requirements">Native Compiler (Toolchain) Requirements</a><ul>
+<li><a href="#gcc">gcc</a></li>
+<li><a href="#clang">clang</a></li>
+<li><a href="#apple-xcode">Apple Xcode</a></li>
+<li><a href="#oracle-solaris-studio">Oracle Solaris Studio</a></li>
+<li><a href="#microsoft-visual-studio">Microsoft Visual Studio</a></li>
+<li><a href="#ibm-xl-cc">IBM XL C/C++</a></li>
+</ul></li>
+<li><a href="#boot-jdk-requirements">Boot JDK Requirements</a><ul>
+<li><a href="#jdk-8-on-linux">JDK 8 on Linux</a></li>
+<li><a href="#jdk-8-on-windows">JDK 8 on Windows</a></li>
+<li><a href="#jdk-8-on-macos">JDK 8 on macOS</a></li>
+<li><a href="#jdk-8-on-aix">JDK 8 on AIX</a></li>
</ul></li>
-<li><a href="#building">Building</a>
-<ul>
-<li><a href="#setup">System Setup</a>
-<ul>
-<li><a href="#linux">Linux</a></li>
-<li><a href="#solaris">Solaris</a></li>
-<li><a href="#macosx">Mac OS X</a></li>
-<li><a href="#windows">Windows</a></li>
+<li><a href="#external-library-requirements">External Library Requirements</a><ul>
+<li><a href="#freetype">FreeType</a></li>
+<li><a href="#cups">CUPS</a></li>
+<li><a href="#x11">X11</a></li>
+<li><a href="#alsa">ALSA</a></li>
+<li><a href="#libffi">libffi</a></li>
+<li><a href="#libelf">libelf</a></li>
+</ul></li>
+<li><a href="#other-tooling-requirements">Other Tooling Requirements</a><ul>
+<li><a href="#gnu-make">GNU Make</a></li>
+<li><a href="#gnu-bash">GNU Bash</a></li>
+<li><a href="#autoconf">Autoconf</a></li>
+</ul></li>
+<li><a href="#running-configure">Running Configure</a><ul>
+<li><a href="#common-configure-arguments">Common Configure Arguments</a></li>
+<li><a href="#configure-control-variables">Configure Control Variables</a></li>
+</ul></li>
+<li><a href="#running-make">Running Make</a><ul>
+<li><a href="#common-make-targets">Common Make Targets</a></li>
+<li><a href="#make-control-variables">Make Control Variables</a></li>
+</ul></li>
+<li><a href="#running-tests">Running Tests</a></li>
+<li><a href="#cross-compiling">Cross-compiling</a><ul>
+<li><a href="#boot-jdk-and-build-jdk">Boot JDK and Build JDK</a></li>
+<li><a href="#specifying-the-target-platform">Specifying the Target Platform</a></li>
+<li><a href="#toolchain-considerations">Toolchain Considerations</a></li>
+<li><a href="#native-libraries">Native Libraries</a></li>
+<li><a href="#building-for-armaarch64">Building for ARM/aarch64</a></li>
+<li><a href="#verifying-the-build">Verifying the Build</a></li>
+</ul></li>
+<li><a href="#build-performance">Build Performance</a><ul>
+<li><a href="#disk-speed">Disk Speed</a></li>
+<li><a href="#virus-checking">Virus Checking</a></li>
+<li><a href="#ccache">Ccache</a></li>
+<li><a href="#precompiled-headers">Precompiled Headers</a></li>
+<li><a href="#icecc-icecream">Icecc / icecream</a></li>
+<li><a href="#using-sjavac">Using sjavac</a></li>
+<li><a href="#building-the-right-target">Building the Right Target</a></li>
</ul></li>
-<li><a href="#configure">Configure</a></li>
-<li><a href="#make">Make</a></li>
+<li><a href="#troubleshooting">Troubleshooting</a><ul>
+<li><a href="#locating-the-source-of-the-error">Locating the Source of the Error</a></li>
+<li><a href="#fixing-unexpected-build-failures">Fixing Unexpected Build Failures</a></li>
+<li><a href="#specific-build-issues">Specific Build Issues</a></li>
+<li><a href="#getting-help">Getting Help</a></li>
+</ul></li>
+<li><a href="#hints-and-suggestions-for-advanced-users">Hints and Suggestions for Advanced Users</a><ul>
+<li><a href="#setting-up-a-forest-for-pushing-changes-defpath">Setting Up a Forest for Pushing Changes (defpath)</a></li>
+<li><a href="#bash-completion">Bash Completion</a></li>
+<li><a href="#using-multiple-configurations">Using Multiple Configurations</a></li>
+<li><a href="#handling-reconfigurations">Handling Reconfigurations</a></li>
+<li><a href="#using-fine-grained-make-targets">Using Fine-Grained Make Targets</a></li>
+<li><a href="#learn-about-mercurial">Learn About Mercurial</a></li>
+</ul></li>
+<li><a href="#understanding-the-build-system">Understanding the Build System</a><ul>
+<li><a href="#configurations">Configurations</a></li>
+<li><a href="#build-output-structure">Build Output Structure</a></li>
+<li><a href="#fixpath">Fixpath</a></li>
+<li><a href="#native-debug-symbols">Native Debug Symbols</a></li>
+<li><a href="#autoconf-details">Autoconf Details</a></li>
+<li><a href="#developing-the-build-system-itself">Developing the Build System Itself</a></li>
</ul></li>
-<li><a href="#testing">Testing</a></li>
+<li><a href="#contributing-to-openjdk">Contributing to OpenJDK</a></li>
</ul>
-<hr />
+</nav>
+<h2 id="tldr-instructions-for-the-impatient">TL;DR (Instructions for the Impatient)</h2>
+<p>If you are eager to try out building OpenJDK, these simple steps works most of the time. They assume that you have installed Mercurial (and Cygwin if running on Windows) and cloned the top-level OpenJDK repository that you want to build.</p>
+<ol type="1">
+<li><p><a href="#getting-the-source-code">Get the complete source code</a>:<br />
+<code>bash get_source.sh</code></p></li>
+<li><p><a href="#running-configure">Run configure</a>:<br />
+<code>bash configure</code></p>
+<p>If <code>configure</code> fails due to missing dependencies (to either the <a href="#native-compiler-toolchain-requirements">toolchain</a>, <a href="#external-library-requirements">external libraries</a> or the <a href="#boot-jdk-requirements">boot JDK</a>), most of the time it prints a suggestion on how to resolve the situation on your platform. Follow the instructions, and try running <code>bash configure</code> again.</p></li>
+<li><p><a href="#running-make">Run make</a>:<br />
+<code>make images</code></p></li>
+<li><p>Verify your newly built JDK:<br />
+<code>./build/*/images/jdk/bin/java -version</code></p></li>
+<li><p><a href="##running-tests">Run basic tests</a>:<br />
+<code>make run-test-tier1</code></p></li>
+</ol>
+<p>If any of these steps failed, or if you want to know more about build requirements or build functionality, please continue reading this document.</p>
+<h2 id="introduction">Introduction</h2>
+<p>OpenJDK is a complex software project. Building it requires a certain amount of technical expertise, a fair number of dependencies on external software, and reasonably powerful hardware.</p>
+<p>If you just want to use OpenJDK and not build it yourself, this document is not for you. See for instance <a href="http://openjdk.java.net/install">OpenJDK installation</a> for some methods of installing a prebuilt OpenJDK.</p>
+<h2 id="getting-the-source-code">Getting the Source Code</h2>
+<p>OpenJDK uses <a href="http://www.mercurial-scm.org">Mercurial</a> for source control. The source code is contained not in a single Mercurial repository, but in a tree ("forest") of interrelated repositories. You will need to check out all of the repositories to be able to build OpenJDK. To assist you in dealing with this somewhat unusual arrangement, there are multiple tools available, which are explained below.</p>
+<p>In any case, make sure you are getting the correct version. At the <a href="http://hg.openjdk.java.net/">OpenJDK Mercurial server</a> you can see a list of all available forests. If you want to build an older version, e.g. JDK 8, it is recommended that you get the <code>jdk8u</code> forest, which contains incremental updates, instead of the <code>jdk8</code> forest, which was frozen at JDK 8 GA.</p>
+<p>If you are new to Mercurial, a good place to start is the <a href="http://www.mercurial-scm.org/guide">Mercurial Beginner's Guide</a>. The rest of this document assumes a working knowledge of Mercurial.</p>
+<h3 id="special-considerations">Special Considerations</h3>
+<p>For a smooth building experience, it is recommended that you follow these rules on where and how to check out the source code.</p>
<ul>
-<li><a href="#hints">Appendix A: Hints and Tips</a>
+<li><p>Do not check out the source code in a path which contains spaces. Chances are the build will not work. This is most likely to be an issue on Windows systems.</p></li>
+<li><p>Do not check out the source code in a path which has a very long name or is nested many levels deep. Chances are you will hit an OS limitation during the build.</p></li>
+<li><p>Put the source code on a local disk, not a network share. If possible, use an SSD. The build process is very disk intensive, and having slow disk access will significantly increase build times. If you need to use a network share for the source code, see below for suggestions on how to keep the build artifacts on a local disk.</p></li>
+<li><p>On Windows, extra care must be taken to make sure the <a href="#cygwin">Cygwin</a> environment is consistent. It is recommended that you follow this procedure:</p>
<ul>
-<li><a href="#faq">FAQ</a></li>
-<li><a href="#performance">Build Performance Tips</a></li>
-<li><a href="#troubleshooting">Troubleshooting</a></li>
-</ul></li>
-<li><a href="#gmake">Appendix B: GNU Make Information</a></li>
-<li><a href="#buildenvironments">Appendix C: Build Environments</a></li>
+<li><p>Create the directory that is going to contain the top directory of the OpenJDK clone by using the <code>mkdir</code> command in the Cygwin bash shell. That is, do <em>not</em> create it using Windows Explorer. This will ensure that it will have proper Cygwin attributes, and that it's children will inherit those attributes.</p></li>
+<li><p>Do not put the OpenJDK clone in a path under your Cygwin home directory. This is especially important if your user name contains spaces and/or mixed upper and lower case letters.</p></li>
+<li><p>Clone the OpenJDK repository using the Cygwin command line <code>hg</code> client as instructed in this document. That is, do <em>not</em> use another Mercurial client such as TortoiseHg.</p></li>
+</ul>
+<p>Failure to follow this procedure might result in hard-to-debug build problems.</p></li>
+</ul>
+<h3 id="using-get_source.sh">Using get_source.sh</h3>
+<p>The simplest way to get the entire forest is probably to clone the top-level repository and then run the <code>get_source.sh</code> script, like this:</p>
+<pre><code>hg clone http://hg.openjdk.java.net/jdk9/jdk9
+cd jdk9
+bash get_source.sh</code></pre>
+<p>The first time this is run, it will clone all the sub-repositories. Any subsequent execution of the script will update all sub-repositories to the latest revision.</p>
+<h3 id="using-hgforest.sh">Using hgforest.sh</h3>
+<p>The <code>hgforest.sh</code> script is more expressive than <code>get_source.sh</code>. It takes any number of arguments, and runs <code>hg</code> with those arguments on each sub-repository in the forest. The <code>get_source.sh</code> script is basically a simple wrapper that runs either <code>hgforest.sh clone</code> or <code>hgforest.sh pull -u</code>.</p>
+<ul>
+<li><p>Cloning the forest:</p>
+<pre><code>hg clone http://hg.openjdk.java.net/jdk9/jdk9
+cd jdk9
+bash common/bin/hgforest.sh clone</code></pre></li>
+<li><p>Pulling and updating the forest:</p>
+<pre><code>bash common/bin/hgforest.sh pull -u</code></pre></li>
+<li><p>Merging over the entire forest:</p>
+<pre><code>bash common/bin/hgforest.sh merge</code></pre></li>
</ul>
-<hr />
-<h2 id="use-of-mercurial">Use of Mercurial</h2>
-<p>The OpenJDK sources are maintained with the revision control system <a href="http://mercurial.selenic.com/wiki/Mercurial">Mercurial</a>. If you are new to Mercurial, please see the <a href="http://mercurial.selenic.com/wiki/BeginnersGuides">Beginner Guides</a> or refer to the <a href="http://hgbook.red-bean.com/">Mercurial Book</a>. The first few chapters of the book provide an excellent overview of Mercurial, what it is and how it works.</p>
-<p>For using Mercurial with the OpenJDK refer to the <a href="http://openjdk.java.net/guide/repositories.html#installConfig">Developer Guide: Installing and Configuring Mercurial</a> section for more information.</p>
-<h3 id="getting-the-source">Getting the Source</h3>
-<p>To get the entire set of OpenJDK Mercurial repositories use the script <code>get_source.sh</code> located in the root repository:</p>
-<pre><code> hg clone http://hg.openjdk.java.net/jdk9/jdk9 YourOpenJDK
- cd YourOpenJDK
- bash ./get_source.sh</code></pre>
-<p>Once you have all the repositories, keep in mind that each repository is its own independent repository. You can also re-run <code>./get_source.sh</code> anytime to pull over all the latest changesets in all the repositories. This set of nested repositories has been given the term "forest" and there are various ways to apply the same <code>hg</code> command to each of the repositories. For example, the script <code>make/scripts/hgforest.sh</code> can be used to repeat the same <code>hg</code> command on every repository, e.g.</p>
-<pre><code> cd YourOpenJDK
- bash ./make/scripts/hgforest.sh status</code></pre>
-<h3 id="repositories">Repositories</h3>
-<p>The set of repositories and what they contain:</p>
+<h3 id="using-the-trees-extension">Using the Trees Extension</h3>
+<p>The trees extension is a Mercurial add-on that helps you deal with the forest. More information is available on the <a href="http://openjdk.java.net/projects/code-tools/trees">Code Tools trees page</a>.</p>
+<h4 id="installing-the-extension">Installing the Extension</h4>
+<p>Install the extension by cloning <code>http://hg.openjdk.java.net/code-tools/trees</code> and updating your <code>.hgrc</code> file. Here's one way to do this:</p>
+<pre><code>cd ~
+mkdir hg-ext
+cd hg-ext
+hg clone http://hg.openjdk.java.net/code-tools/trees
+cat << EOT >> ~/.hgrc
+[extensions]
+trees=~/hg-ext/trees/trees.py
+EOT</code></pre>
+<h4 id="initializing-the-tree">Initializing the Tree</h4>
+<p>The trees extension needs to know the structure of the forest. If you have already cloned the entire forest using another method, you can initialize the forest like this:</p>
+<pre><code>hg tconf --set --walk --depth</code></pre>
+<p>Or you can clone the entire forest at once, if you substitute <code>clone</code> with <code>tclone</code> when cloning the top-level repository, e.g. like this:</p>
+<pre><code>hg tclone http://hg.openjdk.java.net/jdk9/jdk9</code></pre>
+<p>In this case, the forest will be properly initialized from the start.</p>
+<h4 id="other-operations">Other Operations</h4>
+<p>The trees extensions supplement many common operations with a trees version by prefixing a <code>t</code> to the normal Mercurial command, e.g. <code>tcommit</code>, <code>tstatus</code> or <code>tmerge</code>. For instance, to update the entire forest:</p>
+<pre><code>hg tpull -u</code></pre>
+<h2 id="build-hardware-requirements">Build Hardware Requirements</h2>
+<p>OpenJDK is a massive project, and require machines ranging from decent to powerful to be able to build in a reasonable amount of time, or to be able to complete a build at all.</p>
+<p>We <em>strongly</em> recommend usage of an SSD disk for the build, since disk speed is one of the limiting factors for build performance.</p>
+<h3 id="building-on-x86">Building on x86</h3>
+<p>At a minimum, a machine with 2-4 cores is advisable, as well as 2-4 GB of RAM. (The more cores to use, the more memory you need.) At least 6 GB of free disk space is required (8 GB minimum for building on Solaris).</p>
+<p>Even for 32-bit builds, it is recommended to use a 64-bit build machine, and instead create a 32-bit target using <code>--with-target-bits=32</code>.</p>
+<h3 id="building-on-sparc">Building on sparc</h3>
+<p>At a minimum, a machine with 4 cores is advisable, as well as 4 GB of RAM. (The more cores to use, the more memory you need.) At least 8 GB of free disk space is required.</p>
+<h3 id="building-on-armaarch64">Building on arm/aarch64</h3>
+<p>This is not recommended. Instead, see the section on <a href="#cross-compiling">Cross-compiling</a>.</p>
+<h2 id="operating-system-requirements">Operating System Requirements</h2>
+<p>The mainline OpenJDK project supports Linux, Solaris, macOS, AIX and Windows. Support for other operating system, e.g. BSD, exists in separate "port" projects.</p>
+<p>In general, OpenJDK can be built on a wide range of versions of these operating systems, but the further you deviate from what is tested on a daily basis, the more likely you are to run into problems.</p>
+<p>This table lists the OS versions used by Oracle when building JDK 9. Such information is always subject to change, but this table is up to date at the time of writing.</p>
+<table>
+<thead>
+<tr class="header">
+<th style="text-align: left;">Operating system</th>
+<th style="text-align: left;">Vendor/version used</th>
+</tr>
+</thead>
+<tbody>
+<tr class="odd">
+<td style="text-align: left;">Linux</td>
+<td style="text-align: left;">Oracle Enterprise Linux 6.4 / 7.1 (using kernel 3.8.13)</td>
+</tr>
+<tr class="even">
+<td style="text-align: left;">Solaris</td>
+<td style="text-align: left;">Solaris 11.1 SRU 21.4.1 / 11.2 SRU 5.5</td>
+</tr>
+<tr class="odd">
+<td style="text-align: left;">macOS</td>
+<td style="text-align: left;">Mac OS X 10.9 (Mavericks) / 10.10 (Yosemite)</td>
+</tr>
+<tr class="even">
+<td style="text-align: left;">Windows</td>
+<td style="text-align: left;">Windows Server 2012 R2</td>
+</tr>
+</tbody>
+</table>
+<p>The double version numbers for Linux, Solaris and macOS is due to the hybrid model used at Oracle, where header files and external libraries from an older version is used when building on a more modern version of the OS.</p>
+<p>The Build Group has a wiki page with <a href="https://wiki.openjdk.java.net/display/Build/Supported+Build+Platforms">Supported Build Platforms</a>. From time to time, this is updated by the community to list successes or failures of building on different platforms.</p>
+<h3 id="windows">Windows</h3>
+<p>Windows XP is not a supported platform, but all newer Windows should be able to build OpenJDK.</p>
+<p>On Windows, it is important that you pay attention to the instructions in the <a href="#special-considerations">Special Considerations</a>.</p>
+<p>Windows is the only non-POSIX OS supported by OpenJDK, and as such, requires some extra care. A POSIX support layer is required to build on Windows. For OpenJDK 9, the only supported such layer is Cygwin. (Msys is no longer supported due to a too old bash; msys2 and the new Windows Subsystem for Linux (WSL) would likely be possible to support in a future version but that would require a community effort to implement.)</p>
+<p>Internally in the build system, all paths are represented as Unix-style paths, e.g. <code>/cygdrive/c/hg/jdk9/Makefile</code> rather than <code>C:\hg\jdk9\Makefile</code>. This rule also applies to input to the build system, e.g. in arguments to <code>configure</code>. So, use <code>--with-freetype=/cygdrive/c/freetype</code> rather than <code>--with-freetype=c:\freetype</code>. For details on this conversion, see the section on <a href="#fixpath">Fixpath</a>.</p>
+<h4 id="cygwin">Cygwin</h4>
+<p>A functioning <a href="http://www.cygwin.com/">Cygwin</a> environment is thus required for building OpenJDK on Windows. If you have a 64-bit OS, we strongly recommend using the 64-bit version of Cygwin.</p>
+<p><strong>Note:</strong> Cygwin has a model of continuously updating all packages without any easy way to install or revert to a specific version of a package. This means that whenever you add or update a package in Cygwin, you might (inadvertently) update tools that are used by the OpenJDK build process, and that can cause unexpected build problems.</p>
+<p>OpenJDK requires GNU Make 4.0 or greater on Windows. This is usually not a problem, since Cygwin currently only distributes GNU Make at a version above 4.0.</p>
+<p>Apart from the basic Cygwin installation, the following packages must also be installed:</p>
<ul>
-<li><strong>. (root)</strong> contains common configure and makefile logic</li>
-<li><strong>hotspot</strong> contains source code and make files for building the OpenJDK Hotspot Virtual Machine</li>
-<li><strong>langtools</strong> contains source code for the OpenJDK javac and language tools</li>
-<li><strong>jdk</strong> contains source code and make files for building the OpenJDK runtime libraries and misc files</li>
-<li><strong>jaxp</strong> contains source code for the OpenJDK JAXP functionality</li>
-<li><strong>jaxws</strong> contains source code for the OpenJDK JAX-WS functionality</li>
-<li><strong>corba</strong> contains source code for the OpenJDK Corba functionality</li>
-<li><strong>nashorn</strong> contains source code for the OpenJDK JavaScript implementation</li>
-</ul>
-<h3 id="repository-source-guidelines">Repository Source Guidelines</h3>
-<p>There are some very basic guidelines:</p>
-<ul>
-<li>Use of whitespace in source files (.java, .c, .h, .cpp, and .hpp files) is restricted. No TABs, no trailing whitespace on lines, and files should not terminate in more than one blank line.</li>
-<li>Files with execute permissions should not be added to the source repositories.</li>
-<li>All generated files need to be kept isolated from the files maintained or managed by the source control system. The standard area for generated files is the top level <code>build/</code> directory.</li>
-<li>The default build process should be to build the product and nothing else, in one form, e.g. a product (optimized), debug (non-optimized, -g plus assert logic), or fastdebug (optimized, -g plus assert logic).</li>
-<li>The <code>.hgignore</code> file in each repository must exist and should include <code>^build/</code>, <code>^dist/</code> and optionally any <code>nbproject/private</code> directories. <strong>It should NEVER</strong> include anything in the <code>src/</code> or <code>test/</code> or any managed directory area of a repository.</li>
-<li>Directory names and file names should never contain blanks or non-printing characters.</li>
-<li>Generated source or binary files should NEVER be added to the repository (that includes <code>javah</code> output). There are some exceptions to this rule, in particular with some of the generated configure scripts.</li>
-<li>Files not needed for typical building or testing of the repository should not be added to the repository.</li>
+<li><code>make</code></li>
+<li><code>zip</code></li>
+<li><code>unzip</code></li>
</ul>
-<hr />
-<h2 id="building">Building</h2>
-<p>The very first step in building the OpenJDK is making sure the system itself has everything it needs to do OpenJDK builds. Once a system is setup, it generally doesn't need to be done again.</p>
-<p>Building the OpenJDK is now done with running a <code>configure</code> script which will try and find and verify you have everything you need, followed by running <code>make</code>, e.g.</p>
-<blockquote>
-<p><strong><code>bash ./configure</code></strong><br />
-<strong><code>make all</code></strong></p>
-</blockquote>
-<p>Where possible the <code>configure</code> script will attempt to located the various components in the default locations or via component specific variable settings. When the normal defaults fail or components cannot be found, additional <code>configure</code> options may be necessary to help <code>configure</code> find the necessary tools for the build, or you may need to re-visit the setup of your system due to missing software packages.</p>
-<p><strong>NOTE:</strong> The <code>configure</code> script file does not have execute permissions and will need to be explicitly run with <code>bash</code>, see the source guidelines.</p>
-<hr />
-<h3 id="system-setup">System Setup</h3>
-<p>Before even attempting to use a system to build the OpenJDK there are some very basic system setups needed. For all systems:</p>
-<ul>
-<li>Be sure the GNU make utility is version 3.81 (4.0 on windows) or newer, e.g. run "<code>make -version</code>"</li>
-</ul>
-<p><a name="bootjdk"></a> * Install a Bootstrap JDK. All OpenJDK builds require access to a previously released JDK called the <em>bootstrap JDK</em> or <em>boot JDK.</em> The general rule is that the bootstrap JDK must be an instance of the previous major release of the JDK. In addition, there may be a requirement to use a release at or beyond a particular update level.</p>
-<p><strong><em>Building JDK 9 requires JDK 8. JDK 9 developers should not use JDK 9 as the boot JDK, to ensure that JDK 9 dependencies are not introduced into the parts of the system that are built with JDK 8.</em></strong></p>
-<p>The JDK 8 binaries can be downloaded from Oracle's <a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html">JDK 8 download site</a>. For build performance reasons it is very important that this bootstrap JDK be made available on the local disk of the machine doing the build. You should add its <code>bin</code> directory to the <code>PATH</code> environment variable. If <code>configure</code> has any issues finding this JDK, you may need to use the <code>configure</code> option <code>--with-boot-jdk</code>.</p>
-<ul>
-<li>Ensure that GNU make, the Bootstrap JDK, and the compilers are all in your PATH environment variable.</li>
-</ul>
-<p>And for specific systems:</p>
-<ul>
-<li><strong>Linux</strong></li>
-</ul>
-<p>Install all the software development packages needed including <a href="#alsa">alsa</a>, <a href="#freetype">freetype</a>, <a href="#cups">cups</a>, and <a href="#xrender">xrender</a>. See <a href="#SDBE">specific system packages</a>.</p>
-<ul>
-<li><strong>Solaris</strong></li>
-</ul>
-<p>Install all the software development packages needed including <a href="#studio">Studio Compilers</a>, <a href="#freetype">freetype</a>, <a href="#cups">cups</a>, and <a href="#xrender">xrender</a>. See <a href="#SDBE">specific system packages</a>.</p>
-<ul>
-<li><p><strong>Windows</strong></p></li>
-<li>Install one of <a href="#cygwin">CYGWIN</a> or <a href="#msys">MinGW/MSYS</a></li>
-<li><p>Install <a href="#vs2013">Visual Studio 2013</a></p></li>
-<li><p><strong>Mac OS X</strong></p></li>
-</ul>
-<p>Install <a href="https://developer.apple.com/xcode/">XCode 6.3</a></p>
-<h4 id="linux">Linux</h4>
-<p>With Linux, try and favor the system packages over building your own or getting packages from other areas. Most Linux builds should be possible with the system's available packages.</p>
-<p>Note that some Linux systems have a habit of pre-populating your environment variables for you, for example <code>JAVA_HOME</code> might get pre-defined for you to refer to the JDK installed on your Linux system. You will need to unset <code>JAVA_HOME</code>. It's a good idea to run <code>env</code> and verify the environment variables you are getting from the default system settings make sense for building the OpenJDK.</p>
-<h4 id="solaris">Solaris</h4>
-<h5 id="studio-compilers">Studio Compilers</h5>
-<p>At a minimum, the <a href="http://www.oracle.com/technetwork/server-storage/solarisstudio/downloads/index.htm">Studio 12 Update 4 Compilers</a> (containing version 5.13 of the C and C++ compilers) is required, including specific patches.</p>
+<p>Often, you can install these packages using the following command line:</p>
+<pre><code><path to Cygwin setup>/setup-x86_64 -q -P make -P unzip -P zip</code></pre>
+<p>Unfortunately, Cygwin can be unreliable in certain circumstances. If you experience build tool crashes or strange issues when building on Windows, please check the Cygwin FAQ on the <a href="https://cygwin.com/faq/faq.html#faq.using.bloda">"BLODA" list</a> and the section on <a href="https://cygwin.com/faq/faq.html#faq.using.fixing-fork-failures">fork() failures</a>.</p>
+<h3 id="solaris">Solaris</h3>
+<p>See <code>make/devkit/solaris11.1-package-list.txt</code> for a list of recommended packages to install when building on Solaris. The versions specified in this list is the versions used by the daily builds at Oracle, and is likely to work properly.</p>
+<p>Older versions of Solaris shipped a broken version of <code>objcopy</code>. At least version 2.21.1 is needed, which is provided by Solaris 11 Update 1. Objcopy is needed if you want to have external debug symbols. Please make sure you are using at least version 2.21.1 of objcopy, or that you disable external debug symbols.</p>
+<h3 id="macos">macOS</h3>
+<p>Apple is using a quite aggressive scheme of pushing OS updates, and coupling these updates with required updates of Xcode. Unfortunately, this makes it difficult for a project like OpenJDK to keep pace with a continuously updated machine running macOS. See the section on <a href="#apple-xcode">Apple Xcode</a> on some strategies to deal with this.</p>
+<p>It is recommended that you use at least Mac OS X 10.9 (Mavericks). At the time of writing, OpenJDK has been successfully compiled on macOS versions up to 10.12.5 (Sierra), using XCode 8.3.2 and <code>--disable-warnings-as-errors</code>.</p>
+<p>The standard macOS environment contains the basic tooling needed to build, but for external libraries a package manager is recommended. OpenJDK uses <a href="https://brew.sh/">homebrew</a> in the examples, but feel free to use whatever manager you want (or none).</p>
+<h3 id="linux">Linux</h3>
+<p>It is often not much problem to build OpenJDK on Linux. The only general advice is to try to use the compilers, external libraries and header files as provided by your distribution.</p>
+<p>The basic tooling is provided as part of the core operating system, but you will most likely need to install developer packages.</p>
+<p>For apt-based distributions (Debian, Ubuntu, etc), try this:</p>
+<pre><code>sudo apt-get install build-essential</code></pre>
+<p>For rpm-based distributions (Fedora, Red Hat, etc), try this:</p>
+<pre><code>sudo yum groupinstall "Development Tools"</code></pre>
+<h3 id="aix">AIX</h3>
+<p>The regular builds by SAP is using AIX version 7.1, but AIX 5.3 is also supported. See the <a href="http://cr.openjdk.java.net/~simonis/ppc-aix-port">OpenJDK PowerPC Port Status Page</a> for details.</p>
+<h2 id="native-compiler-toolchain-requirements">Native Compiler (Toolchain) Requirements</h2>
+<p>Large portions of OpenJDK consists of native code, that needs to be compiled to be able to run on the target platform. In theory, toolchain and operating system should be independent factors, but in practice there's more or less a one-to-one correlation between target operating system and toolchain.</p>
+<table>
+<thead>
+<tr class="header">
+<th style="text-align: left;">Operating system</th>
+<th style="text-align: left;">Supported toolchain</th>
+</tr>
+</thead>
+<tbody>
+<tr class="odd">
+<td style="text-align: left;">Linux</td>
+<td style="text-align: left;">gcc, clang</td>
+</tr>
+<tr class="even">
+<td style="text-align: left;">macOS</td>
+<td style="text-align: left;">Apple Xcode (using clang)</td>
+</tr>
+<tr class="odd">
+<td style="text-align: left;">Solaris</td>
+<td style="text-align: left;">Oracle Solaris Studio</td>
+</tr>
+<tr class="even">
+<td style="text-align: left;">AIX</td>
+<td style="text-align: left;">IBM XL C/C++</td>
+</tr>
+<tr class="odd">
+<td style="text-align: left;">Windows</td>
+<td style="text-align: left;">Microsoft Visual Studio</td>
+</tr>
+</tbody>
+</table>
+<p>Please see the individual sections on the toolchains for version recommendations. As a reference, these versions of the toolchains are used, at the time of writing, by Oracle for the daily builds of OpenJDK. It should be possible to compile OpenJDK with both older and newer versions, but the closer you stay to this list, the more likely you are to compile successfully without issues.</p>
+<table>
+<thead>
+<tr class="header">
+<th style="text-align: left;">Operating system</th>
+<th style="text-align: left;">Toolchain version</th>
+</tr>
+</thead>
+<tbody>
+<tr class="odd">
+<td style="text-align: left;">Linux</td>
+<td style="text-align: left;">gcc 4.9.2</td>
+</tr>
+<tr class="even">
+<td style="text-align: left;">macOS</td>
+<td style="text-align: left;">Apple Xcode 6.3 (using clang 6.1.0)</td>
+</tr>
+<tr class="odd">
+<td style="text-align: left;">Solaris</td>
+<td style="text-align: left;">Oracle Solaris Studio 12.4 (with compiler version 5.13)</td>
+</tr>
+<tr class="even">
+<td style="text-align: left;">Windows</td>
+<td style="text-align: left;">Microsoft Visual Studio 2013 update 4</td>
+</tr>
+</tbody>
+</table>
+<h3 id="gcc">gcc</h3>
+<p>The minimum accepted version of gcc is 4.3. Older versions will not be accepted by <code>configure</code>.</p>
+<p>However, gcc 4.3 is quite old and OpenJDK is not regularly tested on this version, so it is recommended to use a more modern gcc.</p>
+<p>OpenJDK 9 includes patches that should allow gcc 6 to compile, but this should be considered experimental.</p>
+<p>In general, any version between these two should be usable.</p>
+<h3 id="clang">clang</h3>
+<p>The minimum accepted version of clang is 3.2. Older versions will not be accepted by <code>configure</code>.</p>
+<p>To use clang instead of gcc on Linux, use <code>--with-toolchain-type=clang</code>.</p>
+<h3 id="apple-xcode">Apple Xcode</h3>
+<p>The oldest supported version of Xcode is 5.</p>
+<p>You will need the Xcode command lines developers tools to be able to build OpenJDK. (Actually, <em>only</em> the command lines tools are needed, not the IDE.) The simplest way to install these is to run:</p>
+<pre><code>xcode-select --install</code></pre>
+<p>It is advisable to keep an older version of Xcode for building OpenJDK when updating Xcode. This <a href="http://iosdevelopertips.com/xcode/install-multiple-versions-of-xcode.html">blog page</a> has good suggestions on managing multiple Xcode versions. To use a specific version of Xcode, use <code>xcode-select -s</code> before running <code>configure</code>, or use <code>--with-toolchain-path</code> to point to the version of Xcode to use, e.g. <code>configure --with-toolchain-path=/Applications/Xcode5.app/Contents/Developer/usr/bin</code></p>
+<p>If you have recently (inadvertently) updated your OS and/or Xcode version, and OpenJDK can no longer be built, please see the section on <a href="#problems-with-the-build-environment">Problems with the Build Environment</a>, and <a href="#getting-help">Getting Help</a> to find out if there are any recent, non-merged patches available for this update.</p>
+<h3 id="oracle-solaris-studio">Oracle Solaris Studio</h3>
+<p>The minimum accepted version of the Solaris Studio compilers is 5.13 (corresponding to Solaris Studio 12.4). Older versions will not be accepted by configure.</p>
<p>The Solaris Studio installation should contain at least these packages:</p>
<table>
<thead>
@@ -198,555 +394,567 @@
</tr>
</tbody>
</table>
-<p>In particular backend 12.4-1.0.6.0 contains a critical patch for the sparc version.</p>
-<p>Place the <code>bin</code> directory in <code>PATH</code>.</p>
-<p>The Oracle Solaris Studio Express compilers at: <a href="http://www.oracle.com/technetwork/server-storage/solarisstudio/downloads/index-jsp-142582.html">Oracle Solaris Studio Express Download site</a> are also an option, although these compilers have not been extensively used yet.</p>
-<h4 id="windows">Windows</h4>
-<h5 id="windows-unix-toolkit">Windows Unix Toolkit</h5>
-<p>Building on Windows requires a Unix-like environment, notably a Unix-like shell. There are several such environments available of which <a href="http://www.cygwin.com/">Cygwin</a> and <a href="http://www.mingw.org/wiki/MSYS">MinGW/MSYS</a> are currently supported for the OpenJDK build. One of the differences of these systems from standard Windows tools is the way they handle Windows path names, particularly path names which contain spaces, backslashes as path separators and possibly drive letters. Depending on the use case and the specifics of each environment these path problems can be solved by a combination of quoting whole paths, translating backslashes to forward slashes, escaping backslashes with additional backslashes and translating the path names to their <a href="http://en.wikipedia.org/wiki/8.3_filename">"8.3" version</a>.</p>
-<h6 id="cygwin">CYGWIN</h6>
-<p>CYGWIN is an open source, Linux-like environment which tries to emulate a complete POSIX layer on Windows. It tries to be smart about path names and can usually handle all kinds of paths if they are correctly quoted or escaped although internally it maps drive letters <code><drive>:</code> to a virtual directory <code>/cygdrive/<drive></code>.</p>
-<p>You can always use the <code>cygpath</code> utility to map pathnames with spaces or the backslash character into the <code>C:/</code> style of pathname (called 'mixed'), e.g. <code>cygpath -s -m "<path>"</code>.</p>
-<p>Note that the use of CYGWIN creates a unique problem with regards to setting <a href="#path"><code>PATH</code></a>. Normally on Windows the <code>PATH</code> variable contains directories separated with the ";" character (Solaris and Linux use ":"). With CYGWIN, it uses ":", but that means that paths like "C:/path" cannot be placed in the CYGWIN version of <code>PATH</code> and instead CYGWIN uses something like <code>/cygdrive/c/path</code> which CYGWIN understands, but only CYGWIN understands.</p>
-<p>The OpenJDK build requires CYGWIN version 1.7.16 or newer. Information about CYGWIN can be obtained from the CYGWIN website at <a href="http://www.cygwin.com">www.cygwin.com</a>.</p>
-<p>By default CYGWIN doesn't install all the tools required for building the OpenJDK. Along with the default installation, you need to install the following tools.</p>
-<table>
-<thead>
-<tr class="header">
-<th style="text-align: left;">Binary Name</th>
-<th style="text-align: left;">Category</th>
-<th style="text-align: left;">Package</th>
-<th style="text-align: left;">Description</th>
-</tr>
-</thead>
-<tbody>
-<tr class="odd">
-<td style="text-align: left;">ar.exe</td>
-<td style="text-align: left;">Devel</td>
-<td style="text-align: left;">binutils</td>
-<td style="text-align: left;">The GNU assembler, linker and binary utilities</td>
-</tr>
-<tr class="even">
-<td style="text-align: left;">make.exe</td>
-<td style="text-align: left;">Devel</td>
-<td style="text-align: left;">make</td>
-<td style="text-align: left;">The GNU version of the 'make' utility built for CYGWIN</td>
-</tr>
-<tr class="odd">
-<td style="text-align: left;">m4.exe</td>
-<td style="text-align: left;">Interpreters</td>
-<td style="text-align: left;">m4</td>
-<td style="text-align: left;">GNU implementation of the traditional Unix macro processor</td>
-</tr>
-<tr class="even">
-<td style="text-align: left;">cpio.exe</td>
-<td style="text-align: left;">Utils</td>
-<td style="text-align: left;">cpio</td>
-<td style="text-align: left;">A program to manage archives of files</td>
-</tr>
-<tr class="odd">
-<td style="text-align: left;">gawk.exe</td>
-<td style="text-align: left;">Utils</td>
-<td style="text-align: left;">awk</td>
-<td style="text-align: left;">Pattern-directed scanning and processing language</td>
-</tr>
-<tr class="even">
-<td style="text-align: left;">file.exe</td>
-<td style="text-align: left;">Utils</td>
-<td style="text-align: left;">file</td>
-<td style="text-align: left;">Determines file type using 'magic' numbers</td>
-</tr>
-<tr class="odd">
-<td style="text-align: left;">zip.exe</td>
-<td style="text-align: left;">Archive</td>
-<td style="text-align: left;">zip</td>
-<td style="text-align: left;">Package and compress (archive) files</td>
-</tr>
-<tr class="even">
-<td style="text-align: left;">unzip.exe</td>
-<td style="text-align: left;">Archive</td>
-<td style="text-align: left;">unzip</td>
-<td style="text-align: left;">Extract compressed files in a ZIP archive</td>
-</tr>
-<tr class="odd">
-<td style="text-align: left;">free.exe</td>
-<td style="text-align: left;">System</td>
-<td style="text-align: left;">procps</td>
-<td style="text-align: left;">Display amount of free and used memory in the system</td>
-</tr>
-</tbody>
-</table>
-<p>Note that the CYGWIN software can conflict with other non-CYGWIN software on your Windows system. CYGWIN provides a <a href="http://cygwin.com/faq/faq.using.html">FAQ</a> for known issues and problems, of particular interest is the section on <a href="http://cygwin.com/faq/faq.using.html#faq.using.bloda">BLODA (applications that interfere with CYGWIN)</a>.</p>
-<h6 id="mingwmsys">MinGW/MSYS</h6>
-<p>MinGW ("Minimalist GNU for Windows") is a collection of free Windows specific header files and import libraries combined with GNU toolsets that allow one to produce native Windows programs that do not rely on any 3rd-party C runtime DLLs. MSYS is a supplement to MinGW which allows building applications and programs which rely on traditional UNIX tools to be present. Among others this includes tools like <code>bash</code> and <code>make</code>. See <a href="http://www.mingw.org/wiki/MSYS">MinGW/MSYS</a> for more information.</p>
-<p>Like Cygwin, MinGW/MSYS can handle different types of path formats. They are internally converted to paths with forward slashes and drive letters <code><drive>:</code> replaced by a virtual directory <code>/<drive></code>. Additionally, MSYS automatically detects binaries compiled for the MSYS environment and feeds them with the internal, Unix-style path names. If native Windows applications are called from within MSYS programs their path arguments are automatically converted back to Windows style path names with drive letters and backslashes as path separators. This may cause problems for Windows applications which use forward slashes as parameter separator (e.g. <code>cl /nologo /I</code>) because MSYS may wrongly <a href="http://mingw.org/wiki/Posix_path_conversion">replace such parameters by drive letters</a>.</p>
-<p>In addition to the tools which will be installed by default, you have to manually install the <code>msys-zip</code> and <code>msys-unzip</code> packages. This can be easily done with the MinGW command line installer:</p>
-<pre><code> mingw-get.exe install msys-zip
- mingw-get.exe install msys-unzip</code></pre>
-<h5 id="visual-studio-2013-compilers">Visual Studio 2013 Compilers</h5>
-<p>The 32-bit and 64-bit OpenJDK Windows build requires Microsoft Visual Studio C++ 2013 (VS2013) Professional Edition or Express compiler. The compiler and other tools are expected to reside in the location defined by the variable <code>VS120COMNTOOLS</code> which is set by the Microsoft Visual Studio installer.</p>
-<p>Only the C++ part of VS2013 is needed. Try to let the installation go to the default install directory. Always reboot your system after installing VS2013. The system environment variable VS120COMNTOOLS should be set in your environment.</p>
-<p>Make sure that TMP and TEMP are also set in the environment and refer to Windows paths that exist, like <code>C:\temp</code>, not <code>/tmp</code>, not <code>/cygdrive/c/temp</code>, and not <code>C:/temp</code>. <code>C:\temp</code> is just an example, it is assumed that this area is private to the user, so by default after installs you should see a unique user path in these variables.</p>
-<h4 id="mac-os-x">Mac OS X</h4>
-<p>Make sure you get the right XCode version.</p>
-<hr />
-<h3 id="configure">Configure</h3>
-<p>The basic invocation of the <code>configure</code> script looks like:</p>
-<blockquote>
-<p><strong><code>bash ./configure [options]</code></strong></p>
-</blockquote>
-<p>This will create an output directory containing the "configuration" and setup an area for the build result. This directory typically looks like:</p>
-<blockquote>
-<p><strong><code>build/linux-x64-normal-server-release</code></strong></p>
-</blockquote>
-<p><code>configure</code> will try to figure out what system you are running on and where all necessary build components are. If you have all prerequisites for building installed, it should find everything. If it fails to detect any component automatically, it will exit and inform you about the problem. When this happens, read more below in <a href="#configureoptions">the <code>configure</code> options</a>.</p>
-<p>Some examples:</p>
-<blockquote>
-<p><strong>Windows 32bit build with freetype specified:</strong><br />
-<code>bash ./configure --with-freetype=/cygdrive/c/freetype-i586 --with-target-bits=32</code></p>
-</blockquote>
-<blockquote>
-<p><strong>Debug 64bit Build:</strong><br />
-<code>bash ./configure --enable-debug --with-target-bits=64</code></p>
-</blockquote>
-<h4 id="configure-options">Configure Options</h4>
-<p>Complete details on all the OpenJDK <code>configure</code> options can be seen with:</p>
-<blockquote>
-<p><strong><code>bash ./configure --help=short</code></strong></p>
-</blockquote>
-<p>Use <code>-help</code> to see all the <code>configure</code> options available. You can generate any number of different configurations, e.g. debug, release, 32, 64, etc.</p>
-<p>Some of the more commonly used <code>configure</code> options are:</p>
-<blockquote>
-<p><strong><code>--enable-debug</code></strong><br />
-set the debug level to fastdebug (this is a shorthand for <code>--with-debug-level=fastdebug</code>)</p>
-</blockquote>
-<p><a name="alsa"></a></p>
-<blockquote>
-<p><strong><code>--with-alsa=</code></strong><em>path</em><br />
-select the location of the Advanced Linux Sound Architecture (ALSA)</p>
-</blockquote>
-<blockquote>
-<p>Version 0.9.1 or newer of the ALSA files are required for building the OpenJDK on Linux. These Linux files are usually available from an "alsa" of "libasound" development package, and it's highly recommended that you try and use the package provided by the particular version of Linux that you are using.</p>
-</blockquote>
-<blockquote>
-<p><strong><code>--with-boot-jdk=</code></strong><em>path</em><br />
-select the <a href="#bootjdk">Bootstrap JDK</a></p>
-</blockquote>
-<blockquote>
-<p><strong><code>--with-boot-jdk-jvmargs=</code></strong>"<em>args</em>"<br />
-provide the JVM options to be used to run the <a href="#bootjdk">Bootstrap JDK</a></p>
-</blockquote>
-<blockquote>
-<p><strong><code>--with-cacerts=</code></strong><em>path</em><br />
-select the path to the cacerts file.</p>
-</blockquote>
-<blockquote>
-<p>See <a href="http://en.wikipedia.org/wiki/Certificate_Authority">Certificate Authority on Wikipedia</a> for a better understanding of the Certificate Authority (CA). A certificates file named "cacerts" represents a system-wide keystore with CA certificates. In JDK and JRE binary bundles, the "cacerts" file contains root CA certificates from several public CAs (e.g., VeriSign, Thawte, and Baltimore). The source contain a cacerts file without CA root certificates. Formal JDK builders will need to secure permission from each public CA and include the certificates into their own custom cacerts file. Failure to provide a populated cacerts file will result in verification errors of a certificate chain during runtime. By default an empty cacerts file is provided and that should be fine for most JDK developers.</p>
-</blockquote>
-<p><a name="cups"></a></p>
-<blockquote>
-<p><strong><code>--with-cups=</code></strong><em>path</em><br />
-select the CUPS install location</p>
-</blockquote>
-<blockquote>
-<p>The Common UNIX Printing System (CUPS) Headers are required for building the OpenJDK on Solaris and Linux. The Solaris header files can be obtained by installing the package <strong>print/cups</strong>.</p>
-</blockquote>
-<blockquote>
-<p>The CUPS header files can always be downloaded from <a href="http://www.cups.org">www.cups.org</a>.</p>
-</blockquote>
-<blockquote>
-<p><strong><code>--with-cups-include=</code></strong><em>path</em><br />
-select the CUPS include directory location</p>
-</blockquote>
-<blockquote>
-<p><strong><code>--with-debug-level=</code></strong><em>level</em><br />
-select the debug information level of release, fastdebug, or slowdebug</p>
-</blockquote>
-<blockquote>
-<p><strong><code>--with-dev-kit=</code></strong><em>path</em><br />
-select location of the compiler install or developer install location</p>
-</blockquote>
-<p><a name="freetype"></a></p>
-<blockquote>
-<p><strong><code>--with-freetype=</code></strong><em>path</em><br />
-select the freetype files to use.</p>
-</blockquote>
-<blockquote>
-<p>Expecting the freetype libraries under <code>lib/</code> and the headers under <code>include/</code>.</p>
-</blockquote>
-<blockquote>
-<p>Version 2.3 or newer of FreeType is required. On Unix systems required files can be available as part of your distribution (while you still may need to upgrade them). Note that you need development version of package that includes both the FreeType library and header files.</p>
-</blockquote>
-<blockquote>
-<p>You can always download latest FreeType version from the <a href="http://www.freetype.org">FreeType website</a>. Building the freetype 2 libraries from scratch is also possible, however on Windows refer to the <a href="http://freetype.freedesktop.org/wiki/FreeType_DLL">Windows FreeType DLL build instructions</a>.</p>
-</blockquote>
-<blockquote>
-<p>Note that by default FreeType is built with byte code hinting support disabled due to licensing restrictions. In this case, text appearance and metrics are expected to differ from Sun's official JDK build. See the <a href="http://freetype.sourceforge.net/freetype2">SourceForge FreeType2 Home Page</a> for more information.</p>
-</blockquote>
-<blockquote>
-<p><strong><code>--with-import-hotspot=</code></strong><em>path</em><br />
-select the location to find hotspot binaries from a previous build to avoid building hotspot</p>
-</blockquote>
-<blockquote>
-<p><strong><code>--with-target-bits=</code></strong><em>arg</em><br />
-select 32 or 64 bit build</p>
-</blockquote>
-<blockquote>
-<p><strong><code>--with-jvm-variants=</code></strong><em>variants</em><br />
-select the JVM variants to build from, comma separated list that can include: server, client, kernel, zero and zeroshark</p>
-</blockquote>
-<blockquote>
-<p><strong><code>--with-memory-size=</code></strong><em>size</em><br />
-select the RAM size that GNU make will think this system has</p>
-</blockquote>
-<blockquote>
-<p><strong><code>--with-msvcr-dll=</code></strong><em>path</em><br />
-select the <code>msvcr100.dll</code> file to include in the Windows builds (C/C++ runtime library for Visual Studio).</p>
-</blockquote>
-<blockquote>
-<p>This is usually picked up automatically from the redist directories of Visual Studio 2013.</p>
-</blockquote>
-<blockquote>
-<p><strong><code>--with-num-cores=</code></strong><em>cores</em><br />
-select the number of cores to use (processor count or CPU count)</p>
-</blockquote>
-<p><a name="xrender"></a></p>
-<blockquote>
-<p><strong><code>--with-x=</code></strong><em>path</em><br />
-select the location of the X11 and xrender files.</p>
-</blockquote>
-<blockquote>
-<p>The XRender Extension Headers are required for building the OpenJDK on Solaris and Linux. The Linux header files are usually available from a "Xrender" development package, it's recommended that you try and use the package provided by the particular distribution of Linux that you are using. The Solaris XRender header files is included with the other X11 header files in the package <strong>SFWxwinc</strong> on new enough versions of Solaris and will be installed in <code>/usr/X11/include/X11/extensions/Xrender.h</code> or <code>/usr/openwin/share/include/X11/extensions/Xrender.h</code></p>
-</blockquote>
-<hr />
-<h3 id="make">Make</h3>
-<p>The basic invocation of the <code>make</code> utility looks like:</p>
-<blockquote>
-<p><strong><code>make all</code></strong></p>
-</blockquote>
-<p>This will start the build to the output directory containing the "configuration" that was created by the <code>configure</code> script. Run <code>make help</code> for more information on the available targets.</p>
-<p>There are some of the make targets that are of general interest:</p>
-<blockquote>
-<p><em>empty</em><br />
-build everything but no images</p>
-</blockquote>
-<blockquote>
-<p><strong><code>all</code></strong><br />
-build everything including images</p>
-</blockquote>
-<blockquote>
-<p><strong><code>all-conf</code></strong><br />
-build all configurations</p>
-</blockquote>
-<blockquote>
-<p><strong><code>images</code></strong><br />
-create complete j2sdk and j2re images</p>
-</blockquote>
-<blockquote>
-<p><strong><code>install</code></strong><br />
-install the generated images locally, typically in <code>/usr/local</code></p>
-</blockquote>
-<blockquote>
-<p><strong><code>clean</code></strong><br />
-remove all files generated by make, but not those generated by <code>configure</code></p>
-</blockquote>
-<blockquote>
-<p><strong><code>dist-clean</code></strong><br />
-remove all files generated by both and <code>configure</code> (basically killing the configuration)</p>
-</blockquote>
-<blockquote>
-<p><strong><code>help</code></strong><br />
-give some help on using <code>make</code>, including some interesting make targets</p>
-</blockquote>
-<hr />
-<h2 id="testing">Testing</h2>
-<p>When the build is completed, you should see the generated binaries and associated files in the <code>j2sdk-image</code> directory in the output directory. In particular, the <code>build/*/images/j2sdk-image/bin</code> directory should contain executables for the OpenJDK tools and utilities for that configuration. The testing tool <code>jtreg</code> will be needed and can be found at: <a href="http://openjdk.java.net/jtreg/">the jtreg site</a>. The provided regression tests in the repositories can be run with the command:</p>
-<blockquote>
-<p><strong><code>cd test && make PRODUCT_HOME=`pwd`/../build/*/images/j2sdk-image all</code></strong></p>
-</blockquote>
-<hr />
-<h2 id="appendix-a-hints-and-tips">Appendix A: Hints and Tips</h2>
-<h3 id="faq">FAQ</h3>
-<p><strong>Q:</strong> The <code>generated-configure.sh</code> file looks horrible! How are you going to edit it?<br />
-<strong>A:</strong> The <code>generated-configure.sh</code> file is generated (think "compiled") by the autoconf tools. The source code is in <code>configure.ac</code> and various .m4 files in common/autoconf, which are much more readable.</p>
-<p><strong>Q:</strong> Why is the <code>generated-configure.sh</code> file checked in, if it is generated?<br />
-<strong>A:</strong> If it was not generated, every user would need to have the autoconf tools installed, and re-generate the <code>configure</code> file as the first step. Our goal is to minimize the work needed to be done by the user to start building OpenJDK, and to minimize the number of external dependencies required.</p>
-<p><strong>Q:</strong> Do you require a specific version of autoconf for regenerating <code>generated-configure.sh</code>?<br />
-<strong>A:</strong> Yes, version 2.69 is required and should be easy enough to aquire on all supported operating systems. The reason for this is to avoid large spurious changes in <code>generated-configure.sh</code>.</p>
-<p><strong>Q:</strong> How do you regenerate <code>generated-configure.sh</code> after making changes to the input files?<br />
-<strong>A:</strong> Regnerating <code>generated-configure.sh</code> should always be done using the script <code>common/autoconf/autogen.sh</code> to ensure that the correct files get updated. This script should also be run after mercurial tries to merge <code>generated-configure.sh</code> as a merge of the generated file is not guaranteed to be correct.</p>
-<p><strong>Q:</strong> What are the files in <code>common/makefiles/support/*</code> for? They look like gibberish.<br />
-<strong>A:</strong> They are a somewhat ugly hack to compensate for command line length limitations on certain platforms (Windows, Solaris). Due to a combination of limitations in make and the shell, command lines containing too many files will not work properly. These helper files are part of an elaborate hack that will compress the command line in the makefile and then uncompress it safely. We're not proud of it, but it does fix the problem. If you have any better suggestions, we're all ears! :-)</p>
-<p><strong>Q:</strong> I want to see the output of the commands that make runs, like in the old build. How do I do that?<br />
-<strong>A:</strong> You specify the <code>LOG</code> variable to make. There are several log levels:</p>
+<p>Compiling with Solaris Studio can sometimes be finicky. This is the exact version used by Oracle, which worked correctly at the time of writing:</p>
+<pre><code>$ cc -V
+cc: Sun C 5.13 SunOS_i386 2014/10/20
+$ CC -V
+CC: Sun C++ 5.13 SunOS_i386 151846-10 2015/10/30</code></pre>
+<h3 id="microsoft-visual-studio">Microsoft Visual Studio</h3>
+<p>The minimum accepted version of Visual Studio is 2010. Older versions will not be accepted by <code>configure</code>. The maximum accepted version of Visual Studio is 2013.</p>
+<p>If you have multiple versions of Visual Studio installed, <code>configure</code> will by default pick the latest. You can request a specific version to be used by setting <code>--with-toolchain-version</code>, e.g. <code>--with-toolchain-version=2010</code>.</p>
+<p>If you get <code>LINK: fatal error LNK1123: failure during conversion to COFF: file invalid</code> when building using Visual Studio 2010, you have encountered <a href="http://support.microsoft.com/kb/2757355">KB2757355</a>, a bug triggered by a specific installation order. However, the solution suggested by the KB article does not always resolve the problem. See <a href="https://stackoverflow.com/questions/10888391">this stackoverflow discussion</a> for other suggestions.</p>
+<h3 id="ibm-xl-cc">IBM XL C/C++</h3>
+<p>The regular builds by SAP is using version 12.1, described as <code>IBM XL C/C++ for AIX, V12.1 (5765-J02, 5725-C72) Version: 12.01.0000.0017</code>.</p>
+<p>See the <a href="http://cr.openjdk.java.net/~simonis/ppc-aix-port">OpenJDK PowerPC Port Status Page</a> for details.</p>
+<h2 id="boot-jdk-requirements">Boot JDK Requirements</h2>
+<p>Paradoxically, building OpenJDK requires a pre-existing JDK. This is called the "boot JDK". The boot JDK does not have to be OpenJDK, though. If you are porting OpenJDK to a new platform, chances are that there already exists another JDK for that platform that is usable as boot JDK.</p>
+<p>The rule of thumb is that the boot JDK for building JDK major version <em>N</em> should be an JDK of major version <em>N-1</em>, so for building JDK 9 a JDK 8 would be suitable as boot JDK. However, OpenJDK should be able to "build itself", so an up-to-date build of the current OpenJDK source is an acceptable alternative. If you are following the <em>N-1</em> rule, make sure you got the latest update version, since JDK 8 GA might not be able to build JDK 9 on all platforms.</p>
+<p>If the Boot JDK is not automatically detected, or the wrong JDK is picked, use <code>--with-boot-jdk</code> to point to the JDK to use.</p>
+<h3 id="jdk-8-on-linux">JDK 8 on Linux</h3>
+<p>On apt-based distros (like Debian and Ubuntu), <code>sudo apt-get install openjdk-8-jdk</code> is typically enough to install OpenJDK 8. On rpm-based distros (like Fedora and Red Hat), try <code>sudo yum install java-1.8.0-openjdk-devel</code>.</p>
+<h3 id="jdk-8-on-windows">JDK 8 on Windows</h3>
+<p>No pre-compiled binaries of OpenJDK 8 are readily available for Windows at the time of writing. An alternative is to download the <a href="http://www.oracle.com/technetwork/java/javase/downloads">Oracle JDK</a>. Another is the <a href="https://adoptopenjdk.net/">Adopt OpenJDK Project</a>, which publishes experimental prebuilt binaries for Windows.</p>
+<h3 id="jdk-8-on-macos">JDK 8 on macOS</h3>
+<p>No pre-compiled binaries of OpenJDK 8 are readily available for macOS at the time of writing. An alternative is to download the <a href="http://www.oracle.com/technetwork/java/javase/downloads">Oracle JDK</a>, or to install it using <code>brew cask install java</code>. Another option is the <a href="https://adoptopenjdk.net/">Adopt OpenJDK Project</a>, which publishes experimental prebuilt binaries for macOS.</p>
+<h3 id="jdk-8-on-aix">JDK 8 on AIX</h3>
+<p>No pre-compiled binaries of OpenJDK 8 are readily available for AIX at the time of writing. A starting point for working with OpenJDK on AIX is the <a href="http://openjdk.java.net/projects/ppc-aix-port/">PowerPC/AIX Port Project</a>.</p>
+<h2 id="external-library-requirements">External Library Requirements</h2>
+<p>Different platforms require different external libraries. In general, libraries are not optional - that is, they are either required or not used.</p>
+<p>If a required library is not detected by <code>configure</code>, you need to provide the path to it. There are two forms of the <code>configure</code> arguments to point to an external library: <code>--with-<LIB>=<path></code> or <code>--with-<LIB>-include=<path to include> --with-<LIB>-lib=<path to lib></code>. The first variant is more concise, but require the include files an library files to reside in a default hierarchy under this directory. In most cases, it works fine.</p>
+<p>As a fallback, the second version allows you to point to the include directory and the lib directory separately.</p>
+<h3 id="freetype">FreeType</h3>
+<p>FreeType2 from <a href="http://www.freetype.org/">The FreeType Project</a> is required on all platforms. At least version 2.3 is required.</p>
+<ul>
+<li>To install on an apt-based Linux, try running <code>sudo apt-get install libcups2-dev</code>.</li>
+<li>To install on an rpm-based Linux, try running <code>sudo yum install cups-devel</code>.</li>
+<li>To install on Solaris, try running <code>pkg install system/library/freetype-2</code>.</li>
+<li>To install on macOS, try running <code>brew install freetype</code>.</li>
+<li>To install on Windows, see <a href="#building-freetype-on-windows">below</a>.</li>
+</ul>
+<p>Use <code>--with-freetype=<path></code> if <code>configure</code> does not properly locate your FreeType files.</p>
+<h4 id="building-freetype-on-windows">Building FreeType on Windows</h4>
+<p>On Windows, there is no readily available compiled version of FreeType. OpenJDK can help you compile FreeType from source. Download the FreeType sources and unpack them into an arbitrary directory:</p>
+<pre><code>wget http://download.savannah.gnu.org/releases/freetype/freetype-2.5.3.tar.gz
+tar -xzf freetype-2.5.3.tar.gz</code></pre>
+<p>Then run <code>configure</code> with <code>--with-freetype-src=<freetype_src></code>. This will automatically build the freetype library into <code><freetype_src>/lib64</code> for 64-bit builds or into <code><freetype_src>/lib32</code> for 32-bit builds. Afterwards you can always use <code>--with-freetype-include=<freetype_src>/include</code> and <code>--with-freetype-lib=<freetype_src>/lib[32|64]</code> for other builds.</p>
+<p>Alternatively you can unpack the sources like this to use the default directory:</p>
+<pre><code>tar --one-top-level=$HOME/freetype --strip-components=1 -xzf freetype-2.5.3.tar.gz</code></pre>
+<h3 id="cups">CUPS</h3>
+<p>CUPS, <a href="http://www.cups.org">Common UNIX Printing System</a> header files are required on all platforms, except Windows. Often these files are provided by your operating system.</p>
+<ul>
+<li>To install on an apt-based Linux, try running <code>sudo apt-get install libcups2-dev</code>.</li>
+<li>To install on an rpm-based Linux, try running <code>sudo yum install cups-devel</code>.</li>
+<li>To install on Solaris, try running <code>pkg install print/cups</code>.</li>
+</ul>
+<p>Use <code>--with-cups=<path></code> if <code>configure</code> does not properly locate your CUPS files.</p>
+<h3 id="x11">X11</h3>
+<p>Certain <a href="http://www.x.org/">X11</a> libraries and include files are required on Linux and Solaris.</p>
+<ul>
+<li>To install on an apt-based Linux, try running <code>sudo apt-get install libx11-dev libxext-dev libxrender-dev libxtst-dev libxt-dev</code>.</li>
+<li>To install on an rpm-based Linux, try running <code>sudo yum install libXtst-devel libXt-devel libXrender-devel libXi-devel</code>.</li>
+<li>To install on Solaris, try running <code>pkg install x11/header/x11-protocols x11/library/libice x11/library/libpthread-stubs x11/library/libsm x11/library/libx11 x11/library/libxau x11/library/libxcb x11/library/libxdmcp x11/library/libxevie x11/library/libxext x11/library/libxrender x11/library/libxscrnsaver x11/library/libxtst x11/library/toolkit/libxt</code>.</li>
+</ul>
+<p>Use <code>--with-x=<path></code> if <code>configure</code> does not properly locate your X11 files.</p>
+<h3 id="alsa">ALSA</h3>
+<p>ALSA, <a href="https://www.alsa-project.org/">Advanced Linux Sound Architecture</a> is required on Linux. At least version 0.9.1 of ALSA is required.</p>
+<ul>
+<li>To install on an apt-based Linux, try running <code>sudo apt-get install libasound2-dev</code>.</li>
+<li>To install on an rpm-based Linux, try running <code>sudo yum install alsa-lib-devel</code>.</li>
+</ul>
+<p>Use <code>--with-alsa=<path></code> if <code>configure</code> does not properly locate your ALSA files.</p>
+<h3 id="libffi">libffi</h3>
+<p>libffi, the <a href="http://sourceware.org/libffi">Portable Foreign Function Interface Library</a> is required when building the Zero version of Hotspot.</p>
+<ul>
+<li>To install on an apt-based Linux, try running <code>sudo apt-get install libffi-dev</code>.</li>
+<li>To install on an rpm-based Linux, try running <code>sudo yum install libffi-devel</code>.</li>
+</ul>
+<p>Use <code>--with-libffi=<path></code> if <code>configure</code> does not properly locate your libffi files.</p>
+<h3 id="libelf">libelf</h3>
+<p>libelf from the <a href="http://sourceware.org/elfutils">elfutils project</a> is required when building the AOT feature of Hotspot.</p>
+<ul>
+<li>To install on an apt-based Linux, try running <code>sudo apt-get install libelf-dev</code>.</li>
+<li>To install on an rpm-based Linux, try running <code>sudo yum install elfutils-libelf-devel</code>.</li>
+</ul>
+<p>Use <code>--with-libelf=<path></code> if <code>configure</code> does not properly locate your libelf files.</p>
+<h2 id="other-tooling-requirements">Other Tooling Requirements</h2>
+<h3 id="gnu-make">GNU Make</h3>
+<p>OpenJDK requires <a href="http://www.gnu.org/software/make">GNU Make</a>. No other flavors of make are supported.</p>
+<p>At least version 3.81 of GNU Make must be used. For distributions supporting GNU Make 4.0 or above, we strongly recommend it. GNU Make 4.0 contains useful functionality to handle parallel building (supported by <code>--with-output-sync</code>) and speed and stability improvements.</p>
+<p>Note that <code>configure</code> locates and verifies a properly functioning version of <code>make</code> and stores the path to this <code>make</code> binary in the configuration. If you start a build using <code>make</code> on the command line, you will be using the version of make found first in your <code>PATH</code>, and not necessarily the one stored in the configuration. This initial make will be used as "bootstrap make", and in a second stage, the make located by <code>configure</code> will be called. Normally, this will present no issues, but if you have a very old <code>make</code>, or a non-GNU Make <code>make</code> in your path, this might cause issues.</p>
+<p>If you want to override the default make found by <code>configure</code>, use the <code>MAKE</code> configure variable, e.g. <code>configure MAKE=/opt/gnu/make</code>.</p>
+<p>On Solaris, it is common to call the GNU version of make by using <code>gmake</code>.</p>
+<h3 id="gnu-bash">GNU Bash</h3>
+<p>OpenJDK requires <a href="http://www.gnu.org/software/bash">GNU Bash</a>. No other shells are supported.</p>
+<p>At least version 3.2 of GNU Bash must be used.</p>
+<h3 id="autoconf">Autoconf</h3>
+<p>If you want to modify the build system itself, you need to install <a href="http://www.gnu.org/software/autoconf">Autoconf</a>.</p>
+<p>However, if you only need to build OpenJDK or if you only edit the actual OpenJDK source files, there is no dependency on autoconf, since the source distribution includes a pre-generated <code>configure</code> shell script.</p>
+<p>See the section on <a href="#autoconf-details">Autoconf Details</a> for details on how OpenJDK uses autoconf. This is especially important if you plan to contribute changes to OpenJDK that modifies the build system.</p>
+<h2 id="running-configure">Running Configure</h2>
+<p>To build OpenJDK, you need a "configuration", which consists of a directory where to store the build output, coupled with information about the platform, the specific build machine, and choices that affect how OpenJDK is built.</p>
+<p>The configuration is created by the <code>configure</code> script. The basic invocation of the <code>configure</code> script looks like this:</p>
+<pre><code>bash configure [options]</code></pre>
+<p>This will create an output directory containing the configuration and setup an area for the build result. This directory typically looks like <code>build/linux-x64-normal-server-release</code>, but the actual name depends on your specific configuration. (It can also be set directly, see <a href="#using-multiple-configurations">Using Multiple Configurations</a>). This directory is referred to as <code>$BUILD</code> in this documentation.</p>
+<p><code>configure</code> will try to figure out what system you are running on and where all necessary build components are. If you have all prerequisites for building installed, it should find everything. If it fails to detect any component automatically, it will exit and inform you about the problem.</p>
+<p>Some command line examples:</p>
+<ul>
+<li><p>Create a 32-bit build for Windows with FreeType2 in <code>C:\freetype-i586</code>:</p>
+<pre><code>bash configure --with-freetype=/cygdrive/c/freetype-i586 --with-target-bits=32</code></pre></li>
+<li><p>Create a debug build with the <code>server</code> JVM and DTrace enabled:</p>
+<pre><code>bash configure --enable-debug --with-jvm-variants=server --enable-dtrace</code></pre></li>
+</ul>
+<h3 id="common-configure-arguments">Common Configure Arguments</h3>
+<p>Here follows some of the most common and important <code>configure</code> argument.</p>
+<p>To get up-to-date information on <em>all</em> available <code>configure</code> argument, please run:</p>
+<pre><code>bash configure --help</code></pre>
+<p>(Note that this help text also include general autoconf options, like <code>--dvidir</code>, that is not relevant to OpenJDK. To list only OpenJDK specific features, use <code>bash configure --help=short</code> instead.)</p>
+<h4 id="configure-arguments-for-tailoring-the-build">Configure Arguments for Tailoring the Build</h4>
+<ul>
+<li><code>--enable-debug</code> - Set the debug level to <code>fastdebug</code> (this is a shorthand for <code>--with-debug-level=fastdebug</code>)</li>
+<li><code>--with-debug-level=<level></code> - Set the debug level, which can be <code>release</code>, <code>fastdebug</code>, <code>slowdebug</code> or <code>optimized</code>. Default is <code>release</code>. <code>optimized</code> is variant of <code>release</code> with additional Hotspot debug code.</li>
+<li><code>--with-native-debug-symbols=<method></code> - Specify if and how native debug symbols should be built. Available methods are <code>none</code>, <code>internal</code>, <code>external</code>, <code>zipped</code>. Default behavior depends on platform. See <a href="#native-debug-symbols">Native Debug Symbols</a> for more details.</li>
+<li><code>--with-version-string=<string></code> - Specify the version string this build will be identified with.</li>
+<li><code>--with-version-<part>=<value></code> - A group of options, where <code><part></code> can be any of <code>pre</code>, <code>opt</code>, <code>build</code>, <code>major</code>, <code>minor</code>, <code>security</code> or <code>patch</code>. Use these options to modify just the corresponding part of the version string from the default, or the value provided by <code>--with-version-string</code>.</li>
+<li><code>--with-jvm-variants=<variant>[,<variant>...]</code> - Build the specified variant (or variants) of Hotspot. Valid variants are: <code>server</code>, <code>client</code>, <code>minimal</code>, <code>core</code>, <code>zero</code>, <code>zeroshark</code>, <code>custom</code>. Note that not all variants are possible to combine in a single build.</li>
+<li><code>--with-jvm-features=<feature>[,<feature>...]</code> - Use the specified JVM features when building Hotspot. The list of features will be enabled on top of the default list. For the <code>custom</code> JVM variant, this default list is empty. A complete list of available JVM features can be found using <code>bash configure --help</code>.</li>
+<li><code>--with-target-bits=<bits></code> - Create a target binary suitable for running on a <code><bits></code> platform. Use this to create 32-bit output on a 64-bit build platform, instead of doing a full cross-compile. (This is known as a <em>reduced</em> build.)</li>
+</ul>
+<h4 id="configure-arguments-for-native-compilation">Configure Arguments for Native Compilation</h4>
+<ul>
+<li><code>--with-devkit=<path></code> - Use this devkit for compilers, tools and resources</li>
+<li><code>--with-sysroot=<path></code> - Use this directory as sysroot</li>
+<li><code>--with-extra-path=<path>[;<path>]</code> - Prepend these directories to the default path when searching for all kinds of binaries</li>
+<li><code>--with-toolchain-path=<path>[;<path>]</code> - Prepend these directories when searching for toolchain binaries (compilers etc)</li>
+<li><code>--with-extra-cflags=<flags></code> - Append these flags when compiling JDK C files</li>
+<li><code>--with-extra-cxxflags=<flags></code> - Append these flags when compiling JDK C++ files</li>
+<li><code>--with-extra-ldflags=<flags></code> - Append these flags when linking JDK libraries</li>
+</ul>
+<h4 id="configure-arguments-for-external-dependencies">Configure Arguments for External Dependencies</h4>
+<ul>
+<li><code>--with-boot-jdk=<path></code> - Set the path to the <a href="#boot-jdk-requirements">Boot JDK</a></li>
+<li><code>--with-freetype=<path></code> - Set the path to <a href="#freetype">FreeType</a></li>
+<li><code>--with-cups=<path></code> - Set the path to <a href="#cups">CUPS</a></li>
+<li><code>--with-x=<path></code> - Set the path to <a href="#x11">X11</a></li>
+<li><code>--with-alsa=<path></code> - Set the path to <a href="#alsa">ALSA</a></li>
+<li><code>--with-libffi=<path></code> - Set the path to <a href="#libffi">libffi</a></li>
+<li><code>--with-libelf=<path></code> - Set the path to <a href="#libelf">libelf</a></li>
+<li><code>--with-jtreg=<path></code> - Set the path to JTReg. See <a href="#running-tests">Running Tests</a></li>
+</ul>
+<p>Certain third-party libraries used by OpenJDK (libjpeg, giflib, libpng, lcms and zlib) are included in the OpenJDK repository. The default behavior of the OpenJDK build is to use this version of these libraries, but they might be replaced by an external version. To do so, specify <code>system</code> as the <code><source></code> option in these arguments. (The default is <code>bundled</code>).</p>
<ul>
-<li><strong><code>warn</code></strong> -- Default and very quiet.</li>
-<li><strong><code>info</code></strong> -- Shows more progress information than warn.</li>
-<li><strong><code>debug</code></strong> -- Echos all command lines and prints all macro calls for compilation definitions.</li>
-<li><strong><code>trace</code></strong> -- Echos all $(shell) command lines as well.</li>
+<li><code>--with-libjpeg=<source></code> - Use the specified source for libjpeg</li>
+<li><code>--with-giflib=<source></code> - Use the specified source for giflib</li>
+<li><code>--with-libpng=<source></code> - Use the specified source for libpng</li>
+<li><code>--with-lcms=<source></code> - Use the specified source for lcms</li>
+<li><code>--with-zlib=<source></code> - Use the specified source for zlib</li>
+</ul>
+<p>On Linux, it is possible to select either static or dynamic linking of the C++ runtime. The default is static linking, with dynamic linking as fallback if the static library is not found.</p>
+<ul>
+<li><code>--with-stdc++lib=<method></code> - Use the specified method (<code>static</code>, <code>dynamic</code> or <code>default</code>) for linking the C++ runtime.</li>
+</ul>
+<h3 id="configure-control-variables">Configure Control Variables</h3>
+<p>It is possible to control certain aspects of <code>configure</code> by overriding the value of <code>configure</code> variables, either on the command line or in the environment.</p>
+<p>Normally, this is <strong>not recommended</strong>. If used improperly, it can lead to a broken configuration. Unless you're well versed in the build system, this is hard to use properly. Therefore, <code>configure</code> will print a warning if this is detected.</p>
+<p>However, there are a few <code>configure</code> variables, known as <em>control variables</em> that are supposed to be overriden on the command line. These are variables that describe the location of tools needed by the build, like <code>MAKE</code> or <code>GREP</code>. If any such variable is specified, <code>configure</code> will use that value instead of trying to autodetect the tool. For instance, <code>bash configure MAKE=/opt/gnumake4.0/bin/make</code>.</p>
+<p>If a configure argument exists, use that instead, e.g. use <code>--with-jtreg</code> instead of setting <code>JTREGEXE</code>.</p>
+<p>Also note that, despite what autoconf claims, setting <code>CFLAGS</code> will not accomplish anything. Instead use <code>--with-extra-cflags</code> (and similar for <code>cxxflags</code> and <code>ldflags</code>).</p>
+<h2 id="running-make">Running Make</h2>
+<p>When you have a proper configuration, all you need to do to build OpenJDK is to run <code>make</code>. (But see the warning at <a href="#gnu-make">GNU Make</a> about running the correct version of make.)</p>
+<p>When running <code>make</code> without any arguments, the default target is used, which is the same as running <code>make default</code> or <code>make jdk</code>. This will build a minimal (or roughly minimal) set of compiled output (known as an "exploded image") needed for a developer to actually execute the newly built JDK. The idea is that in an incremental development fashion, when doing a normal make, you should only spend time recompiling what's changed (making it purely incremental) and only do the work that's needed to actually run and test your code.</p>
+<p>The output of the exploded image resides in <code>$BUILD/jdk</code>. You can test the newly built JDK like this: <code>$BUILD/jdk/bin/java -version</code>.</p>
+<h3 id="common-make-targets">Common Make Targets</h3>
+<p>Apart from the default target, here are some common make targets:</p>
+<ul>
+<li><code>hotspot</code> - Build all of hotspot (but only hotspot)</li>
+<li><code>hotspot-<variant></code> - Build just the specified jvm variant</li>
+<li><code>images</code> or <code>product-images</code> - Build the JRE and JDK images</li>
+<li><code>docs</code> or <code>docs-image</code> - Build the documentation image</li>
+<li><code>test-image</code> - Build the test image</li>
+<li><code>all</code> or <code>all-images</code> - Build all images (product, docs and test)</li>
+<li><code>bootcycle-images</code> - Build images twice, second time with newly built JDK (good for testing)</li>
+<li><code>clean</code> - Remove all files generated by make, but not those generated by configure</li>
+<li><code>dist-clean</code> - Remove all files, including configuration</li>
+</ul>
+<p>Run <code>make help</code> to get an up-to-date list of important make targets and make control variables.</p>
+<p>It is possible to build just a single module, a single phase, or a single phase of a single module, by creating make targets according to these followin patterns. A phase can be either of <code>gensrc</code>, <code>gendata</code>, <code>copy</code>, <code>java</code>, <code>launchers</code>, <code>libs</code> or <code>rmic</code>. See <a href="#using-fine-grained-make-targets">Using Fine-Grained Make Targets</a> for more details about this functionality.</p>
+<ul>
+<li><code><phase></code> - Build the specified phase and everything it depends on</li>
+<li><code><module></code> - Build the specified module and everything it depends on</li>
+<li><code><module>-<phase></code> - Compile the specified phase for the specified module and everything it depends on</li>
+</ul>
+<p>Similarly, it is possible to clean just a part of the build by creating make targets according to these patterns:</p>
+<ul>
+<li><code>clean-<outputdir></code> - Remove the subdir in the output dir with the name</li>
+<li><code>clean-<phase></code> - Remove all build results related to a certain build phase</li>
+<li><code>clean-<module></code> - Remove all build results related to a certain module</li>
+<li><code>clean-<module>-<phase></code> - Remove all build results related to a certain module and phase</li>
+</ul>
+<h3 id="make-control-variables">Make Control Variables</h3>
+<p>It is possible to control <code>make</code> behavior by overriding the value of <code>make</code> variables, either on the command line or in the environment.</p>
+<p>Normally, this is <strong>not recommended</strong>. If used improperly, it can lead to a broken build. Unless you're well versed in the build system, this is hard to use properly. Therefore, <code>make</code> will print a warning if this is detected.</p>
+<p>However, there are a few <code>make</code> variables, known as <em>control variables</em> that are supposed to be overriden on the command line. These make up the "make time" configuration, as opposed to the "configure time" configuration.</p>
+<h4 id="general-make-control-variables">General Make Control Variables</h4>
+<ul>
+<li><code>JOBS</code> - Specify the number of jobs to build with. See <a href="#build-performance">Build Performance</a>.</li>
+<li><code>LOG</code> - Specify the logging level and functionality. See <a href="#checking-the-build-log-file">Checking the Build Log File</a></li>
+<li><code>CONF</code> and <code>CONF_NAME</code> - Selecting the configuration(s) to use. See <a href="#using-multiple-configurations">Using Multiple Configurations</a></li>
+</ul>
+<h4 id="test-make-control-variables">Test Make Control Variables</h4>
+<p>These make control variables only make sense when running tests. Please see <a href="testing.html">Testing OpenJDK</a> for details.</p>
+<ul>
+<li><code>TEST</code></li>
+<li><code>TEST_JOBS</code></li>
+<li><code>JTREG</code></li>
+<li><code>GTEST</code></li>
+</ul>
+<h4 id="advanced-make-control-variables">Advanced Make Control Variables</h4>
+<p>These advanced make control variables can be potentially unsafe. See <a href="#hints-and-suggestions-for-advanced-users">Hints and Suggestions for Advanced Users</a> and <a href="#understanding-the-build-system">Understanding the Build System</a> for details.</p>
+<ul>
+<li><code>SPEC</code></li>
+<li><code>CONF_CHECK</code></li>
+<li><code>COMPARE_BUILD</code></li>
+<li><code>JDK_FILTER</code></li>
</ul>
-<p><strong>Q:</strong> When do I have to re-run <code>configure</code>?<br />
-<strong>A:</strong> Normally you will run <code>configure</code> only once for creating a configuration. You need to re-run configuration only if you want to change any configuration options, or if you pull down changes to the <code>configure</code> script.</p>
-<p><strong>Q:</strong> I have added a new source file. Do I need to modify the makefiles?<br />
-<strong>A:</strong> Normally, no. If you want to create e.g. a new native library, you will need to modify the makefiles. But for normal file additions or removals, no changes are needed. There are certan exceptions for some native libraries where the source files are spread over many directories which also contain sources for other libraries. In these cases it was simply easier to create include lists rather than excludes.</p>
-<p><strong>Q:</strong> When I run <code>configure --help</code>, I see many strange options, like <code>--dvidir</code>. What is this?<br />
-<strong>A:</strong> Configure provides a slew of options by default, to all projects that use autoconf. Most of them are not used in OpenJDK, so you can safely ignore them. To list only OpenJDK specific features, use <code>configure --help=short</code> instead.</p>
-<p><strong>Q:</strong> <code>configure</code> provides OpenJDK-specific features such as <code>--with-builddeps-server</code> that are not described in this document. What about those?<br />
-<strong>A:</strong> Try them out if you like! But be aware that most of these are experimental features. Many of them don't do anything at all at the moment; the option is just a placeholder. Others depend on pieces of code or infrastructure that is currently not ready for prime time.</p>
-<p><strong>Q:</strong> How will you make sure you don't break anything?<br />
-<strong>A:</strong> We have a script that compares the result of the new build system with the result of the old. For most part, we aim for (and achieve) byte-by-byte identical output. There are however technical issues with e.g. native binaries, which might differ in a byte-by-byte comparison, even when building twice with the old build system. For these, we compare relevant aspects (e.g. the symbol table and file size). Note that we still don't have 100% equivalence, but we're close.</p>
-<p><strong>Q:</strong> I noticed this thing X in the build that looks very broken by design. Why don't you fix it?<br />
-<strong>A:</strong> Our goal is to produce a build output that is as close as technically possible to the old build output. If things were weird in the old build, they will be weird in the new build. Often, things were weird before due to obscurity, but in the new build system the weird stuff comes up to the surface. The plan is to attack these things at a later stage, after the new build system is established.</p>
-<p><strong>Q:</strong> The code in the new build system is not that well-structured. Will you fix this?<br />
-<strong>A:</strong> Yes! The new build system has grown bit by bit as we converted the old system. When all of the old build system is converted, we can take a step back and clean up the structure of the new build system. Some of this we plan to do before replacing the old build system and some will need to wait until after.</p>
-<p><strong>Q:</strong> Is anything able to use the results of the new build's default make target?<br />
-<strong>A:</strong> Yes, this is the minimal (or roughly minimal) set of compiled output needed for a developer to actually execute the newly built JDK. The idea is that in an incremental development fashion, when doing a normal make, you should only spend time recompiling what's changed (making it purely incremental) and only do the work that's needed to actually run and test your code. The packaging stuff that is part of the <code>images</code> target is not needed for a normal developer who wants to test his new code. Even if it's quite fast, it's still unnecessary. We're targeting sub-second incremental rebuilds! ;-) (Or, well, at least single-digit seconds...)</p>
-<p><strong>Q:</strong> I usually set a specific environment variable when building, but I can't find the equivalent in the new build. What should I do?<br />
-<strong>A:</strong> It might very well be that we have neglected to add support for an option that was actually used from outside the build system. Email us and we will add support for it!</p>
-<h3 id="build-performance-tips">Build Performance Tips</h3>
+<h2 id="running-tests">Running Tests</h2>
+<p>Most of the OpenJDK tests are using the <a href="http://openjdk.java.net/jtreg">JTReg</a> test framework. Make sure that your configuration knows where to find your installation of JTReg. If this is not picked up automatically, use the <code>--with-jtreg=<path to jtreg home></code> option to point to the JTReg framework. Note that this option should point to the JTReg home, i.e. the top directory, containing <code>lib/jtreg.jar</code> etc.</p>
+<p>To execute the most basic tests (tier 1), use:</p>
+<pre><code>make run-test-tier1</code></pre>
+<p>For more details on how to run tests, please see the <a href="testing.html">Testing OpenJDK</a> document.</p>
+<h2 id="cross-compiling">Cross-compiling</h2>
+<p>Cross-compiling means using one platform (the <em>build</em> platform) to generate output that can ran on another platform (the <em>target</em> platform).</p>
+<p>The typical reason for cross-compiling is that the build is performed on a more powerful desktop computer, but the resulting binaries will be able to run on a different, typically low-performing system. Most of the complications that arise when building for embedded is due to this separation of <em>build</em> and <em>target</em> systems.</p>
+<p>This requires a more complex setup and build procedure. This section assumes you are familiar with cross-compiling in general, and will only deal with the particularities of cross-compiling OpenJDK. If you are new to cross-compiling, please see the <a href="https://en.wikipedia.org/wiki/Cross_compiler#External_links">external links at Wikipedia</a> for a good start on reading materials.</p>
+<p>Cross-compiling OpenJDK requires you to be able to build both for the build platform and for the target platform. The reason for the former is that we need to build and execute tools during the build process, both native tools and Java tools.</p>
+<p>If all you want to do is to compile a 32-bit version, for the same OS, on a 64-bit machine, consider using <code>--with-target-bits=32</code> instead of doing a full-blown cross-compilation. (While this surely is possible, it's a lot more work and will take much longer to build.)</p>
+<h3 id="boot-jdk-and-build-jdk">Boot JDK and Build JDK</h3>
+<p>When cross-compiling, make sure you use a boot JDK that runs on the <em>build</em> system, and not on the <em>target</em> system.</p>
+<p>To be able to build, we need a "Build JDK", which is a JDK built from the current sources (that is, the same as the end result of the entire build process), but able to run on the <em>build</em> system, and not the <em>target</em> system. (In contrast, the Boot JDK should be from an older release, e.g. JDK 8 when building JDK 9.)</p>
+<p>The build process will create a minimal Build JDK for you, as part of building. To speed up the build, you can use <code>--with-build-jdk</code> to <code>configure</code> to point to a pre-built Build JDK. Please note that the build result is unpredictable, and can possibly break in subtle ways, if the Build JDK does not <strong>exactly</strong> match the current sources.</p>
+<h3 id="specifying-the-target-platform">Specifying the Target Platform</h3>
+<p>You <em>must</em> specify the target platform when cross-compiling. Doing so will also automatically turn the build into a cross-compiling mode. The simplest way to do this is to use the <code>--openjdk-target</code> argument, e.g. <code>--openjdk-target=arm-linux-gnueabihf</code>. or <code>--openjdk-target=aarch64-oe-linux</code>. This will automatically set the <code>--build</code>, <code>--host</code> and <code>--target</code> options for autoconf, which can otherwise be confusing. (In autoconf terminology, the "target" is known as "host", and "target" is used for building a Canadian cross-compiler.)</p>
+<h3 id="toolchain-considerations">Toolchain Considerations</h3>
+<p>You will need two copies of your toolchain, one which generates output that can run on the target system (the normal, or <em>target</em>, toolchain), and one that generates output that can run on the build system (the <em>build</em> toolchain). Note that cross-compiling is only supported for gcc at the time being. The gcc standard is to prefix cross-compiling toolchains with the target denominator. If you follow this standard, <code>configure</code> is likely to pick up the toolchain correctly.</p>
+<p>The <em>build</em> toolchain will be autodetected just the same way the normal <em>build</em>/<em>target</em> toolchain will be autodetected when not cross-compiling. If this is not what you want, or if the autodetection fails, you can specify a devkit containing the <em>build</em> toolchain using <code>--with-build-devkit</code> to <code>configure</code>, or by giving <code>BUILD_CC</code> and <code>BUILD_CXX</code> arguments.</p>
+<p>It is often helpful to locate the cross-compilation tools, headers and libraries in a separate directory, outside the normal path, and point out that directory to <code>configure</code>. Do this by setting the sysroot (<code>--with-sysroot</code>) and appending the directory when searching for cross-compilations tools (<code>--with-toolchain-path</code>). As a compact form, you can also use <code>--with-devkit</code> to point to a single directory, if it is correctly setup. (See <code>basics.m4</code> for details.)</p>
+<p>If you are unsure what toolchain and versions to use, these have been proved working at the time of writing:</p>
+<ul>
+<li><a href="https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-linux-gnu-4.8-2013.11_linux.tar.xz">aarch64</a></li>
+<li><a href="https://launchpad.net/linaro-toolchain-unsupported/trunk/2012.09/+download/gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux.tar.bz2">arm 32-bit hardware floating point</a></li>
+</ul>
+<h3 id="native-libraries">Native Libraries</h3>
+<p>You will need copies of external native libraries for the <em>target</em> system, present on the <em>build</em> machine while building.</p>
+<p>Take care not to replace the <em>build</em> system's version of these libraries by mistake, since that can render the <em>build</em> machine unusable.</p>
+<p>Make sure that the libraries you point to (ALSA, X11, etc) are for the <em>target</em>, not the <em>build</em>, platform.</p>
+<h4 id="alsa-1">ALSA</h4>
+<p>You will need alsa libraries suitable for your <em>target</em> system. For most cases, using Debian's pre-built libraries work fine.</p>
+<p>Note that alsa is needed even if you only want to build a headless JDK.</p>
+<ul>
+<li><p>Go to <a href="https://www.debian.org/distrib/packages">Debian Package Search</a> and search for the <code>libasound2</code> and <code>libasound2-dev</code> packages for your <em>target</em> system. Download them to /tmp.</p></li>
+<li><p>Install the libraries into the cross-compilation toolchain. For instance:</p>
+<pre><code>cd /tools/gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux/arm-linux-gnueabihf/libc
+dpkg-deb -x /tmp/libasound2_1.0.25-4_armhf.deb .
+dpkg-deb -x /tmp/libasound2-dev_1.0.25-4_armhf.deb .</code></pre></li>
+<li><p>If alsa is not properly detected by <code>configure</code>, you can point it out by <code>--with-alsa</code>.</p></li>
+</ul>
+<h4 id="x11-1">X11</h4>
+<p>You will need X11 libraries suitable for your <em>target</em> system. For most cases, using Debian's pre-built libraries work fine.</p>
+<p>Note that X11 is needed even if you only want to build a headless JDK.</p>
+<ul>
+<li>Go to <a href="https://www.debian.org/distrib/packages">Debian Package Search</a>, search for the following packages for your <em>target</em> system, and download them to /tmp/target-x11:
+<ul>
+<li>libxi</li>
+<li>libxi-dev</li>
+<li>x11proto-core-dev</li>
+<li>x11proto-input-dev</li>
+<li>x11proto-kb-dev</li>
+<li>x11proto-render-dev</li>
+<li>x11proto-xext-dev</li>
+<li>libice-dev</li>
+<li>libxrender</li>
+<li>libxrender-dev</li>
+<li>libsm-dev</li>
+<li>libxt-dev</li>
+<li>libx11</li>
+<li>libx11-dev</li>
+<li>libxtst</li>
+<li>libxtst-dev</li>
+<li>libxext</li>
+<li>libxext-dev</li>
+</ul></li>
+<li><p>Install the libraries into the cross-compilation toolchain. For instance:</p>
+<pre><code>cd /tools/gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux/arm-linux-gnueabihf/libc/usr
+mkdir X11R6
+cd X11R6
+for deb in /tmp/target-x11/*.deb ; do dpkg-deb -x $deb . ; done
+mv usr/* .
+cd lib
+cp arm-linux-gnueabihf/* .</code></pre>
+<p>You can ignore the following messages. These libraries are not needed to successfully complete a full JDK build.</p>
+<pre><code>cp: cannot stat `arm-linux-gnueabihf/libICE.so': No such file or directory
+cp: cannot stat `arm-linux-gnueabihf/libSM.so': No such file or directory
+cp: cannot stat `arm-linux-gnueabihf/libXt.so': No such file or directory</code></pre></li>
+<li><p>If the X11 libraries are not properly detected by <code>configure</code>, you can point them out by <code>--with-x</code>.</p></li>
+</ul>
+<h3 id="building-for-armaarch64">Building for ARM/aarch64</h3>
+<p>A common cross-compilation target is the ARM CPU. When building for ARM, it is useful to set the ABI profile. A number of pre-defined ABI profiles are available using <code>--with-abi-profile</code>: arm-vfp-sflt, arm-vfp-hflt, arm-sflt, armv5-vfp-sflt, armv6-vfp-hflt. Note that soft-float ABIs are no longer properly supported on OpenJDK.</p>
+<p>OpenJDK contains two different ports for the aarch64 platform, one is the original aarch64 port from the <a href="http://openjdk.java.net/projects/aarch64-port">AArch64 Port Project</a> and one is a 64-bit version of the Oracle contributed ARM port. When targeting aarch64, by the default the original aarch64 port is used. To select the Oracle ARM 64 port, use <code>--with-cpu-port=arm64</code>. Also set the corresponding value (<code>aarch64</code> or <code>arm64</code>) to --with-abi-profile, to ensure a consistent build.</p>
+<h3 id="verifying-the-build">Verifying the Build</h3>
+<p>The build will end up in a directory named like <code>build/linux-arm-normal-server-release</code>.</p>
+<p>Inside this build output directory, the <code>images/jdk</code> and <code>images/jre</code> will contain the newly built JDK and JRE, respectively, for your <em>target</em> system.</p>
+<p>Copy these folders to your <em>target</em> system. Then you can run e.g. <code>images/jdk/bin/java -version</code>.</p>
+<h2 id="build-performance">Build Performance</h2>
<p>Building OpenJDK requires a lot of horsepower. Some of the build tools can be adjusted to utilize more or less of resources such as parallel threads and memory. The <code>configure</code> script analyzes your system and selects reasonable values for such options based on your hardware. If you encounter resource problems, such as out of memory conditions, you can modify the detected values with:</p>
<ul>
-<li><strong><code>--with-num-cores</code></strong> -- number of cores in the build system, e.g. <code>--with-num-cores=8</code></li>
-<li><strong><code>--with-memory-size</code></strong> -- memory (in MB) available in the build system, e.g. <code>--with-memory-size=1024</code></li>
-</ul>
-<p>It might also be necessary to specify the JVM arguments passed to the Bootstrap JDK, using e.g. <code>--with-boot-jdk-jvmargs="-Xmx8G -enableassertions"</code>. Doing this will override the default JVM arguments passed to the Bootstrap JDK.</p>
-<p>One of the top goals of the new build system is to improve the build performance and decrease the time needed to build. This will soon also apply to the java compilation when the Smart Javac wrapper is fully supported.</p>
-<p>At the end of a successful execution of <code>configure</code>, you will get a performance summary, indicating how well the build will perform. Here you will also get performance hints. If you want to build fast, pay attention to those!</p>
-<h4 id="building-with-ccache">Building with ccache</h4>
-<p>The OpenJDK build supports building with ccache when using gcc or clang. Using ccache can radically speed up compilation of native code if you often rebuild the same sources. Your milage may vary however so we recommend evaluating it for yourself. To enable it, make sure it's on the path and configure with <code>--enable-ccache</code>.</p>
-<h4 id="building-on-local-disk">Building on local disk</h4>
-<p>If you are using network shares, e.g. via NFS, for your source code, make sure the build directory is situated on local disk. The performance penalty is extremely high for building on a network share, close to unusable.</p>
-<h4 id="building-only-one-jvm">Building only one JVM</h4>
-<p>The old build builds multiple JVMs on 32-bit systems (client and server; and on Windows kernel as well). In the new build we have changed this default to only build server when it's available. This improves build times for those not interested in multiple JVMs. To mimic the old behavior on platforms that support it, use <code>--with-jvm-variants=client,server</code>.</p>
-<h4 id="selecting-the-number-of-cores-to-build-on">Selecting the number of cores to build on</h4>
-<p>By default, <code>configure</code> will analyze your machine and run the make process in parallel with as many threads as you have cores. This behavior can be overridden, either "permanently" (on a <code>configure</code> basis) using <code>--with-num-cores=N</code> or for a single build only (on a make basis), using <code>make JOBS=N</code>.</p>
-<p>If you want to make a slower build just this time, to save some CPU power for other processes, you can run e.g. <code>make JOBS=2</code>. This will force the makefiles to only run 2 parallel processes, or even <code>make JOBS=1</code> which will disable parallelism.</p>
-<p>If you want to have it the other way round, namely having slow builds default and override with fast if you're impatient, you should call <code>configure</code> with <code>--with-num-cores=2</code>, making 2 the default. If you want to run with more cores, run <code>make JOBS=8</code></p>
-<h3 id="troubleshooting">Troubleshooting</h3>
-<h4 id="solving-build-problems">Solving build problems</h4>
-<p>If the build fails (and it's not due to a compilation error in a source file you've changed), the first thing you should do is to re-run the build with more verbosity. Do this by adding <code>LOG=debug</code> to your make command line.</p>
-<p>The build log (with both stdout and stderr intermingled, basically the same as you see on your console) can be found as <code>build.log</code> in your build directory.</p>
-<p>You can ask for help on build problems with the new build system on either the <a href="http://mail.openjdk.java.net/mailman/listinfo/build-dev">build-dev</a> or the <a href="http://mail.openjdk.java.net/mailman/listinfo/build-infra-dev">build-infra-dev</a> mailing lists. Please include the relevant parts of the build log.</p>
-<p>A build can fail for any number of reasons. Most failures are a result of trying to build in an environment in which all the pre-build requirements have not been met. The first step in troubleshooting a build failure is to recheck that you have satisfied all the pre-build requirements for your platform. Scanning the <code>configure</code> log is a good first step, making sure that what it found makes sense for your system. Look for strange error messages or any difficulties that <code>configure</code> had in finding things.</p>
-<p>Some of the more common problems with builds are briefly described below, with suggestions for remedies.</p>
-<ul>
-<li><p><strong>Corrupted Bundles on Windows:</strong><br />
-Some virus scanning software has been known to corrupt the downloading of zip bundles. It may be necessary to disable the 'on access' or 'real time' virus scanning features to prevent this corruption. This type of 'real time' virus scanning can also slow down the build process significantly. Temporarily disabling the feature, or excluding the build output directory may be necessary to get correct and faster builds.</p></li>
-<li><p><strong>Slow Builds:</strong><br />
-If your build machine seems to be overloaded from too many simultaneous C++ compiles, try setting the <code>JOBS=1</code> on the <code>make</code> command line. Then try increasing the count slowly to an acceptable level for your system. Also:</p></li>
-</ul>
-<p>Creating the javadocs can be very slow, if you are running javadoc, consider skipping that step.</p>
-<p>Faster CPUs, more RAM, and a faster DISK usually helps. The VM build tends to be CPU intensive (many C++ compiles), and the rest of the JDK will often be disk intensive.</p>
-<p>Faster compiles are possible using a tool called <a href="http://ccache.samba.org/">ccache</a>.</p>
-<ul>
-<li><strong>File time issues:</strong><br />
-If you see warnings that refer to file time stamps, e.g.</li>
-</ul>
-<blockquote>
-<p><em>Warning message:</em> <code>File 'xxx' has modification time in the future.</code><br />
-<em>Warning message:</em> <code>Clock skew detected. Your build may be incomplete.</code></p>
-</blockquote>
-<p>These warnings can occur when the clock on the build machine is out of sync with the timestamps on the source files. Other errors, apparently unrelated but in fact caused by the clock skew, can occur along with the clock skew warnings. These secondary errors may tend to obscure the fact that the true root cause of the problem is an out-of-sync clock.</p>
-<p>If you see these warnings, reset the clock on the build machine, run "<code>gmake clobber</code>" or delete the directory containing the build output, and restart the build from the beginning.</p>
-<ul>
-<li><strong>Error message: <code>Trouble writing out table to disk</code></strong><br />
-Increase the amount of swap space on your build machine. This could be caused by overloading the system and it may be necessary to use:</li>
-</ul>
-<blockquote>
-<p><code>make JOBS=1</code></p>
-</blockquote>
-<p>to reduce the load on the system.</p>
-<ul>
-<li><p><strong>Error Message: <code>libstdc++ not found</code>:</strong><br />
-This is caused by a missing libstdc++.a library. This is installed as part of a specific package (e.g. libstdc++.so.devel.386). By default some 64-bit Linux versions (e.g. Fedora) only install the 64-bit version of the libstdc++ package. Various parts of the JDK build require a static link of the C++ runtime libraries to allow for maximum portability of the built images.</p></li>
-<li><p><strong>Linux Error Message: <code>cannot restore segment prot after reloc</code></strong><br />
-This is probably an issue with SELinux (See <a href="http://en.wikipedia.org/wiki/SELinux">SELinux on Wikipedia</a>). Parts of the VM is built without the <code>-fPIC</code> for performance reasons.</p></li>
-</ul>
-<p>To completely disable SELinux:</p>
-<ol type="1">
-<li><code>$ su root</code></li>
-<li><code># system-config-securitylevel</code></li>
-<li><code>In the window that appears, select the SELinux tab</code></li>
-<li><code>Disable SELinux</code></li>
-</ol>
-<p>Alternatively, instead of completely disabling it you could disable just this one check.</p>
-<ol type="1">
-<li>Select System->Administration->SELinux Management</li>
-<li>In the SELinux Management Tool which appears, select "Boolean" from the menu on the left</li>
-<li>Expand the "Memory Protection" group</li>
-<li>Check the first item, labeled "Allow all unconfined executables to use libraries requiring text relocation ..."</li>
-</ol>
-<ul>
-<li><strong>Windows Error Messages:</strong><br />
-<code>*** fatal error - couldn't allocate heap, ...</code><br />
-<code>rm fails with "Directory not empty"</code><br />
-<code>unzip fails with "cannot create ... Permission denied"</code><br />
-<code>unzip fails with "cannot create ... Error 50"</code></li>
-</ul>
-<p>The CYGWIN software can conflict with other non-CYGWIN software. See the CYGWIN FAQ section on <a href="http://cygwin.com/faq/faq.using.html#faq.using.bloda">BLODA (applications that interfere with CYGWIN)</a>.</p>
-<ul>
-<li><strong>Windows Error Message: <code>spawn failed</code></strong><br />
-Try rebooting the system, or there could be some kind of issue with the disk or disk partition being used. Sometimes it comes with a "Permission Denied" message.</li>
-</ul>
-<hr />
-<h2 id="appendix-b-gnu-make">Appendix B: GNU make</h2>
-<p>The Makefiles in the OpenJDK are only valid when used with the GNU version of the utility command <code>make</code> (usually called <code>gmake</code> on Solaris). A few notes about using GNU make:</p>
-<ul>
-<li>You need GNU make version 3.81 or newer. On Windows 4.0 or newer is recommended. If the GNU make utility on your systems is not of a suitable version, see "<a href="#buildgmake">Building GNU make</a>".</li>
-<li>Place the location of the GNU make binary in the <code>PATH</code>.</li>
-<li><strong>Solaris:</strong> Do NOT use <code>/usr/bin/make</code> on Solaris. If your Solaris system has the software from the Solaris Developer Companion CD installed, you should try and use <code>/usr/bin/gmake</code> or <code>/usr/gnu/bin/make</code>.</li>
-<li><strong>Windows:</strong> Make sure you start your build inside a bash shell.</li>
-<li><strong>Mac OS X:</strong> The XCode "command line tools" must be installed on your Mac.</li>
+<li><p><code>--with-num-cores</code> -- number of cores in the build system, e.g. <code>--with-num-cores=8</code>.</p></li>
+<li><p><code>--with-memory-size</code> -- memory (in MB) available in the build system, e.g. <code>--with-memory-size=1024</code></p></li>
</ul>
-<p>Information on GNU make, and access to ftp download sites, are available on the <a href="http://www.gnu.org/software/make/make.html">GNU make web site</a>. The latest source to GNU make is available at <a href="http://ftp.gnu.org/pub/gnu/make/">ftp.gnu.org/pub/gnu/make/</a>.</p>
-<h3 id="building-gnu-make">Building GNU make</h3>
-<p>First step is to get the GNU make 3.81 or newer source from <a href="http://ftp.gnu.org/pub/gnu/make/">ftp.gnu.org/pub/gnu/make/</a>. Building is a little different depending on the OS but is basically done with:</p>
-<pre><code> bash ./configure
- make</code></pre>
-<hr />
-<h2 id="appendix-c-build-environments">Appendix C: Build Environments</h2>
-<h3 id="minimum-build-environments">Minimum Build Environments</h3>
-<p>This file often describes specific requirements for what we call the "minimum build environments" (MBE) for this specific release of the JDK. What is listed below is what the Oracle Release Engineering Team will use to build the Oracle JDK product. Building with the MBE will hopefully generate the most compatible bits that install on, and run correctly on, the most variations of the same base OS and hardware architecture. In some cases, these represent what is often called the least common denominator, but each Operating System has different aspects to it.</p>
-<p>In all cases, the Bootstrap JDK version minimum is critical, we cannot guarantee builds will work with older Bootstrap JDK's. Also in all cases, more RAM and more processors is better, the minimums listed below are simply recommendations.</p>
-<p>With Solaris and Mac OS X, the version listed below is the oldest release we can guarantee builds and works, and the specific version of the compilers used could be critical.</p>
-<p>With Windows the critical aspect is the Visual Studio compiler used, which due to it's runtime, generally dictates what Windows systems can do the builds and where the resulting bits can be used.</p>
-<p><strong>NOTE: We expect a change here off these older Windows OS releases and to a 'less older' one, probably Windows 2008R2 X64.</strong></p>
-<p>With Linux, it was just a matter of picking a stable distribution that is a good representative for Linux in general.</p>
-<p>It is understood that most developers will NOT be using these specific versions, and in fact creating these specific versions may be difficult due to the age of some of this software. It is expected that developers are more often using the more recent releases and distributions of these operating systems.</p>
-<p>Compilation problems with newer or different C/C++ compilers is a common problem. Similarly, compilation problems related to changes to the <code>/usr/include</code> or system header files is also a common problem with older, newer, or unreleased OS versions. Please report these types of problems as bugs so that they can be dealt with accordingly.</p>
-<p>Bootstrap JDK: JDK 8</p>
-<table>
-<thead>
-<tr class="header">
-<th style="text-align: left;">Base OS and Architecture</th>
-<th style="text-align: left;">OS</th>
-<th style="text-align: left;">C/C++ Compiler</th>
-<th style="text-align: left;">Processors</th>
-<th style="text-align: left;">RAM Minimum</th>
-<th style="text-align: left;">DISK Needs</th>
-</tr>
-</thead>
-<tbody>
-<tr class="odd">
-<td style="text-align: left;">Linux X86 (32-bit) and X64 (64-bit)</td>
-<td style="text-align: left;">Oracle Enterprise Linux 6.4</td>
-<td style="text-align: left;">gcc 4.9.2</td>
-<td style="text-align: left;">2 or more</td>
-<td style="text-align: left;">1 GB</td>
-<td style="text-align: left;">6 GB</td>
-</tr>
-<tr class="even">
-<td style="text-align: left;">Solaris SPARCV9 (64-bit)</td>
-<td style="text-align: left;">Solaris 11 Update 1</td>
-<td style="text-align: left;">Studio 12 Update 4 + patches</td>
-<td style="text-align: left;">4 or more</td>
-<td style="text-align: left;">4 GB</td>
-<td style="text-align: left;">8 GB</td>
-</tr>
-<tr class="odd">
-<td style="text-align: left;">Solaris X64 (64-bit)</td>
-<td style="text-align: left;">Solaris 11 Update 1</td>
-<td style="text-align: left;">Studio 12 Update 4 + patches</td>
-<td style="text-align: left;">4 or more</td>
-<td style="text-align: left;">4 GB</td>
-<td style="text-align: left;">8 GB</td>
-</tr>
-<tr class="even">
-<td style="text-align: left;">Windows X86 (32-bit)</td>
-<td style="text-align: left;">Windows Server 2012 R2 x64</td>
-<td style="text-align: left;">Microsoft Visual Studio C++ 2013 Professional Edition</td>
-<td style="text-align: left;">2 or more</td>
-<td style="text-align: left;">2 GB</td>
-<td style="text-align: left;">6 GB</td>
-</tr>
-<tr class="odd">
-<td style="text-align: left;">Windows X64 (64-bit)</td>
-<td style="text-align: left;">Windows Server 2012 R2 x64</td>
-<td style="text-align: left;">Microsoft Visual Studio C++ 2013 Professional Edition</td>
-<td style="text-align: left;">2 or more</td>
-<td style="text-align: left;">2 GB</td>
-<td style="text-align: left;">6 GB</td>
-</tr>
-<tr class="even">
-<td style="text-align: left;">Mac OS X X64 (64-bit)</td>
-<td style="text-align: left;">Mac OS X 10.9 "Mavericks"</td>
-<td style="text-align: left;">Xcode 6.3 or newer</td>
-<td style="text-align: left;">2 or more</td>
-<td style="text-align: left;">4 GB</td>
-<td style="text-align: left;">6 GB</td>
-</tr>
-</tbody>
-</table>
-<hr />
-<h3 id="specific-developer-build-environments">Specific Developer Build Environments</h3>
-<p>We won't be listing all the possible environments, but we will try to provide what information we have available to us.</p>
-<p><strong>NOTE: The community can help out by updating this part of the document.</strong></p>
-<h4 id="fedora">Fedora</h4>
-<p>After installing the latest <a href="http://fedoraproject.org">Fedora</a> you need to install several build dependencies. The simplest way to do it is to execute the following commands as user <code>root</code>:</p>
-<pre><code> yum-builddep java-1.7.0-openjdk
- yum install gcc gcc-c++</code></pre>
-<p>In addition, it's necessary to set a few environment variables for the build:</p>
-<pre><code> export LANG=C
- export PATH="/usr/lib/jvm/java-openjdk/bin:${PATH}"</code></pre>
-<h4 id="centos-5.5">CentOS 5.5</h4>
-<p>After installing <a href="http://www.centos.org/">CentOS 5.5</a> you need to make sure you have the following Development bundles installed:</p>
+<p>You can also specify directly the number of build jobs to use with <code>--with-jobs=N</code> to <code>configure</code>, or <code>JOBS=N</code> to <code>make</code>. Do not use the <code>-j</code> flag to <code>make</code>. In most cases it will be ignored by the makefiles, but it can cause problems for some make targets.</p>
+<p>It might also be necessary to specify the JVM arguments passed to the Boot JDK, using e.g. <code>--with-boot-jdk-jvmargs="-Xmx8G"</code>. Doing so will override the default JVM arguments passed to the Boot JDK.</p>
+<p>At the end of a successful execution of <code>configure</code>, you will get a performance summary, indicating how well the build will perform. Here you will also get performance hints. If you want to build fast, pay attention to those!</p>
+<p>If you want to tweak build performance, run with <code>make LOG=info</code> to get a build time summary at the end of the build process.</p>
+<h3 id="disk-speed">Disk Speed</h3>
+<p>If you are using network shares, e.g. via NFS, for your source code, make sure the build directory is situated on local disk (e.g. by <code>ln -s /localdisk/jdk-build $JDK-SHARE/build</code>). The performance penalty is extremely high for building on a network share; close to unusable.</p>
+<p>Also, make sure that your build tools (including Boot JDK and toolchain) is located on a local disk and not a network share.</p>
+<p>As has been stressed elsewhere, do use SSD for source code and build directory, as well as (if possible) the build tools.</p>
+<h3 id="virus-checking">Virus Checking</h3>
+<p>The use of virus checking software, especially on Windows, can <em>significantly</em> slow down building of OpenJDK. If possible, turn off such software, or exclude the directory containing the OpenJDK source code from on-the-fly checking.</p>
+<h3 id="ccache">Ccache</h3>
+<p>The OpenJDK build supports building with ccache when using gcc or clang. Using ccache can radically speed up compilation of native code if you often rebuild the same sources. Your milage may vary however, so we recommend evaluating it for yourself. To enable it, make sure it's on the path and configure with <code>--enable-ccache</code>.</p>
+<h3 id="precompiled-headers">Precompiled Headers</h3>
+<p>By default, the Hotspot build uses preccompiled headers (PCH) on the toolchains were it is properly supported (clang, gcc, and Visual Studio). Normally, this speeds up the build process, but in some circumstances, it can actually slow things down.</p>
+<p>You can experiment by disabling precompiled headers using <code>--disable-precompiled-headers</code>.</p>
+<h3 id="icecc-icecream">Icecc / icecream</h3>
+<p><a href="http://github.com/icecc/icecream">icecc/icecream</a> is a simple way to setup a distributed compiler network. If you have multiple machines available for building OpenJDK, you can drastically cut individual build times by utilizing it.</p>
+<p>To use, setup an icecc network, and install icecc on the build machine. Then run <code>configure</code> using <code>--enable-icecc</code>.</p>
+<h3 id="using-sjavac">Using sjavac</h3>
+<p>To speed up Java compilation, especially incremental compilations, you can try the experimental sjavac compiler by using <code>--enable-sjavac</code>.</p>
+<h3 id="building-the-right-target">Building the Right Target</h3>
+<p>Selecting the proper target to build can have dramatic impact on build time. For normal usage, <code>jdk</code> or the default target is just fine. You only need to build <code>images</code> for shipping, or if your tests require it.</p>
+<p>See also <a href="#using-fine-grained-make-targets">Using Fine-Grained Make Targets</a> on how to build an even smaller subset of the product.</p>
+<h2 id="troubleshooting">Troubleshooting</h2>
+<p>If your build fails, it can sometimes be difficult to pinpoint the problem or find a proper solution.</p>
+<h3 id="locating-the-source-of-the-error">Locating the Source of the Error</h3>
+<p>When a build fails, it can be hard to pinpoint the actual cause of the error. In a typical build process, different parts of the product build in parallel, with the output interlaced.</p>
+<h4 id="build-failure-summary">Build Failure Summary</h4>
+<p>To help you, the build system will print a failure summary at the end. It looks like this:</p>
+<pre><code>ERROR: Build failed for target 'hotspot' in configuration 'linux-x64' (exit code 2)
+
+=== Output from failing command(s) repeated here ===
+* For target hotspot_variant-server_libjvm_objs_psMemoryPool.o:
+/localhome/hg/jdk9-sandbox/hotspot/src/share/vm/services/psMemoryPool.cpp:1:1: error: 'failhere' does not name a type
+ ... (rest of output omitted)
+
+* All command lines available in /localhome/hg/jdk9-sandbox/build/linux-x64/make-support/failure-logs.
+=== End of repeated output ===
+
+=== Make failed targets repeated here ===
+lib/CompileJvm.gmk:207: recipe for target '/localhome/hg/jdk9-sandbox/build/linux-x64/hotspot/variant-server/libjvm/objs/psMemoryPool.o' failed
+make/Main.gmk:263: recipe for target 'hotspot-server-libs' failed
+=== End of repeated output ===
+
+Hint: Try searching the build log for the name of the first failed target.
+Hint: If caused by a warning, try configure --disable-warnings-as-errors.</code></pre>
+<p>Let's break it down! First, the selected configuration, and the top-level target you entered on the command line that caused the failure is printed.</p>
+<p>Then, between the <code>Output from failing command(s) repeated here</code> and <code>End of repeated output</code> the first lines of output (stdout and stderr) from the actual failing command is repeated. In most cases, this is the error message that caused the build to fail. If multiple commands were failing (this can happen in a parallel build), output from all failed commands will be printed here.</p>
+<p>The path to the <code>failure-logs</code> directory is printed. In this file you will find a <code><target>.log</code> file that contains the output from this command in its entirety, and also a <code><target>.cmd</code>, which contain the complete command line used for running this command. You can re-run the failing command by executing <code>. <path to failure-logs>/<target>.cmd</code> in your shell.</p>
+<p>Another way to trace the failure is to follow the chain of make targets, from top-level targets to individual file targets. Between <code>Make failed targets repeated here</code> and <code>End of repeated output</code> the output from make showing this chain is repeated. The first failed recipe will typically contain the full path to the file in question that failed to compile. Following lines will show a trace of make targets why we ended up trying to compile that file.</p>
+<p>Finally, some hints are given on how to locate the error in the complete log. In this example, we would try searching the log file for "<code>psMemoryPool.o</code>". Another way to quickly locate make errors in the log is to search for "<code>] Error</code>" or "<code>***</code>".</p>
+<p>Note that the build failure summary will only help you if the issue was a compilation failure or similar. If the problem is more esoteric, or is due to errors in the build machinery, you will likely get empty output logs, and <code>No indication of failed target found</code> instead of the make target chain.</p>
+<h4 id="checking-the-build-log-file">Checking the Build Log File</h4>
+<p>The output (stdout and stderr) from the latest build is always stored in <code>$BUILD/build.log</code>. The previous build log is stored as <code>build.log.old</code>. This means that it is not necessary to redirect the build output yourself if you want to process it.</p>
+<p>You can increase the verbosity of the log file, by the <code>LOG</code> control variable to <code>make</code>. If you want to see the command lines used in compilations, use <code>LOG=cmdlines</code>. To increase the general verbosity, use <code>LOG=info</code>, <code>LOG=debug</code> or <code>LOG=trace</code>. Both of these can be combined with <code>cmdlines</code>, e.g. <code>LOG=info,cmdlines</code>. The <code>debug</code> log level will show most shell commands executed by make, and <code>trace</code> will show all. Beware that both these log levels will produce a massive build log!</p>
+<h3 id="fixing-unexpected-build-failures">Fixing Unexpected Build Failures</h3>
+<p>Most of the time, the build will fail due to incorrect changes in the source code.</p>
+<p>Sometimes the build can fail with no apparent changes that have caused the failure. If this is the first time you are building OpenJDK on this particular computer, and the build fails, the problem is likely with your build environment. But even if you have previously built OpenJDK with success, and it now fails, your build environment might have changed (perhaps due to OS upgrades or similar). But most likely, such failures are due to problems with the incremental rebuild.</p>
+<h4 id="problems-with-the-build-environment">Problems with the Build Environment</h4>
+<p>Make sure your configuration is correct. Re-run <code>configure</code>, and look for any warnings. Warnings that appear in the middle of the <code>configure</code> output is also repeated at the end, after the summary. The entire log is stored in <code>$BUILD/configure.log</code>.</p>
+<p>Verify that the summary at the end looks correct. Are you indeed using the Boot JDK and native toolchain that you expect?</p>
+<p>By default, OpenJDK has a strict approach where warnings from the compiler is considered errors which fail the build. For very new or very old compiler versions, this can trigger new classes of warnings, which thus fails the build. Run <code>configure</code> with <code>--disable-warnings-as-errors</code> to turn of this behavior. (The warnings will still show, but not make the build fail.)</p>
+<h4 id="problems-with-incremental-rebuilds">Problems with Incremental Rebuilds</h4>
+<p>Incremental rebuilds mean that when you modify part of the product, only the affected parts get rebuilt. While this works great in most cases, and significantly speed up the development process, from time to time complex interdependencies will result in an incorrect build result. This is the most common cause for unexpected build problems, together with inconsistencies between the different Mercurial repositories in the forest.</p>
+<p>Here are a suggested list of things to try if you are having unexpected build problems. Each step requires more time than the one before, so try them in order. Most issues will be solved at step 1 or 2.</p>
+<ol type="1">
+<li><p>Make sure your forest is up-to-date</p>
+<p>Run <code>bash get_source.sh</code> to make sure you have the latest version of all repositories.</p></li>
+<li><p>Clean build results</p>
+<p>The simplest way to fix incremental rebuild issues is to run <code>make clean</code>. This will remove all build results, but not the configuration or any build system support artifacts. In most cases, this will solve build errors resulting from incremental build mismatches.</p></li>
+<li><p>Completely clean the build directory.</p>
+<p>If this does not work, the next step is to run <code>make dist-clean</code>, or removing the build output directory (<code>$BUILD</code>). This will clean all generated output, including your configuration. You will need to re-run <code>configure</code> after this step. A good idea is to run <code>make print-configuration</code> before running <code>make dist-clean</code>, as this will print your current <code>configure</code> command line. Here's a way to do this:</p>
+<pre><code>make print-configuration > current-configuration
+make dist-clean
+bash configure $(cat current-configuration)
+make</code></pre></li>
+<li><p>Re-clone the Mercurial forest</p>
+<p>Sometimes the Mercurial repositories themselves gets in a state that causes the product to be un-buildable. In such a case, the simplest solution is often the "sledgehammer approach": delete the entire forest, and re-clone it. If you have local changes, save them first to a different location using <code>hg export</code>.</p></li>
+</ol>
+<h3 id="specific-build-issues">Specific Build Issues</h3>
+<h4 id="clock-skew">Clock Skew</h4>
+<p>If you get an error message like this:</p>
+<pre><code>File 'xxx' has modification time in the future.
+Clock skew detected. Your build may be incomplete.</code></pre>
+<p>then the clock on your build machine is out of sync with the timestamps on the source files. Other errors, apparently unrelated but in fact caused by the clock skew, can occur along with the clock skew warnings. These secondary errors may tend to obscure the fact that the true root cause of the problem is an out-of-sync clock.</p>
+<p>If you see these warnings, reset the clock on the build machine, run <code>make clean</code> and restart the build.</p>
+<h4 id="out-of-memory-errors">Out of Memory Errors</h4>
+<p>On Solaris, you might get an error message like this:</p>
+<pre><code>Trouble writing out table to disk</code></pre>
+<p>To solve this, increase the amount of swap space on your build machine.</p>
+<p>On Windows, you might get error messages like this:</p>
+<pre><code>fatal error - couldn't allocate heap
+cannot create ... Permission denied
+spawn failed</code></pre>
+<p>This can be a sign of a Cygwin problem. See the information about solving problems in the <a href="#cygwin">Cygwin</a> section. Rebooting the computer might help temporarily.</p>
+<h3 id="getting-help">Getting Help</h3>
+<p>If none of the suggestions in this document helps you, or if you find what you believe is a bug in the build system, please contact the Build Group by sending a mail to <a href="mailto:build-dev@openjdk.java.net">build-dev@openjdk.java.net</a>. Please include the relevant parts of the configure and/or build log.</p>
+<p>If you need general help or advice about developing for OpenJDK, you can also contact the Adoption Group. See the section on <a href="#contributing-to-openjdk">Contributing to OpenJDK</a> for more information.</p>
+<h2 id="hints-and-suggestions-for-advanced-users">Hints and Suggestions for Advanced Users</h2>
+<h3 id="setting-up-a-forest-for-pushing-changes-defpath">Setting Up a Forest for Pushing Changes (defpath)</h3>
+<p>To help you prepare a proper push path for a Mercurial repository, there exists a useful tool known as <a href="http://openjdk.java.net/projects/code-tools/defpath">defpath</a>. It will help you setup a proper push path for pushing changes to OpenJDK.</p>
+<p>Install the extension by cloning <code>http://hg.openjdk.java.net/code-tools/defpath</code> and updating your <code>.hgrc</code> file. Here's one way to do this:</p>
+<pre><code>cd ~
+mkdir hg-ext
+cd hg-ext
+hg clone http://hg.openjdk.java.net/code-tools/defpath
+cat << EOT >> ~/.hgrc
+[extensions]
+defpath=~/hg-ext/defpath/defpath.py
+EOT</code></pre>
+<p>You can now setup a proper push path using:</p>
+<pre><code>hg defpath -d -u <your OpenJDK username></code></pre>
+<p>If you also have the <code>trees</code> extension installed in Mercurial, you will automatically get a <code>tdefpath</code> command, which is even more useful. By running <code>hg tdefpath -du <username></code> in the top repository of your forest, all repos will get setup automatically. This is the recommended usage.</p>
+<h3 id="bash-completion">Bash Completion</h3>
+<p>The <code>configure</code> and <code>make</code> commands tries to play nice with bash command-line completion (using <code><tab></code> or <code><tab><tab></code>). To use this functionality, make sure you enable completion in your <code>~/.bashrc</code> (see instructions for bash in your operating system).</p>
+<p>Make completion will work out of the box, and will complete valid make targets. For instance, typing <code>make jdk-i<tab></code> will complete to <code>make jdk-image</code>.</p>
+<p>The <code>configure</code> script can get completion for options, but for this to work you need to help <code>bash</code> on the way. The standard way of running the script, <code>bash configure</code>, will not be understood by bash completion. You need <code>configure</code> to be the command to run. One way to achieve this is to add a simple helper script to your path:</p>
+<pre><code>cat << EOT > /tmp/configure
+#!/bin/bash
+if [ \$(pwd) = \$(cd \$(dirname \$0); pwd) ] ; then
+ echo >&2 "Abort: Trying to call configure helper recursively"
+ exit 1
+fi
+
+bash \$PWD/configure "\$@"
+EOT
+chmod +x /tmp/configure
+sudo mv /tmp/configure /usr/local/bin</code></pre>
+<p>Now <code>configure --en<tab>-dt<tab></code> will result in <code>configure --enable-dtrace</code>.</p>
+<h3 id="using-multiple-configurations">Using Multiple Configurations</h3>
+<p>You can have multiple configurations for a single source forest. When you create a new configuration, run <code>configure --with-conf-name=<name></code> to create a configuration with the name <code><name></code>. Alternatively, you can create a directory under <code>build</code> and run <code>configure</code> from there, e.g. <code>mkdir build/<name> && cd build/<name> && bash ../../configure</code>.</p>
+<p>Then you can build that configuration using <code>make CONF_NAME=<name></code> or <code>make CONF=<pattern></code>, where <code><pattern></code> is a substring matching one or several configurations, e.g. <code>CONF=debug</code>. The special empty pattern (<code>CONF=</code>) will match <em>all</em> available configuration, so <code>make CONF= hotspot</code> will build the <code>hotspot</code> target for all configurations. Alternatively, you can execute <code>make</code> in the configuration directory, e.g. <code>cd build/<name> && make</code>.</p>
+<h3 id="handling-reconfigurations">Handling Reconfigurations</h3>
+<p>If you update the forest and part of the configure script has changed, the build system will force you to re-run <code>configure</code>.</p>
+<p>Most of the time, you will be fine by running <code>configure</code> again with the same arguments as the last time, which can easily be performed by <code>make reconfigure</code>. To simplify this, you can use the <code>CONF_CHECK</code> make control variable, either as <code>make CONF_CHECK=auto</code>, or by setting an environment variable. For instance, if you add <code>export CONF_CHECK=auto</code> to your <code>.bashrc</code> file, <code>make</code> will always run <code>reconfigure</code> automatically whenever the configure script has changed.</p>
+<p>You can also use <code>CONF_CHECK=ignore</code> to skip the check for a needed configure update. This might speed up the build, but comes at the risk of an incorrect build result. This is only recommended if you know what you're doing.</p>
+<p>From time to time, you will also need to modify the command line to <code>configure</code> due to changes. Use <code>make print-configure</code> to show the command line used for your current configuration.</p>
+<h3 id="using-fine-grained-make-targets">Using Fine-Grained Make Targets</h3>
+<p>The default behavior for make is to create consistent and correct output, at the expense of build speed, if necessary.</p>
+<p>If you are prepared to take some risk of an incorrect build, and know enough of the system to understand how things build and interact, you can speed up the build process considerably by instructing make to only build a portion of the product.</p>
+<h4 id="building-individual-modules">Building Individual Modules</h4>
+<p>The safe way to use fine-grained make targets is to use the module specific make targets. All source code in JDK 9 is organized so it belongs to a module, e.g. <code>java.base</code> or <code>jdk.jdwp.agent</code>. You can build only a specific module, by giving it as make target: <code>make jdk.jdwp.agent</code>. If the specified module depends on other modules (e.g. <code>java.base</code>), those modules will be built first.</p>
+<p>You can also specify a set of modules, just as you can always specify a set of make targets: <code>make jdk.crypto.cryptoki jdk.crypto.ec jdk.crypto.mscapi jdk.crypto.ucrypto</code></p>
+<h4 id="building-individual-module-phases">Building Individual Module Phases</h4>
+<p>The build process for each module is divided into separate phases. Not all modules need all phases. Which are needed depends on what kind of source code and other artifact the module consists of. The phases are:</p>
<ul>
-<li>Development Libraries</li>
-<li>Development Tools</li>
-<li>Java Development</li>
-<li>X Software Development (Including XFree86-devel)</li>
+<li><code>gensrc</code> (Generate source code to compile)</li>
+<li><code>gendata</code> (Generate non-source code artifacts)</li>
+<li><code>copy</code> (Copy resource artifacts)</li>
+<li><code>java</code> (Compile Java code)</li>
+<li><code>launchers</code> (Compile native executables)</li>
+<li><code>libs</code> (Compile native libraries)</li>
+<li><code>rmic</code> (Run the <code>rmic</code> tool)</li>
</ul>
-<p>Plus the following packages:</p>
+<p>You can build only a single phase for a module by using the notation <code>$MODULE-$PHASE</code>. For instance, to build the <code>gensrc</code> phase for <code>java.base</code>, use <code>make java.base-gensrc</code>.</p>
+<p>Note that some phases may depend on others, e.g. <code>java</code> depends on <code>gensrc</code> (if present). Make will build all needed prerequisites before building the requested phase.</p>
+<h4 id="skipping-the-dependency-check">Skipping the Dependency Check</h4>
+<p>When using an iterative development style with frequent quick rebuilds, the dependency check made by make can take up a significant portion of the time spent on the rebuild. In such cases, it can be useful to bypass the dependency check in make.</p>
+<blockquote>
+<p><strong>Note that if used incorrectly, this can lead to a broken build!</strong></p>
+</blockquote>
+<p>To achieve this, append <code>-only</code> to the build target. For instance, <code>make jdk.jdwp.agent-java-only</code> will <em>only</em> build the <code>java</code> phase of the <code>jdk.jdwp.agent</code> module. If the required dependencies are not present, the build can fail. On the other hand, the execution time measures in milliseconds.</p>
+<p>A useful pattern is to build the first time normally (e.g. <code>make jdk.jdwp.agent</code>) and then on subsequent builds, use the <code>-only</code> make target.</p>
+<h4 id="rebuilding-part-of-java.base-jdk_filter">Rebuilding Part of java.base (JDK_FILTER)</h4>
+<p>If you are modifying files in <code>java.base</code>, which is the by far largest module in OpenJDK, then you need to rebuild all those files whenever a single file has changed. (This inefficiency will hopefully be addressed in JDK 10.)</p>
+<p>As a hack, you can use the make control variable <code>JDK_FILTER</code> to specify a pattern that will be used to limit the set of files being recompiled. For instance, <code>make java.base JDK_FILTER=javax/crypto</code> (or, to combine methods, <code>make java.base-java-only JDK_FILTER=javax/crypto</code>) will limit the compilation to files in the <code>javax.crypto</code> package.</p>
+<h3 id="learn-about-mercurial">Learn About Mercurial</h3>
+<p>To become an efficient OpenJDK developer, it is recommended that you invest in learning Mercurial properly. Here are some links that can get you started:</p>
<ul>
-<li>cups devel: Cups Development Package</li>
-<li>alsa devel: Alsa Development Package</li>
-<li>Xi devel: libXi.so Development Package</li>
+<li><a href="http://www.mercurial-scm.org/wiki/GitConcepts">Mercurial for git users</a></li>
+<li><a href="http://www.mercurial-scm.org/wiki/Tutorial">The official Mercurial tutorial</a></li>
+<li><a href="http://hginit.com/">hg init</a></li>
+<li><a href="http://hgbook.red-bean.com/read/">Mercurial: The Definitive Guide</a></li>
</ul>
-<p>The freetype 2.3 packages don't seem to be available, but the freetype 2.3 sources can be downloaded, built, and installed easily enough from <a href="http://downloads.sourceforge.net/freetype">the freetype site</a>. Build and install with something like:</p>
-<pre><code> bash ./configure
- make
- sudo -u root make install</code></pre>
-<p>Mercurial packages could not be found easily, but a Google search should find ones, and they usually include Python if it's needed.</p>
-<h4 id="debian-5.0-lenny">Debian 5.0 (Lenny)</h4>
-<p>After installing <a href="http://debian.org">Debian</a> 5 you need to install several build dependencies. The simplest way to install the build dependencies is to execute the following commands as user <code>root</code>:</p>
-<pre><code> aptitude build-dep openjdk-7
- aptitude install openjdk-7-jdk libmotif-dev</code></pre>
-<p>In addition, it's necessary to set a few environment variables for the build:</p>
-<pre><code> export LANG=C
- export PATH="/usr/lib/jvm/java-7-openjdk/bin:${PATH}"</code></pre>
-<h4 id="ubuntu-12.04">Ubuntu 12.04</h4>
-<p>After installing <a href="http://ubuntu.org">Ubuntu</a> 12.04 you need to install several build dependencies. The simplest way to do it is to execute the following commands:</p>
-<pre><code> sudo aptitude build-dep openjdk-7
- sudo aptitude install openjdk-7-jdk</code></pre>
-<p>In addition, it's necessary to set a few environment variables for the build:</p>
-<pre><code> export LANG=C
- export PATH="/usr/lib/jvm/java-7-openjdk/bin:${PATH}"</code></pre>
-<h4 id="opensuse-11.1">OpenSUSE 11.1</h4>
-<p>After installing <a href="http://opensuse.org">OpenSUSE</a> 11.1 you need to install several build dependencies. The simplest way to install the build dependencies is to execute the following commands:</p>
-<pre><code> sudo zypper source-install -d java-1_7_0-openjdk
- sudo zypper install make</code></pre>
-<p>In addition, it is necessary to set a few environment variables for the build:</p>
-<pre><code> export LANG=C
- export PATH="/usr/lib/jvm/java-1.7.0-openjdk/bin:$[PATH}"</code></pre>
-<p>Finally, you need to unset the <code>JAVA_HOME</code> environment variable:</p>
-<pre><code> export -n JAVA_HOME`</code></pre>
-<h4 id="mandriva-linux-one-2009-spring">Mandriva Linux One 2009 Spring</h4>
-<p>After installing <a href="http://mandriva.org">Mandriva</a> Linux One 2009 Spring you need to install several build dependencies. The simplest way to install the build dependencies is to execute the following commands as user <code>root</code>:</p>
-<pre><code> urpmi java-1.7.0-openjdk-devel make gcc gcc-c++ freetype-devel zip unzip
- libcups2-devel libxrender1-devel libalsa2-devel libstc++-static-devel
- libxtst6-devel libxi-devel</code></pre>
-<p>In addition, it is necessary to set a few environment variables for the build:</p>
-<pre><code> export LANG=C
- export PATH="/usr/lib/jvm/java-1.7.0-openjdk/bin:${PATH}"</code></pre>
-<h4 id="opensolaris-2009.06">OpenSolaris 2009.06</h4>
-<p>After installing <a href="http://opensolaris.org">OpenSolaris</a> 2009.06 you need to install several build dependencies. The simplest way to install the build dependencies is to execute the following commands:</p>
-<pre><code> pfexec pkg install SUNWgmake SUNWj7dev sunstudioexpress SUNWcups SUNWzip
- SUNWunzip SUNWxwhl SUNWxorg-headers SUNWaudh SUNWfreetype2</code></pre>
-<p>In addition, it is necessary to set a few environment variables for the build:</p>
-<pre><code> export LANG=C
- export PATH="/opt/SunStudioExpress/bin:${PATH}"</code></pre>
-<hr />
-<p>End of the OpenJDK build README document.</p>
-<p>Please come again!</p>
+<h2 id="understanding-the-build-system">Understanding the Build System</h2>
+<p>This section will give you a more technical description on the details of the build system.</p>
+<h3 id="configurations">Configurations</h3>
+<p>The build system expects to find one or more configuration. These are technically defined by the <code>spec.gmk</code> in a subdirectory to the <code>build</code> subdirectory. The <code>spec.gmk</code> file is generated by <code>configure</code>, and contains in principle the configuration (directly or by files included by <code>spec.gmk</code>).</p>
+<p>You can, in fact, select a configuration to build by pointing to the <code>spec.gmk</code> file with the <code>SPEC</code> make control variable, e.g. <code>make SPEC=$BUILD/spec.gmk</code>. While this is not the recommended way to call <code>make</code> as a user, it is what is used under the hood by the build system.</p>
+<h3 id="build-output-structure">Build Output Structure</h3>
+<p>The build output for a configuration will end up in <code>build/<configuration name></code>, which we refer to as <code>$BUILD</code> in this document. The <code>$BUILD</code> directory contains the following important directories:</p>
+<pre><code>buildtools/
+configure-support/
+hotspot/
+images/
+jdk/
+make-support/
+support/
+test-results/
+test-support/</code></pre>
+<p>This is what they are used for:</p>
+<ul>
+<li><p><code>images</code>: This is the directory were the output of the <code>*-image</code> make targets end up. For instance, <code>make jdk-image</code> ends up in <code>images/jdk</code>.</p></li>
+<li><p><code>jdk</code>: This is the "exploded image". After <code>make jdk</code>, you will be able to launch the newly built JDK by running <code>$BUILD/jdk/bin/java</code>.</p></li>
+<li><p><code>test-results</code>: This directory contains the results from running tests.</p></li>
+<li><p><code>support</code>: This is an area for intermediate files needed during the build, e.g. generated source code, object files and class files. Some noteworthy directories in <code>support</code> is <code>gensrc</code>, which contains the generated source code, and the <code>modules_*</code> directories, which contains the files in a per-module hierarchy that will later be collapsed into the <code>jdk</code> directory of the exploded image.</p></li>
+<li><p><code>buildtools</code>: This is an area for tools compiled for the build platform that are used during the rest of the build.</p></li>
+<li><p><code>hotspot</code>: This is an area for intermediate files needed when building hotspot.</p></li>
+<li><p><code>configure-support</code>, <code>make-support</code> and <code>test-support</code>: These directories contain files that are needed by the build system for <code>configure</code>, <code>make</code> and for running tests.</p></li>
+</ul>
+<h3 id="fixpath">Fixpath</h3>
+<p>Windows path typically look like <code>C:\User\foo</code>, while Unix paths look like <code>/home/foo</code>. Tools with roots from Unix often experience issues related to this mismatch when running on Windows.</p>
+<p>In the OpenJDK build, we always use Unix paths internally, and only just before calling a tool that does not understand Unix paths do we convert them to Windows paths.</p>
+<p>This conversion is done by the <code>fixpath</code> tool, which is a small wrapper that modifies unix-style paths to Windows-style paths in command lines. Fixpath is compiled automatically by <code>configure</code>.</p>
+<h3 id="native-debug-symbols">Native Debug Symbols</h3>
+<p>Native libraries and executables can have debug symbol (and other debug information) associated with them. How this works is very much platform dependent, but a common problem is that debug symbol information takes a lot of disk space, but is rarely needed by the end user.</p>
+<p>The OpenJDK supports different methods on how to handle debug symbols. The method used is selected by <code>--with-native-debug-symbols</code>, and available methods are <code>none</code>, <code>internal</code>, <code>external</code>, <code>zipped</code>.</p>
+<ul>
+<li><p><code>none</code> means that no debug symbols will be generated during the build.</p></li>
+<li><p><code>internal</code> means that debug symbols will be generated during the build, and they will be stored in the generated binary.</p></li>
+<li><p><code>external</code> means that debug symbols will be generated during the build, and after the compilation, they will be moved into a separate <code>.debuginfo</code> file. (This was previously known as FDS, Full Debug Symbols).</p></li>
+<li><p><code>zipped</code> is like <code>external</code>, but the .debuginfo file will also be zipped into a <code>.diz</code> file.</p></li>
+</ul>
+<p>When building for distribution, <code>zipped</code> is a good solution. Binaries built with <code>internal</code> is suitable for use by developers, since they facilitate debugging, but should be stripped before distributed to end users.</p>
+<h3 id="autoconf-details">Autoconf Details</h3>
+<p>The <code>configure</code> script is based on the autoconf framework, but in some details deviate from a normal autoconf <code>configure</code> script.</p>
+<p>The <code>configure</code> script in the top level directory of OpenJDK is just a thin wrapper that calls <code>common/autoconf/configure</code>. This in turn provides functionality that is not easily expressed in the normal Autoconf framework, and then calls into the core of the <code>configure</code> script, which is the <code>common/autoconf/generated-configure.sh</code> file.</p>
+<p>As the name implies, this file is generated by Autoconf. It is checked in after regeneration, to alleviate the common user to have to install Autoconf.</p>
+<p>The build system will detect if the Autoconf source files have changed, and will trigger a regeneration of <code>common/autoconf/generated-configure.sh</code> if needed. You can also manually request such an update by <code>bash common/autoconf/autogen.sh</code>.</p>
+<p>If you make changes to the build system that requires a re-generation, note the following:</p>
+<ul>
+<li><p>You must use <em>exactly</em> version 2.69 of autoconf for your patch to be accepted. This is to avoid spurious changes in the generated file. Note that Ubuntu 16.04 ships a patched version of autoconf which claims to be 2.69, but is not.</p></li>
+<li><p>You do not need to include the generated file in reviews.</p></li>
+<li><p>If the generated file needs updating, the Oracle JDK closed counter-part will also need to be updated. It is very much appreciated if you ask for an Oracle engineer to sponsor your push so this can be made in tandem.</p></li>
+</ul>
+<h3 id="developing-the-build-system-itself">Developing the Build System Itself</h3>
+<p>This section contains a few remarks about how to develop for the build system itself. It is not relevant if you are only making changes in the product source code.</p>
+<p>While technically using <code>make</code>, the make source files of the OpenJDK does not resemble most other Makefiles. Instead of listing specific targets and actions (perhaps using patterns), the basic modus operandi is to call a high-level function (or properly, macro) from the API in <code>make/common</code>. For instance, to compile all classes in the <code>jdk.internal.foo</code> package in the <code>jdk.foo</code> module, a call like this would be made:</p>
+<pre><code>$(eval $(call SetupJavaCompilation, BUILD_FOO_CLASSES, \
+ SETUP := GENERATE_OLDBYTECODE, \
+ SRC := $(JDK_TOPDIR)/src/jkd.foo/share/classes, \
+ INCLUDES := jdk/internal/foo, \
+ BIN := $(SUPPORT_OUTPUTDIR)/foo_classes, \
+))</code></pre>
+<p>By encapsulating and expressing the high-level knowledge of <em>what</em> should be done, rather than <em>how</em> it should be done (as is normal in Makefiles), we can build a much more powerful and flexible build system.</p>
+<p>Correct dependency tracking is paramount. Sloppy dependency tracking will lead to improper parallelization, or worse, race conditions.</p>
+<p>To test for/debug race conditions, try running <code>make JOBS=1</code> and <code>make JOBS=100</code> and see if it makes any difference. (It shouldn't).</p>
+<p>To compare the output of two different builds and see if, and how, they differ, run <code>$BUILD1/compare.sh -o $BUILD2</code>, where <code>$BUILD1</code> and <code>$BUILD2</code> are the two builds you want to compare.</p>
+<p>To automatically build two consecutive versions and compare them, use <code>COMPARE_BUILD</code>. The value of <code>COMPARE_BUILD</code> is a set of variable=value assignments, like this:</p>
+<pre><code>make COMPARE_BUILD=CONF=--enable-new-hotspot-feature:MAKE=hotspot</code></pre>
+<p>See <code>make/InitSupport.gmk</code> for details on how to use <code>COMPARE_BUILD</code>.</p>
+<p>To analyze build performance, run with <code>LOG=trace</code> and check <code>$BUILD/build-trace-time.log</code>. Use <code>JOBS=1</code> to avoid parallelism.</p>
+<p>Please check that you adhere to the <a href="http://openjdk.java.net/groups/build/doc/code-conventions.html">Code Conventions for the Build System</a> before submitting patches. Also see the section in <a href="#autoconf-details">Autoconf Details</a> about the generated configure script.</p>
+<h2 id="contributing-to-openjdk">Contributing to OpenJDK</h2>
+<p>So, now you've build your OpenJDK, and made your first patch, and want to contribute it back to the OpenJDK community.</p>
+<p>First of all: Thank you! We gladly welcome your contribution to the OpenJDK. However, please bear in mind that OpenJDK is a massive project, and we must ask you to follow our rules and guidelines to be able to accept your contribution.</p>
+<p>The official place to start is the <a href="http://openjdk.java.net/contribute/">'How to contribute' page</a>. There is also an official (but somewhat outdated and skimpy on details) <a href="http://openjdk.java.net/guide/">Developer's Guide</a>.</p>
+<p>If this seems overwhelming to you, the Adoption Group is there to help you! A good place to start is their <a href="https://wiki.openjdk.java.net/display/Adoption/New+Contributor">'New Contributor' page</a>, or start reading the comprehensive <a href="https://adoptopenjdk.gitbooks.io/adoptopenjdk-getting-started-kit/en/">Getting Started Kit</a>. The Adoption Group will also happily answer any questions you have about contributing. Contact them by <a href="http://mail.openjdk.java.net/mailman/listinfo/adoption-discuss">mail</a> or <a href="http://openjdk.java.net/irc/">IRC</a>.</p>
</body>
</html>
--- a/common/doc/building.md Tue Jun 20 13:12:42 2017 +0200
+++ b/common/doc/building.md Wed Jun 21 12:51:25 2017 +0200
@@ -1,715 +1,1185 @@
-% OpenJDK Build README
+% Building OpenJDK
+
+## TL;DR (Instructions for the Impatient)
+
+If you are eager to try out building OpenJDK, these simple steps works most of
+the time. They assume that you have installed Mercurial (and Cygwin if running
+on Windows) and cloned the top-level OpenJDK repository that you want to build.
+
+ 1. [Get the complete source code](#getting-the-source-code): \
+ `bash get_source.sh`
+
+ 2. [Run configure](#running-configure): \
+ `bash configure`
-![OpenJDK](http://openjdk.java.net/images/openjdk.png)
+ If `configure` fails due to missing dependencies (to either the
+ [toolchain](#native-compiler-toolchain-requirements), [external libraries](
+ #external-library-requirements) or the [boot JDK](#boot-jdk-requirements)),
+ most of the time it prints a suggestion on how to resolve the situation on
+ your platform. Follow the instructions, and try running `bash configure`
+ again.
---------------------------------------------------------------------------------
+ 3. [Run make](#running-make): \
+ `make images`
+
+ 4. Verify your newly built JDK: \
+ `./build/*/images/jdk/bin/java -version`
+
+ 5. [Run basic tests](##running-tests): \
+ `make run-test-tier1`
+
+If any of these steps failed, or if you want to know more about build
+requirements or build functionality, please continue reading this document.
## Introduction
-This README file contains build instructions for the
-[OpenJDK](http://openjdk.java.net). Building the source code for the OpenJDK
-requires a certain degree of technical expertise.
-
-### !!!!!!!!!!!!!!! THIS IS A MAJOR RE-WRITE of this document. !!!!!!!!!!!!!
-
-Some Headlines:
-
- * The build is now a "`configure && make`" style build
- * Any GNU make 3.81 or newer should work, except on Windows where 4.0 or newer
- is recommended.
- * The build should scale, i.e. more processors should cause the build to be
- done in less wall-clock time
- * Nested or recursive make invocations have been significantly reduced, as
- has the total fork/exec or spawning of sub processes during the build
- * Windows MKS usage is no longer supported
- * Windows Visual Studio `vsvars*.bat` and `vcvars*.bat` files are run
- automatically
- * Ant is no longer used when building the OpenJDK
- * Use of ALT\_\* environment variables for configuring the build is no longer
- supported
-
--------------------------------------------------------------------------------
-
-## Contents
-
- * [Introduction](#introduction)
- * [Use of Mercurial](#hg)
- * [Getting the Source](#get_source)
- * [Repositories](#repositories)
- * [Building](#building)
- * [System Setup](#setup)
- * [Linux](#linux)
- * [Solaris](#solaris)
- * [Mac OS X](#macosx)
- * [Windows](#windows)
- * [Configure](#configure)
- * [Make](#make)
- * [Testing](#testing)
-
--------------------------------------------------------------------------------
-
- * [Appendix A: Hints and Tips](#hints)
- * [FAQ](#faq)
- * [Build Performance Tips](#performance)
- * [Troubleshooting](#troubleshooting)
- * [Appendix B: GNU Make Information](#gmake)
- * [Appendix C: Build Environments](#buildenvironments)
-
--------------------------------------------------------------------------------
-
-## Use of Mercurial
-
-The OpenJDK sources are maintained with the revision control system
-[Mercurial](http://mercurial.selenic.com/wiki/Mercurial). If you are new to
-Mercurial, please see the [Beginner
-Guides](http://mercurial.selenic.com/wiki/BeginnersGuides) or refer to the
-[Mercurial Book](http://hgbook.red-bean.com/). The first few chapters of the
-book provide an excellent overview of Mercurial, what it is and how it works.
-
-For using Mercurial with the OpenJDK refer to the [Developer Guide: Installing
-and Configuring
-Mercurial](http://openjdk.java.net/guide/repositories.html#installConfig)
-section for more information.
-
-### Getting the Source
-
-To get the entire set of OpenJDK Mercurial repositories use the script
-`get_source.sh` located in the root repository:
-
- hg clone http://hg.openjdk.java.net/jdk9/jdk9 YourOpenJDK
- cd YourOpenJDK
- bash ./get_source.sh
-
-Once you have all the repositories, keep in mind that each repository is its
-own independent repository. You can also re-run `./get_source.sh` anytime to
-pull over all the latest changesets in all the repositories. This set of nested
-repositories has been given the term "forest" and there are various ways to
-apply the same `hg` command to each of the repositories. For example, the
-script `make/scripts/hgforest.sh` can be used to repeat the same `hg` command
-on every repository, e.g.
-
- cd YourOpenJDK
- bash ./make/scripts/hgforest.sh status
-
-### Repositories
-
-The set of repositories and what they contain:
-
- * **. (root)** contains common configure and makefile logic
- * **hotspot** contains source code and make files for building the OpenJDK
- Hotspot Virtual Machine
- * **langtools** contains source code for the OpenJDK javac and language tools
- * **jdk** contains source code and make files for building the OpenJDK runtime
- libraries and misc files
- * **jaxp** contains source code for the OpenJDK JAXP functionality
- * **jaxws** contains source code for the OpenJDK JAX-WS functionality
- * **corba** contains source code for the OpenJDK Corba functionality
- * **nashorn** contains source code for the OpenJDK JavaScript implementation
-
-### Repository Source Guidelines
-
-There are some very basic guidelines:
+OpenJDK is a complex software project. Building it requires a certain amount of
+technical expertise, a fair number of dependencies on external software, and
+reasonably powerful hardware.
- * Use of whitespace in source files (.java, .c, .h, .cpp, and .hpp files) is
- restricted. No TABs, no trailing whitespace on lines, and files should not
- terminate in more than one blank line.
- * Files with execute permissions should not be added to the source
- repositories.
- * All generated files need to be kept isolated from the files maintained or
- managed by the source control system. The standard area for generated files
- is the top level `build/` directory.
- * The default build process should be to build the product and nothing else,
- in one form, e.g. a product (optimized), debug (non-optimized, -g plus
- assert logic), or fastdebug (optimized, -g plus assert logic).
- * The `.hgignore` file in each repository must exist and should include
- `^build/`, `^dist/` and optionally any `nbproject/private` directories. **It
- should NEVER** include anything in the `src/` or `test/` or any managed
- directory area of a repository.
- * Directory names and file names should never contain blanks or non-printing
- characters.
- * Generated source or binary files should NEVER be added to the repository
- (that includes `javah` output). There are some exceptions to this rule, in
- particular with some of the generated configure scripts.
- * Files not needed for typical building or testing of the repository should
- not be added to the repository.
-
--------------------------------------------------------------------------------
-
-## Building
-
-The very first step in building the OpenJDK is making sure the system itself
-has everything it needs to do OpenJDK builds. Once a system is setup, it
-generally doesn't need to be done again.
-
-Building the OpenJDK is now done with running a `configure` script which will
-try and find and verify you have everything you need, followed by running
-`make`, e.g.
-
-> **`bash ./configure`** \
-> **`make all`**
-
-Where possible the `configure` script will attempt to located the various
-components in the default locations or via component specific variable
-settings. When the normal defaults fail or components cannot be found,
-additional `configure` options may be necessary to help `configure` find the
-necessary tools for the build, or you may need to re-visit the setup of your
-system due to missing software packages.
-
-**NOTE:** The `configure` script file does not have execute permissions and
-will need to be explicitly run with `bash`, see the source guidelines.
-
--------------------------------------------------------------------------------
-
-### System Setup
-
-Before even attempting to use a system to build the OpenJDK there are some very
-basic system setups needed. For all systems:
-
- * Be sure the GNU make utility is version 3.81 (4.0 on windows) or newer, e.g.
- run "`make -version`"
-
- <a name="bootjdk"></a>
- * Install a Bootstrap JDK. All OpenJDK builds require access to a previously
- released JDK called the *bootstrap JDK* or *boot JDK.* The general rule is
- that the bootstrap JDK must be an instance of the previous major release of
- the JDK. In addition, there may be a requirement to use a release at or
- beyond a particular update level.
-
- ***Building JDK 9 requires JDK 8. JDK 9 developers should not use JDK 9 as
- the boot JDK, to ensure that JDK 9 dependencies are not introduced into the
- parts of the system that are built with JDK 8.***
-
- The JDK 8 binaries can be downloaded from Oracle's [JDK 8 download
- site](http://www.oracle.com/technetwork/java/javase/downloads/index.html).
- For build performance reasons it is very important that this bootstrap JDK
- be made available on the local disk of the machine doing the build. You
- should add its `bin` directory to the `PATH` environment variable. If
- `configure` has any issues finding this JDK, you may need to use the
- `configure` option `--with-boot-jdk`.
-
- * Ensure that GNU make, the Bootstrap JDK, and the compilers are all in your
- PATH environment variable.
-
-And for specific systems:
-
- * **Linux**
-
- Install all the software development packages needed including
- [alsa](#alsa), [freetype](#freetype), [cups](#cups), and
- [xrender](#xrender). See [specific system packages](#SDBE).
-
- * **Solaris**
-
- Install all the software development packages needed including [Studio
- Compilers](#studio), [freetype](#freetype), [cups](#cups), and
- [xrender](#xrender). See [specific system packages](#SDBE).
-
- * **Windows**
-
- * Install one of [CYGWIN](#cygwin) or [MinGW/MSYS](#msys)
- * Install [Visual Studio 2013](#vs2013)
-
- * **Mac OS X**
-
- Install [XCode 6.3](https://developer.apple.com/xcode/)
-
-#### Linux
-
-With Linux, try and favor the system packages over building your own or getting
-packages from other areas. Most Linux builds should be possible with the
-system's available packages.
-
-Note that some Linux systems have a habit of pre-populating your environment
-variables for you, for example `JAVA_HOME` might get pre-defined for you to
-refer to the JDK installed on your Linux system. You will need to unset
-`JAVA_HOME`. It's a good idea to run `env` and verify the environment variables
-you are getting from the default system settings make sense for building the
+If you just want to use OpenJDK and not build it yourself, this document is not
+for you. See for instance [OpenJDK installation](
+http://openjdk.java.net/install) for some methods of installing a prebuilt
OpenJDK.
-#### Solaris
+## Getting the Source Code
+
+OpenJDK uses [Mercurial](http://www.mercurial-scm.org) for source control. The
+source code is contained not in a single Mercurial repository, but in a tree
+("forest") of interrelated repositories. You will need to check out all of the
+repositories to be able to build OpenJDK. To assist you in dealing with this
+somewhat unusual arrangement, there are multiple tools available, which are
+explained below.
+
+In any case, make sure you are getting the correct version. At the [OpenJDK
+Mercurial server](http://hg.openjdk.java.net/) you can see a list of all
+available forests. If you want to build an older version, e.g. JDK 8, it is
+recommended that you get the `jdk8u` forest, which contains incremental
+updates, instead of the `jdk8` forest, which was frozen at JDK 8 GA.
+
+If you are new to Mercurial, a good place to start is the [Mercurial Beginner's
+Guide](http://www.mercurial-scm.org/guide). The rest of this document assumes a
+working knowledge of Mercurial.
+
+### Special Considerations
+
+For a smooth building experience, it is recommended that you follow these rules
+on where and how to check out the source code.
+
+ * Do not check out the source code in a path which contains spaces. Chances
+ are the build will not work. This is most likely to be an issue on Windows
+ systems.
+
+ * Do not check out the source code in a path which has a very long name or is
+ nested many levels deep. Chances are you will hit an OS limitation during
+ the build.
+
+ * Put the source code on a local disk, not a network share. If possible, use
+ an SSD. The build process is very disk intensive, and having slow disk
+ access will significantly increase build times. If you need to use a
+ network share for the source code, see below for suggestions on how to keep
+ the build artifacts on a local disk.
+
+ * On Windows, extra care must be taken to make sure the [Cygwin](#cygwin)
+ environment is consistent. It is recommended that you follow this
+ procedure:
+
+ * Create the directory that is going to contain the top directory of the
+ OpenJDK clone by using the `mkdir` command in the Cygwin bash shell.
+ That is, do *not* create it using Windows Explorer. This will ensure
+ that it will have proper Cygwin attributes, and that it's children will
+ inherit those attributes.
+
+ * Do not put the OpenJDK clone in a path under your Cygwin home
+ directory. This is especially important if your user name contains
+ spaces and/or mixed upper and lower case letters.
+
+ * Clone the OpenJDK repository using the Cygwin command line `hg` client
+ as instructed in this document. That is, do *not* use another Mercurial
+ client such as TortoiseHg.
+
+ Failure to follow this procedure might result in hard-to-debug build
+ problems.
+
+### Using get\_source.sh
+
+The simplest way to get the entire forest is probably to clone the top-level
+repository and then run the `get_source.sh` script, like this:
+
+```
+hg clone http://hg.openjdk.java.net/jdk9/jdk9
+cd jdk9
+bash get_source.sh
+```
+
+The first time this is run, it will clone all the sub-repositories. Any
+subsequent execution of the script will update all sub-repositories to the
+latest revision.
+
+### Using hgforest.sh
+
+The `hgforest.sh` script is more expressive than `get_source.sh`. It takes any
+number of arguments, and runs `hg` with those arguments on each sub-repository
+in the forest. The `get_source.sh` script is basically a simple wrapper that
+runs either `hgforest.sh clone` or `hgforest.sh pull -u`.
+
+ * Cloning the forest:
+ ```
+ hg clone http://hg.openjdk.java.net/jdk9/jdk9
+ cd jdk9
+ bash common/bin/hgforest.sh clone
+ ```
+
+ * Pulling and updating the forest:
+ ```
+ bash common/bin/hgforest.sh pull -u
+ ```
+
+ * Merging over the entire forest:
+ ```
+ bash common/bin/hgforest.sh merge
+ ```
-##### Studio Compilers
+### Using the Trees Extension
+
+The trees extension is a Mercurial add-on that helps you deal with the forest.
+More information is available on the [Code Tools trees page](
+http://openjdk.java.net/projects/code-tools/trees).
+
+#### Installing the Extension
+
+Install the extension by cloning `http://hg.openjdk.java.net/code-tools/trees`
+and updating your `.hgrc` file. Here's one way to do this:
+
+```
+cd ~
+mkdir hg-ext
+cd hg-ext
+hg clone http://hg.openjdk.java.net/code-tools/trees
+cat << EOT >> ~/.hgrc
+[extensions]
+trees=~/hg-ext/trees/trees.py
+EOT
+```
+
+#### Initializing the Tree
+
+The trees extension needs to know the structure of the forest. If you have
+already cloned the entire forest using another method, you can initialize the
+forest like this:
+
+```
+hg tconf --set --walk --depth
+```
+
+Or you can clone the entire forest at once, if you substitute `clone` with
+`tclone` when cloning the top-level repository, e.g. like this:
+
+```
+hg tclone http://hg.openjdk.java.net/jdk9/jdk9
+```
+
+In this case, the forest will be properly initialized from the start.
+
+#### Other Operations
+
+The trees extensions supplement many common operations with a trees version by
+prefixing a `t` to the normal Mercurial command, e.g. `tcommit`, `tstatus` or
+`tmerge`. For instance, to update the entire forest:
+
+```
+hg tpull -u
+```
+
+## Build Hardware Requirements
+
+OpenJDK is a massive project, and require machines ranging from decent to
+powerful to be able to build in a reasonable amount of time, or to be able to
+complete a build at all.
+
+We *strongly* recommend usage of an SSD disk for the build, since disk speed is
+one of the limiting factors for build performance.
+
+### Building on x86
+
+At a minimum, a machine with 2-4 cores is advisable, as well as 2-4 GB of RAM.
+(The more cores to use, the more memory you need.) At least 6 GB of free disk
+space is required (8 GB minimum for building on Solaris).
+
+Even for 32-bit builds, it is recommended to use a 64-bit build machine, and
+instead create a 32-bit target using `--with-target-bits=32`.
+
+### Building on sparc
+
+At a minimum, a machine with 4 cores is advisable, as well as 4 GB of RAM. (The
+more cores to use, the more memory you need.) At least 8 GB of free disk space
+is required.
+
+### Building on arm/aarch64
+
+This is not recommended. Instead, see the section on [Cross-compiling](
+#cross-compiling).
+
+## Operating System Requirements
+
+The mainline OpenJDK project supports Linux, Solaris, macOS, AIX and Windows.
+Support for other operating system, e.g. BSD, exists in separate "port"
+projects.
+
+In general, OpenJDK can be built on a wide range of versions of these operating
+systems, but the further you deviate from what is tested on a daily basis, the
+more likely you are to run into problems.
+
+This table lists the OS versions used by Oracle when building JDK 9. Such
+information is always subject to change, but this table is up to date at the
+time of writing.
+
+ Operating system Vendor/version used
+ ----------------- -------------------------------------------------------
+ Linux Oracle Enterprise Linux 6.4 / 7.1 (using kernel 3.8.13)
+ Solaris Solaris 11.1 SRU 21.4.1 / 11.2 SRU 5.5
+ macOS Mac OS X 10.9 (Mavericks) / 10.10 (Yosemite)
+ Windows Windows Server 2012 R2
-At a minimum, the [Studio 12 Update 4
-Compilers](http://www.oracle.com/technetwork/server-storage/solarisstudio/downloads/index.htm)
-(containing version 5.13 of the C and C++ compilers) is required, including
-specific patches.
+The double version numbers for Linux, Solaris and macOS is due to the hybrid
+model used at Oracle, where header files and external libraries from an older
+version is used when building on a more modern version of the OS.
+
+The Build Group has a wiki page with [Supported Build Platforms](
+https://wiki.openjdk.java.net/display/Build/Supported+Build+Platforms). From
+time to time, this is updated by the community to list successes or failures of
+building on different platforms.
+
+### Windows
+
+Windows XP is not a supported platform, but all newer Windows should be able to
+build OpenJDK.
+
+On Windows, it is important that you pay attention to the instructions in the
+[Special Considerations](#special-considerations).
+
+Windows is the only non-POSIX OS supported by OpenJDK, and as such, requires
+some extra care. A POSIX support layer is required to build on Windows. For
+OpenJDK 9, the only supported such layer is Cygwin. (Msys is no longer
+supported due to a too old bash; msys2 and the new Windows Subsystem for Linux
+(WSL) would likely be possible to support in a future version but that would
+require a community effort to implement.)
+
+Internally in the build system, all paths are represented as Unix-style paths,
+e.g. `/cygdrive/c/hg/jdk9/Makefile` rather than `C:\hg\jdk9\Makefile`. This
+rule also applies to input to the build system, e.g. in arguments to
+`configure`. So, use `--with-freetype=/cygdrive/c/freetype` rather than
+`--with-freetype=c:\freetype`. For details on this conversion, see the section
+on [Fixpath](#fixpath).
+
+#### Cygwin
+
+A functioning [Cygwin](http://www.cygwin.com/) environment is thus required for
+building OpenJDK on Windows. If you have a 64-bit OS, we strongly recommend
+using the 64-bit version of Cygwin.
+
+**Note:** Cygwin has a model of continuously updating all packages without any
+easy way to install or revert to a specific version of a package. This means
+that whenever you add or update a package in Cygwin, you might (inadvertently)
+update tools that are used by the OpenJDK build process, and that can cause
+unexpected build problems.
+
+OpenJDK requires GNU Make 4.0 or greater on Windows. This is usually not a
+problem, since Cygwin currently only distributes GNU Make at a version above
+4.0.
+
+Apart from the basic Cygwin installation, the following packages must also be
+installed:
+
+ * `make`
+ * `zip`
+ * `unzip`
+
+Often, you can install these packages using the following command line:
+```
+<path to Cygwin setup>/setup-x86_64 -q -P make -P unzip -P zip
+```
+
+Unfortunately, Cygwin can be unreliable in certain circumstances. If you
+experience build tool crashes or strange issues when building on Windows,
+please check the Cygwin FAQ on the ["BLODA" list](
+https://cygwin.com/faq/faq.html#faq.using.bloda) and the section on [fork()
+failures](https://cygwin.com/faq/faq.html#faq.using.fixing-fork-failures).
+
+### Solaris
+
+See `make/devkit/solaris11.1-package-list.txt` for a list of recommended
+packages to install when building on Solaris. The versions specified in this
+list is the versions used by the daily builds at Oracle, and is likely to work
+properly.
+
+Older versions of Solaris shipped a broken version of `objcopy`. At least
+version 2.21.1 is needed, which is provided by Solaris 11 Update 1. Objcopy is
+needed if you want to have external debug symbols. Please make sure you are
+using at least version 2.21.1 of objcopy, or that you disable external debug
+symbols.
+
+### macOS
+
+Apple is using a quite aggressive scheme of pushing OS updates, and coupling
+these updates with required updates of Xcode. Unfortunately, this makes it
+difficult for a project like OpenJDK to keep pace with a continuously updated
+machine running macOS. See the section on [Apple Xcode](#apple-xcode) on some
+strategies to deal with this.
+
+It is recommended that you use at least Mac OS X 10.9 (Mavericks). At the time
+of writing, OpenJDK has been successfully compiled on macOS versions up to
+10.12.5 (Sierra), using XCode 8.3.2 and `--disable-warnings-as-errors`.
+
+The standard macOS environment contains the basic tooling needed to build, but
+for external libraries a package manager is recommended. OpenJDK uses
+[homebrew](https://brew.sh/) in the examples, but feel free to use whatever
+manager you want (or none).
+
+### Linux
+
+It is often not much problem to build OpenJDK on Linux. The only general advice
+is to try to use the compilers, external libraries and header files as provided
+by your distribution.
+
+The basic tooling is provided as part of the core operating system, but you
+will most likely need to install developer packages.
+
+For apt-based distributions (Debian, Ubuntu, etc), try this:
+```
+sudo apt-get install build-essential
+```
+
+For rpm-based distributions (Fedora, Red Hat, etc), try this:
+```
+sudo yum groupinstall "Development Tools"
+```
+
+### AIX
+
+The regular builds by SAP is using AIX version 7.1, but AIX 5.3 is also
+supported. See the [OpenJDK PowerPC Port Status Page](
+http://cr.openjdk.java.net/~simonis/ppc-aix-port) for details.
+
+## Native Compiler (Toolchain) Requirements
+
+Large portions of OpenJDK consists of native code, that needs to be compiled to
+be able to run on the target platform. In theory, toolchain and operating
+system should be independent factors, but in practice there's more or less a
+one-to-one correlation between target operating system and toolchain.
+
+ Operating system Supported toolchain
+ ------------------ -------------------------
+ Linux gcc, clang
+ macOS Apple Xcode (using clang)
+ Solaris Oracle Solaris Studio
+ AIX IBM XL C/C++
+ Windows Microsoft Visual Studio
+
+Please see the individual sections on the toolchains for version
+recommendations. As a reference, these versions of the toolchains are used, at
+the time of writing, by Oracle for the daily builds of OpenJDK. It should be
+possible to compile OpenJDK with both older and newer versions, but the closer
+you stay to this list, the more likely you are to compile successfully without
+issues.
+
+ Operating system Toolchain version
+ ------------------ -------------------------------------------------------
+ Linux gcc 4.9.2
+ macOS Apple Xcode 6.3 (using clang 6.1.0)
+ Solaris Oracle Solaris Studio 12.4 (with compiler version 5.13)
+ Windows Microsoft Visual Studio 2013 update 4
+
+### gcc
+
+The minimum accepted version of gcc is 4.3. Older versions will not be accepted
+by `configure`.
+
+However, gcc 4.3 is quite old and OpenJDK is not regularly tested on this
+version, so it is recommended to use a more modern gcc.
+
+OpenJDK 9 includes patches that should allow gcc 6 to compile, but this should
+be considered experimental.
+
+In general, any version between these two should be usable.
+
+### clang
+
+The minimum accepted version of clang is 3.2. Older versions will not be
+accepted by `configure`.
+
+To use clang instead of gcc on Linux, use `--with-toolchain-type=clang`.
+
+### Apple Xcode
+
+The oldest supported version of Xcode is 5.
+
+You will need the Xcode command lines developers tools to be able to build
+OpenJDK. (Actually, *only* the command lines tools are needed, not the IDE.)
+The simplest way to install these is to run:
+```
+xcode-select --install
+```
+
+It is advisable to keep an older version of Xcode for building OpenJDK when
+updating Xcode. This [blog page](
+http://iosdevelopertips.com/xcode/install-multiple-versions-of-xcode.html) has
+good suggestions on managing multiple Xcode versions. To use a specific version
+of Xcode, use `xcode-select -s` before running `configure`, or use
+`--with-toolchain-path` to point to the version of Xcode to use, e.g.
+`configure --with-toolchain-path=/Applications/Xcode5.app/Contents/Developer/usr/bin`
+
+If you have recently (inadvertently) updated your OS and/or Xcode version, and
+OpenJDK can no longer be built, please see the section on [Problems with the
+Build Environment](#problems-with-the-build-environment), and [Getting
+Help](#getting-help) to find out if there are any recent, non-merged patches
+available for this update.
+
+### Oracle Solaris Studio
+
+The minimum accepted version of the Solaris Studio compilers is 5.13
+(corresponding to Solaris Studio 12.4). Older versions will not be accepted by
+configure.
The Solaris Studio installation should contain at least these packages:
- Package Version
- -------------------------------------------------- ---------------
- developer/solarisstudio-124/backend 12.4-1.0.6.0
- developer/solarisstudio-124/c++ 12.4-1.0.10.0
- developer/solarisstudio-124/cc 12.4-1.0.4.0
- developer/solarisstudio-124/library/c++-libs 12.4-1.0.10.0
- developer/solarisstudio-124/library/math-libs 12.4-1.0.0.1
- developer/solarisstudio-124/library/studio-gccrt 12.4-1.0.0.1
- developer/solarisstudio-124/studio-common 12.4-1.0.0.1
- developer/solarisstudio-124/studio-ja 12.4-1.0.0.1
- developer/solarisstudio-124/studio-legal 12.4-1.0.0.1
- developer/solarisstudio-124/studio-zhCN 12.4-1.0.0.1
+ Package Version
+ -------------------------------------------------- -------------
+ developer/solarisstudio-124/backend 12.4-1.0.6.0
+ developer/solarisstudio-124/c++ 12.4-1.0.10.0
+ developer/solarisstudio-124/cc 12.4-1.0.4.0
+ developer/solarisstudio-124/library/c++-libs 12.4-1.0.10.0
+ developer/solarisstudio-124/library/math-libs 12.4-1.0.0.1
+ developer/solarisstudio-124/library/studio-gccrt 12.4-1.0.0.1
+ developer/solarisstudio-124/studio-common 12.4-1.0.0.1
+ developer/solarisstudio-124/studio-ja 12.4-1.0.0.1
+ developer/solarisstudio-124/studio-legal 12.4-1.0.0.1
+ developer/solarisstudio-124/studio-zhCN 12.4-1.0.0.1
+
+Compiling with Solaris Studio can sometimes be finicky. This is the exact
+version used by Oracle, which worked correctly at the time of writing:
+```
+$ cc -V
+cc: Sun C 5.13 SunOS_i386 2014/10/20
+$ CC -V
+CC: Sun C++ 5.13 SunOS_i386 151846-10 2015/10/30
+```
+
+### Microsoft Visual Studio
+
+The minimum accepted version of Visual Studio is 2010. Older versions will not
+be accepted by `configure`. The maximum accepted version of Visual Studio is
+2013.
+
+If you have multiple versions of Visual Studio installed, `configure` will by
+default pick the latest. You can request a specific version to be used by
+setting `--with-toolchain-version`, e.g. `--with-toolchain-version=2010`.
-In particular backend 12.4-1.0.6.0 contains a critical patch for the sparc
-version.
+If you get `LINK: fatal error LNK1123: failure during conversion to COFF: file
+invalid` when building using Visual Studio 2010, you have encountered
+[KB2757355](http://support.microsoft.com/kb/2757355), a bug triggered by a
+specific installation order. However, the solution suggested by the KB article
+does not always resolve the problem. See [this stackoverflow discussion](
+https://stackoverflow.com/questions/10888391) for other suggestions.
-Place the `bin` directory in `PATH`.
+### IBM XL C/C++
+
+The regular builds by SAP is using version 12.1, described as `IBM XL C/C++ for
+AIX, V12.1 (5765-J02, 5725-C72) Version: 12.01.0000.0017`.
+
+See the [OpenJDK PowerPC Port Status Page](
+http://cr.openjdk.java.net/~simonis/ppc-aix-port) for details.
+
+## Boot JDK Requirements
-The Oracle Solaris Studio Express compilers at: [Oracle Solaris Studio Express
-Download
-site](http://www.oracle.com/technetwork/server-storage/solarisstudio/downloads/index-jsp-142582.html)
-are also an option, although these compilers have not been extensively used
-yet.
+Paradoxically, building OpenJDK requires a pre-existing JDK. This is called the
+"boot JDK". The boot JDK does not have to be OpenJDK, though. If you are
+porting OpenJDK to a new platform, chances are that there already exists
+another JDK for that platform that is usable as boot JDK.
-#### Windows
+The rule of thumb is that the boot JDK for building JDK major version *N*
+should be an JDK of major version *N-1*, so for building JDK 9 a JDK 8 would be
+suitable as boot JDK. However, OpenJDK should be able to "build itself", so an
+up-to-date build of the current OpenJDK source is an acceptable alternative. If
+you are following the *N-1* rule, make sure you got the latest update version,
+since JDK 8 GA might not be able to build JDK 9 on all platforms.
-##### Windows Unix Toolkit
+If the Boot JDK is not automatically detected, or the wrong JDK is picked, use
+`--with-boot-jdk` to point to the JDK to use.
+
+### JDK 8 on Linux
+
+On apt-based distros (like Debian and Ubuntu), `sudo apt-get install
+openjdk-8-jdk` is typically enough to install OpenJDK 8. On rpm-based distros
+(like Fedora and Red Hat), try `sudo yum install java-1.8.0-openjdk-devel`.
-Building on Windows requires a Unix-like environment, notably a Unix-like
-shell. There are several such environments available of which
-[Cygwin](http://www.cygwin.com/) and
-[MinGW/MSYS](http://www.mingw.org/wiki/MSYS) are currently supported for the
-OpenJDK build. One of the differences of these systems from standard Windows
-tools is the way they handle Windows path names, particularly path names which
-contain spaces, backslashes as path separators and possibly drive letters.
-Depending on the use case and the specifics of each environment these path
-problems can be solved by a combination of quoting whole paths, translating
-backslashes to forward slashes, escaping backslashes with additional
-backslashes and translating the path names to their ["8.3"
-version](http://en.wikipedia.org/wiki/8.3_filename).
+### JDK 8 on Windows
+
+No pre-compiled binaries of OpenJDK 8 are readily available for Windows at the
+time of writing. An alternative is to download the [Oracle JDK](
+http://www.oracle.com/technetwork/java/javase/downloads). Another is the [Adopt
+OpenJDK Project](https://adoptopenjdk.net/), which publishes experimental
+prebuilt binaries for Windows.
+
+### JDK 8 on macOS
+
+No pre-compiled binaries of OpenJDK 8 are readily available for macOS at the
+time of writing. An alternative is to download the [Oracle JDK](
+http://www.oracle.com/technetwork/java/javase/downloads), or to install it
+using `brew cask install java`. Another option is the [Adopt OpenJDK Project](
+https://adoptopenjdk.net/), which publishes experimental prebuilt binaries for
+macOS.
-###### CYGWIN
+### JDK 8 on AIX
+
+No pre-compiled binaries of OpenJDK 8 are readily available for AIX at the
+time of writing. A starting point for working with OpenJDK on AIX is
+the [PowerPC/AIX Port Project](http://openjdk.java.net/projects/ppc-aix-port/).
+
+## External Library Requirements
+
+Different platforms require different external libraries. In general, libraries
+are not optional - that is, they are either required or not used.
+
+If a required library is not detected by `configure`, you need to provide the
+path to it. There are two forms of the `configure` arguments to point to an
+external library: `--with-<LIB>=<path>` or `--with-<LIB>-include=<path to
+include> --with-<LIB>-lib=<path to lib>`. The first variant is more concise,
+but require the include files an library files to reside in a default hierarchy
+under this directory. In most cases, it works fine.
-CYGWIN is an open source, Linux-like environment which tries to emulate a
-complete POSIX layer on Windows. It tries to be smart about path names and can
-usually handle all kinds of paths if they are correctly quoted or escaped
-although internally it maps drive letters `<drive>:` to a virtual directory
-`/cygdrive/<drive>`.
+As a fallback, the second version allows you to point to the include directory
+and the lib directory separately.
+
+### FreeType
+
+FreeType2 from [The FreeType Project](http://www.freetype.org/) is required on
+all platforms. At least version 2.3 is required.
-You can always use the `cygpath` utility to map pathnames with spaces or the
-backslash character into the `C:/` style of pathname (called 'mixed'), e.g.
-`cygpath -s -m "<path>"`.
+ * To install on an apt-based Linux, try running `sudo apt-get install
+ libcups2-dev`.
+ * To install on an rpm-based Linux, try running `sudo yum install
+ cups-devel`.
+ * To install on Solaris, try running `pkg install system/library/freetype-2`.
+ * To install on macOS, try running `brew install freetype`.
+ * To install on Windows, see [below](#building-freetype-on-windows).
-Note that the use of CYGWIN creates a unique problem with regards to setting
-[`PATH`](#path). Normally on Windows the `PATH` variable contains directories
-separated with the ";" character (Solaris and Linux use ":"). With CYGWIN, it
-uses ":", but that means that paths like "C:/path" cannot be placed in the
-CYGWIN version of `PATH` and instead CYGWIN uses something like
-`/cygdrive/c/path` which CYGWIN understands, but only CYGWIN understands.
+Use `--with-freetype=<path>` if `configure` does not properly locate your
+FreeType files.
+
+#### Building FreeType on Windows
+
+On Windows, there is no readily available compiled version of FreeType. OpenJDK
+can help you compile FreeType from source. Download the FreeType sources and
+unpack them into an arbitrary directory:
-The OpenJDK build requires CYGWIN version 1.7.16 or newer. Information about
-CYGWIN can be obtained from the CYGWIN website at
-[www.cygwin.com](http://www.cygwin.com).
+```
+wget http://download.savannah.gnu.org/releases/freetype/freetype-2.5.3.tar.gz
+tar -xzf freetype-2.5.3.tar.gz
+```
-By default CYGWIN doesn't install all the tools required for building the
-OpenJDK. Along with the default installation, you need to install the following
-tools.
+Then run `configure` with `--with-freetype-src=<freetype_src>`. This will
+automatically build the freetype library into `<freetype_src>/lib64` for 64-bit
+builds or into `<freetype_src>/lib32` for 32-bit builds. Afterwards you can
+always use `--with-freetype-include=<freetype_src>/include` and
+`--with-freetype-lib=<freetype_src>/lib[32|64]` for other builds.
- Binary Name Category Package Description
- ------------- -------------- ---------- ------------------------------------------------------------
- ar.exe Devel binutils The GNU assembler, linker and binary utilities
- make.exe Devel make The GNU version of the 'make' utility built for CYGWIN
- m4.exe Interpreters m4 GNU implementation of the traditional Unix macro processor
- cpio.exe Utils cpio A program to manage archives of files
- gawk.exe Utils awk Pattern-directed scanning and processing language
- file.exe Utils file Determines file type using 'magic' numbers
- zip.exe Archive zip Package and compress (archive) files
- unzip.exe Archive unzip Extract compressed files in a ZIP archive
- free.exe System procps Display amount of free and used memory in the system
+Alternatively you can unpack the sources like this to use the default
+directory:
+
+```
+tar --one-top-level=$HOME/freetype --strip-components=1 -xzf freetype-2.5.3.tar.gz
+```
+
+### CUPS
+
+CUPS, [Common UNIX Printing System](http://www.cups.org) header files are
+required on all platforms, except Windows. Often these files are provided by
+your operating system.
-Note that the CYGWIN software can conflict with other non-CYGWIN software on
-your Windows system. CYGWIN provides a
-[FAQ](http://cygwin.com/faq/faq.using.html) for known issues and problems,
-of particular interest is the section on [BLODA (applications that interfere
-with CYGWIN)](http://cygwin.com/faq/faq.using.html#faq.using.bloda).
+ * To install on an apt-based Linux, try running `sudo apt-get install
+ libcups2-dev`.
+ * To install on an rpm-based Linux, try running `sudo yum install
+ cups-devel`.
+ * To install on Solaris, try running `pkg install print/cups`.
-###### MinGW/MSYS
+Use `--with-cups=<path>` if `configure` does not properly locate your CUPS
+files.
+
+### X11
+
+Certain [X11](http://www.x.org/) libraries and include files are required on
+Linux and Solaris.
-MinGW ("Minimalist GNU for Windows") is a collection of free Windows specific
-header files and import libraries combined with GNU toolsets that allow one to
-produce native Windows programs that do not rely on any 3rd-party C runtime
-DLLs. MSYS is a supplement to MinGW which allows building applications and
-programs which rely on traditional UNIX tools to be present. Among others this
-includes tools like `bash` and `make`. See
-[MinGW/MSYS](http://www.mingw.org/wiki/MSYS) for more information.
+ * To install on an apt-based Linux, try running `sudo apt-get install
+ libx11-dev libxext-dev libxrender-dev libxtst-dev libxt-dev`.
+ * To install on an rpm-based Linux, try running `sudo yum install
+ libXtst-devel libXt-devel libXrender-devel libXi-devel`.
+ * To install on Solaris, try running `pkg install x11/header/x11-protocols
+ x11/library/libice x11/library/libpthread-stubs x11/library/libsm
+ x11/library/libx11 x11/library/libxau x11/library/libxcb
+ x11/library/libxdmcp x11/library/libxevie x11/library/libxext
+ x11/library/libxrender x11/library/libxscrnsaver x11/library/libxtst
+ x11/library/toolkit/libxt`.
+
+Use `--with-x=<path>` if `configure` does not properly locate your X11 files.
+
+### ALSA
+
+ALSA, [Advanced Linux Sound Architecture](https://www.alsa-project.org/) is
+required on Linux. At least version 0.9.1 of ALSA is required.
-Like Cygwin, MinGW/MSYS can handle different types of path formats. They are
-internally converted to paths with forward slashes and drive letters `<drive>:`
-replaced by a virtual directory `/<drive>`. Additionally, MSYS automatically
-detects binaries compiled for the MSYS environment and feeds them with the
-internal, Unix-style path names. If native Windows applications are called from
-within MSYS programs their path arguments are automatically converted back to
-Windows style path names with drive letters and backslashes as path separators.
-This may cause problems for Windows applications which use forward slashes as
-parameter separator (e.g. `cl /nologo /I`) because MSYS may wrongly [replace
-such parameters by drive
-letters](http://mingw.org/wiki/Posix_path_conversion).
+ * To install on an apt-based Linux, try running `sudo apt-get install
+ libasound2-dev`.
+ * To install on an rpm-based Linux, try running `sudo yum install
+ alsa-lib-devel`.
+
+Use `--with-alsa=<path>` if `configure` does not properly locate your ALSA
+files.
+
+### libffi
+
+libffi, the [Portable Foreign Function Interface Library](
+http://sourceware.org/libffi) is required when building the Zero version of
+Hotspot.
+
+ * To install on an apt-based Linux, try running `sudo apt-get install
+ libffi-dev`.
+ * To install on an rpm-based Linux, try running `sudo yum install
+ libffi-devel`.
+
+Use `--with-libffi=<path>` if `configure` does not properly locate your libffi
+files.
+
+### libelf
+
+libelf from the [elfutils project](http://sourceware.org/elfutils) is required
+when building the AOT feature of Hotspot.
-In addition to the tools which will be installed by default, you have to
-manually install the `msys-zip` and `msys-unzip` packages. This can be easily
-done with the MinGW command line installer:
+ * To install on an apt-based Linux, try running `sudo apt-get install
+ libelf-dev`.
+ * To install on an rpm-based Linux, try running `sudo yum install
+ elfutils-libelf-devel`.
- mingw-get.exe install msys-zip
- mingw-get.exe install msys-unzip
+Use `--with-libelf=<path>` if `configure` does not properly locate your libelf
+files.
+
+## Other Tooling Requirements
-##### Visual Studio 2013 Compilers
+### GNU Make
+
+OpenJDK requires [GNU Make](http://www.gnu.org/software/make). No other flavors
+of make are supported.
-The 32-bit and 64-bit OpenJDK Windows build requires Microsoft Visual Studio
-C++ 2013 (VS2013) Professional Edition or Express compiler. The compiler and
-other tools are expected to reside in the location defined by the variable
-`VS120COMNTOOLS` which is set by the Microsoft Visual Studio installer.
+At least version 3.81 of GNU Make must be used. For distributions supporting
+GNU Make 4.0 or above, we strongly recommend it. GNU Make 4.0 contains useful
+functionality to handle parallel building (supported by `--with-output-sync`)
+and speed and stability improvements.
-Only the C++ part of VS2013 is needed. Try to let the installation go to the
-default install directory. Always reboot your system after installing VS2013.
-The system environment variable VS120COMNTOOLS should be set in your
-environment.
+Note that `configure` locates and verifies a properly functioning version of
+`make` and stores the path to this `make` binary in the configuration. If you
+start a build using `make` on the command line, you will be using the version
+of make found first in your `PATH`, and not necessarily the one stored in the
+configuration. This initial make will be used as "bootstrap make", and in a
+second stage, the make located by `configure` will be called. Normally, this
+will present no issues, but if you have a very old `make`, or a non-GNU Make
+`make` in your path, this might cause issues.
+
+If you want to override the default make found by `configure`, use the `MAKE`
+configure variable, e.g. `configure MAKE=/opt/gnu/make`.
+
+On Solaris, it is common to call the GNU version of make by using `gmake`.
+
+### GNU Bash
-Make sure that TMP and TEMP are also set in the environment and refer to
-Windows paths that exist, like `C:\temp`, not `/tmp`, not `/cygdrive/c/temp`,
-and not `C:/temp`. `C:\temp` is just an example, it is assumed that this area
-is private to the user, so by default after installs you should see a unique
-user path in these variables.
+OpenJDK requires [GNU Bash](http://www.gnu.org/software/bash). No other shells
+are supported.
+
+At least version 3.2 of GNU Bash must be used.
+
+### Autoconf
-#### Mac OS X
+If you want to modify the build system itself, you need to install [Autoconf](
+http://www.gnu.org/software/autoconf).
-Make sure you get the right XCode version.
+However, if you only need to build OpenJDK or if you only edit the actual
+OpenJDK source files, there is no dependency on autoconf, since the source
+distribution includes a pre-generated `configure` shell script.
+
+See the section on [Autoconf Details](#autoconf-details) for details on how
+OpenJDK uses autoconf. This is especially important if you plan to contribute
+changes to OpenJDK that modifies the build system.
--------------------------------------------------------------------------------
+## Running Configure
-### Configure
+To build OpenJDK, you need a "configuration", which consists of a directory
+where to store the build output, coupled with information about the platform,
+the specific build machine, and choices that affect how OpenJDK is built.
-The basic invocation of the `configure` script looks like:
+The configuration is created by the `configure` script. The basic invocation of
+the `configure` script looks like this:
-> **`bash ./configure [options]`**
+```
+bash configure [options]
+```
-This will create an output directory containing the "configuration" and setup
-an area for the build result. This directory typically looks like:
-
-> **`build/linux-x64-normal-server-release`**
+This will create an output directory containing the configuration and setup an
+area for the build result. This directory typically looks like
+`build/linux-x64-normal-server-release`, but the actual name depends on your
+specific configuration. (It can also be set directly, see [Using Multiple
+Configurations](#using-multiple-configurations)). This directory is referred to
+as `$BUILD` in this documentation.
`configure` will try to figure out what system you are running on and where all
necessary build components are. If you have all prerequisites for building
installed, it should find everything. If it fails to detect any component
-automatically, it will exit and inform you about the problem. When this
-happens, read more below in [the `configure` options](#configureoptions).
+automatically, it will exit and inform you about the problem.
-Some examples:
-
-> **Windows 32bit build with freetype specified:** \
-> `bash ./configure --with-freetype=/cygdrive/c/freetype-i586 --with-target-bits=32`
+Some command line examples:
-> **Debug 64bit Build:** \
-> `bash ./configure --enable-debug --with-target-bits=64`
+ * Create a 32-bit build for Windows with FreeType2 in `C:\freetype-i586`:
+ ```
+ bash configure --with-freetype=/cygdrive/c/freetype-i586 --with-target-bits=32
+ ```
-#### Configure Options
-
-Complete details on all the OpenJDK `configure` options can be seen with:
-
-> **`bash ./configure --help=short`**
+ * Create a debug build with the `server` JVM and DTrace enabled:
+ ```
+ bash configure --enable-debug --with-jvm-variants=server --enable-dtrace
+ ```
-Use `-help` to see all the `configure` options available. You can generate any
-number of different configurations, e.g. debug, release, 32, 64, etc.
+### Common Configure Arguments
-Some of the more commonly used `configure` options are:
-
-> **`--enable-debug`** \
-> set the debug level to fastdebug (this is a shorthand for
-> `--with-debug-level=fastdebug`)
+Here follows some of the most common and important `configure` argument.
-<a name="alsa"></a>
-
-> **`--with-alsa=`**_path_ \
-> select the location of the Advanced Linux Sound Architecture (ALSA)
+To get up-to-date information on *all* available `configure` argument, please
+run:
+```
+bash configure --help
+```
-> Version 0.9.1 or newer of the ALSA files are required for building the
- OpenJDK on Linux. These Linux files are usually available from an "alsa" of
- "libasound" development package, and it's highly recommended that you try
- and use the package provided by the particular version of Linux that you are
- using.
+(Note that this help text also include general autoconf options, like
+`--dvidir`, that is not relevant to OpenJDK. To list only OpenJDK specific
+features, use `bash configure --help=short` instead.)
+
+#### Configure Arguments for Tailoring the Build
-> **`--with-boot-jdk=`**_path_ \
-> select the [Bootstrap JDK](#bootjdk)
+ * `--enable-debug` - Set the debug level to `fastdebug` (this is a shorthand
+ for `--with-debug-level=fastdebug`)
+ * `--with-debug-level=<level>` - Set the debug level, which can be `release`,
+ `fastdebug`, `slowdebug` or `optimized`. Default is `release`. `optimized`
+ is variant of `release` with additional Hotspot debug code.
+ * `--with-native-debug-symbols=<method>` - Specify if and how native debug
+ symbols should be built. Available methods are `none`, `internal`,
+ `external`, `zipped`. Default behavior depends on platform. See [Native
+ Debug Symbols](#native-debug-symbols) for more details.
+ * `--with-version-string=<string>` - Specify the version string this build
+ will be identified with.
+ * `--with-version-<part>=<value>` - A group of options, where `<part>` can be
+ any of `pre`, `opt`, `build`, `major`, `minor`, `security` or `patch`. Use
+ these options to modify just the corresponding part of the version string
+ from the default, or the value provided by `--with-version-string`.
+ * `--with-jvm-variants=<variant>[,<variant>...]` - Build the specified variant
+ (or variants) of Hotspot. Valid variants are: `server`, `client`,
+ `minimal`, `core`, `zero`, `zeroshark`, `custom`. Note that not all
+ variants are possible to combine in a single build.
+ * `--with-jvm-features=<feature>[,<feature>...]` - Use the specified JVM
+ features when building Hotspot. The list of features will be enabled on top
+ of the default list. For the `custom` JVM variant, this default list is
+ empty. A complete list of available JVM features can be found using `bash
+ configure --help`.
+ * `--with-target-bits=<bits>` - Create a target binary suitable for running
+ on a `<bits>` platform. Use this to create 32-bit output on a 64-bit build
+ platform, instead of doing a full cross-compile. (This is known as a
+ *reduced* build.)
-> **`--with-boot-jdk-jvmargs=`**"_args_" \
-> provide the JVM options to be used to run the [Bootstrap JDK](#bootjdk)
-
-> **`--with-cacerts=`**_path_ \
-> select the path to the cacerts file.
+#### Configure Arguments for Native Compilation
-> See [Certificate Authority on
- Wikipedia](http://en.wikipedia.org/wiki/Certificate_Authority) for a
- better understanding of the Certificate Authority (CA). A certificates file
- named "cacerts" represents a system-wide keystore with CA certificates. In
- JDK and JRE binary bundles, the "cacerts" file contains root CA certificates
- from several public CAs (e.g., VeriSign, Thawte, and Baltimore). The source
- contain a cacerts file without CA root certificates. Formal JDK builders will
- need to secure permission from each public CA and include the certificates
- into their own custom cacerts file. Failure to provide a populated cacerts
- file will result in verification errors of a certificate chain during
- runtime. By default an empty cacerts file is provided and that should be fine
- for most JDK developers.
+ * `--with-devkit=<path>` - Use this devkit for compilers, tools and resources
+ * `--with-sysroot=<path>` - Use this directory as sysroot
+ * `--with-extra-path=<path>[;<path>]` - Prepend these directories to the
+ default path when searching for all kinds of binaries
+ * `--with-toolchain-path=<path>[;<path>]` - Prepend these directories when
+ searching for toolchain binaries (compilers etc)
+ * `--with-extra-cflags=<flags>` - Append these flags when compiling JDK C
+ files
+ * `--with-extra-cxxflags=<flags>` - Append these flags when compiling JDK C++
+ files
+ * `--with-extra-ldflags=<flags>` - Append these flags when linking JDK
+ libraries
-<a name="cups"></a>
+#### Configure Arguments for External Dependencies
-> **`--with-cups=`**_path_ \
-> select the CUPS install location
-
-> The Common UNIX Printing System (CUPS) Headers are required for building the
- OpenJDK on Solaris and Linux. The Solaris header files can be obtained by
- installing the package **print/cups**.
+ * `--with-boot-jdk=<path>` - Set the path to the [Boot JDK](
+ #boot-jdk-requirements)
+ * `--with-freetype=<path>` - Set the path to [FreeType](#freetype)
+ * `--with-cups=<path>` - Set the path to [CUPS](#cups)
+ * `--with-x=<path>` - Set the path to [X11](#x11)
+ * `--with-alsa=<path>` - Set the path to [ALSA](#alsa)
+ * `--with-libffi=<path>` - Set the path to [libffi](#libffi)
+ * `--with-libelf=<path>` - Set the path to [libelf](#libelf)
+ * `--with-jtreg=<path>` - Set the path to JTReg. See [Running Tests](
+ #running-tests)
-> The CUPS header files can always be downloaded from
- [www.cups.org](http://www.cups.org).
+Certain third-party libraries used by OpenJDK (libjpeg, giflib, libpng, lcms
+and zlib) are included in the OpenJDK repository. The default behavior of the
+OpenJDK build is to use this version of these libraries, but they might be
+replaced by an external version. To do so, specify `system` as the `<source>`
+option in these arguments. (The default is `bundled`).
-> **`--with-cups-include=`**_path_ \
-> select the CUPS include directory location
+ * `--with-libjpeg=<source>` - Use the specified source for libjpeg
+ * `--with-giflib=<source>` - Use the specified source for giflib
+ * `--with-libpng=<source>` - Use the specified source for libpng
+ * `--with-lcms=<source>` - Use the specified source for lcms
+ * `--with-zlib=<source>` - Use the specified source for zlib
-> **`--with-debug-level=`**_level_ \
-> select the debug information level of release, fastdebug, or slowdebug
+On Linux, it is possible to select either static or dynamic linking of the C++
+runtime. The default is static linking, with dynamic linking as fallback if the
+static library is not found.
+
+ * `--with-stdc++lib=<method>` - Use the specified method (`static`, `dynamic`
+ or `default`) for linking the C++ runtime.
+
+### Configure Control Variables
-> **`--with-dev-kit=`**_path_ \
-> select location of the compiler install or developer install location
+It is possible to control certain aspects of `configure` by overriding the
+value of `configure` variables, either on the command line or in the
+environment.
-<a name="freetype"></a>
-
-> **`--with-freetype=`**_path_ \
-> select the freetype files to use.
+Normally, this is **not recommended**. If used improperly, it can lead to a
+broken configuration. Unless you're well versed in the build system, this is
+hard to use properly. Therefore, `configure` will print a warning if this is
+detected.
-> Expecting the freetype libraries under `lib/` and the headers under
- `include/`.
+However, there are a few `configure` variables, known as *control variables*
+that are supposed to be overriden on the command line. These are variables that
+describe the location of tools needed by the build, like `MAKE` or `GREP`. If
+any such variable is specified, `configure` will use that value instead of
+trying to autodetect the tool. For instance, `bash configure
+MAKE=/opt/gnumake4.0/bin/make`.
-> Version 2.3 or newer of FreeType is required. On Unix systems required files
- can be available as part of your distribution (while you still may need to
- upgrade them). Note that you need development version of package that
- includes both the FreeType library and header files.
+If a configure argument exists, use that instead, e.g. use `--with-jtreg`
+instead of setting `JTREGEXE`.
+
+Also note that, despite what autoconf claims, setting `CFLAGS` will not
+accomplish anything. Instead use `--with-extra-cflags` (and similar for
+`cxxflags` and `ldflags`).
+
+## Running Make
-> You can always download latest FreeType version from the [FreeType
- website](http://www.freetype.org). Building the freetype 2 libraries from
- scratch is also possible, however on Windows refer to the [Windows FreeType
- DLL build instructions](http://freetype.freedesktop.org/wiki/FreeType_DLL).
+When you have a proper configuration, all you need to do to build OpenJDK is to
+run `make`. (But see the warning at [GNU Make](#gnu-make) about running the
+correct version of make.)
-> Note that by default FreeType is built with byte code hinting support
- disabled due to licensing restrictions. In this case, text appearance and
- metrics are expected to differ from Sun's official JDK build. See the
- [SourceForge FreeType2 Home Page](http://freetype.sourceforge.net/freetype2)
- for more information.
+When running `make` without any arguments, the default target is used, which is
+the same as running `make default` or `make jdk`. This will build a minimal (or
+roughly minimal) set of compiled output (known as an "exploded image") needed
+for a developer to actually execute the newly built JDK. The idea is that in an
+incremental development fashion, when doing a normal make, you should only
+spend time recompiling what's changed (making it purely incremental) and only
+do the work that's needed to actually run and test your code.
+
+The output of the exploded image resides in `$BUILD/jdk`. You can test the
+newly built JDK like this: `$BUILD/jdk/bin/java -version`.
-> **`--with-import-hotspot=`**_path_ \
-> select the location to find hotspot binaries from a previous build to avoid
- building hotspot
+### Common Make Targets
-> **`--with-target-bits=`**_arg_ \
-> select 32 or 64 bit build
+Apart from the default target, here are some common make targets:
-> **`--with-jvm-variants=`**_variants_ \
-> select the JVM variants to build from, comma separated list that can
- include: server, client, kernel, zero and zeroshark
-
-> **`--with-memory-size=`**_size_ \
-> select the RAM size that GNU make will think this system has
+ * `hotspot` - Build all of hotspot (but only hotspot)
+ * `hotspot-<variant>` - Build just the specified jvm variant
+ * `images` or `product-images` - Build the JRE and JDK images
+ * `docs` or `docs-image` - Build the documentation image
+ * `test-image` - Build the test image
+ * `all` or `all-images` - Build all images (product, docs and test)
+ * `bootcycle-images` - Build images twice, second time with newly built JDK
+ (good for testing)
+ * `clean` - Remove all files generated by make, but not those generated by
+ configure
+ * `dist-clean` - Remove all files, including configuration
-> **`--with-msvcr-dll=`**_path_ \
-> select the `msvcr100.dll` file to include in the Windows builds (C/C++
- runtime library for Visual Studio).
+Run `make help` to get an up-to-date list of important make targets and make
+control variables.
-> This is usually picked up automatically from the redist directories of
- Visual Studio 2013.
+It is possible to build just a single module, a single phase, or a single phase
+of a single module, by creating make targets according to these followin
+patterns. A phase can be either of `gensrc`, `gendata`, `copy`, `java`,
+`launchers`, `libs` or `rmic`. See [Using Fine-Grained Make Targets](
+#using-fine-grained-make-targets) for more details about this functionality.
+
+ * `<phase>` - Build the specified phase and everything it depends on
+ * `<module>` - Build the specified module and everything it depends on
+ * `<module>-<phase>` - Compile the specified phase for the specified module
+ and everything it depends on
-> **`--with-num-cores=`**_cores_ \
-> select the number of cores to use (processor count or CPU count)
+Similarly, it is possible to clean just a part of the build by creating make
+targets according to these patterns:
-<a name="xrender"></a>
+ * `clean-<outputdir>` - Remove the subdir in the output dir with the name
+ * `clean-<phase>` - Remove all build results related to a certain build
+ phase
+ * `clean-<module>` - Remove all build results related to a certain module
+ * `clean-<module>-<phase>` - Remove all build results related to a certain
+ module and phase
-> **`--with-x=`**_path_ \
-> select the location of the X11 and xrender files.
+### Make Control Variables
+
+It is possible to control `make` behavior by overriding the value of `make`
+variables, either on the command line or in the environment.
-> The XRender Extension Headers are required for building the OpenJDK on
- Solaris and Linux. The Linux header files are usually available from a
- "Xrender" development package, it's recommended that you try and use the
- package provided by the particular distribution of Linux that you are using.
- The Solaris XRender header files is included with the other X11 header files
- in the package **SFWxwinc** on new enough versions of Solaris and will be
- installed in `/usr/X11/include/X11/extensions/Xrender.h` or
- `/usr/openwin/share/include/X11/extensions/Xrender.h`
+Normally, this is **not recommended**. If used improperly, it can lead to a
+broken build. Unless you're well versed in the build system, this is hard to
+use properly. Therefore, `make` will print a warning if this is detected.
--------------------------------------------------------------------------------
+However, there are a few `make` variables, known as *control variables* that
+are supposed to be overriden on the command line. These make up the "make time"
+configuration, as opposed to the "configure time" configuration.
-### Make
+#### General Make Control Variables
-The basic invocation of the `make` utility looks like:
+ * `JOBS` - Specify the number of jobs to build with. See [Build
+ Performance](#build-performance).
+ * `LOG` - Specify the logging level and functionality. See [Checking the
+ Build Log File](#checking-the-build-log-file)
+ * `CONF` and `CONF_NAME` - Selecting the configuration(s) to use. See [Using
+ Multiple Configurations](#using-multiple-configurations)
-> **`make all`**
+#### Test Make Control Variables
-This will start the build to the output directory containing the
-"configuration" that was created by the `configure` script. Run `make help` for
-more information on the available targets.
+These make control variables only make sense when running tests. Please see
+[Testing OpenJDK](testing.html) for details.
-There are some of the make targets that are of general interest:
+ * `TEST`
+ * `TEST_JOBS`
+ * `JTREG`
+ * `GTEST`
-> _empty_ \
-> build everything but no images
+#### Advanced Make Control Variables
-> **`all`** \
-> build everything including images
+These advanced make control variables can be potentially unsafe. See [Hints and
+Suggestions for Advanced Users](#hints-and-suggestions-for-advanced-users) and
+[Understanding the Build System](#understanding-the-build-system) for details.
-> **`all-conf`** \
-> build all configurations
+ * `SPEC`
+ * `CONF_CHECK`
+ * `COMPARE_BUILD`
+ * `JDK_FILTER`
-> **`images`** \
-> create complete j2sdk and j2re images
+## Running Tests
-> **`install`** \
-> install the generated images locally, typically in `/usr/local`
+Most of the OpenJDK tests are using the [JTReg](http://openjdk.java.net/jtreg)
+test framework. Make sure that your configuration knows where to find your
+installation of JTReg. If this is not picked up automatically, use the
+`--with-jtreg=<path to jtreg home>` option to point to the JTReg framework.
+Note that this option should point to the JTReg home, i.e. the top directory,
+containing `lib/jtreg.jar` etc.
-> **`clean`** \
-> remove all files generated by make, but not those generated by `configure`
+To execute the most basic tests (tier 1), use:
+```
+make run-test-tier1
+```
-> **`dist-clean`** \
-> remove all files generated by both and `configure` (basically killing the
- configuration)
+For more details on how to run tests, please see the [Testing
+OpenJDK](testing.html) document.
-> **`help`** \
-> give some help on using `make`, including some interesting make targets
+## Cross-compiling
+
+Cross-compiling means using one platform (the *build* platform) to generate
+output that can ran on another platform (the *target* platform).
--------------------------------------------------------------------------------
-
-## Testing
+The typical reason for cross-compiling is that the build is performed on a more
+powerful desktop computer, but the resulting binaries will be able to run on a
+different, typically low-performing system. Most of the complications that
+arise when building for embedded is due to this separation of *build* and
+*target* systems.
-When the build is completed, you should see the generated binaries and
-associated files in the `j2sdk-image` directory in the output directory. In
-particular, the `build/*/images/j2sdk-image/bin` directory should contain
-executables for the OpenJDK tools and utilities for that configuration. The
-testing tool `jtreg` will be needed and can be found at: [the jtreg
-site](http://openjdk.java.net/jtreg/). The provided regression tests in the
-repositories can be run with the command:
+This requires a more complex setup and build procedure. This section assumes
+you are familiar with cross-compiling in general, and will only deal with the
+particularities of cross-compiling OpenJDK. If you are new to cross-compiling,
+please see the [external links at Wikipedia](
+https://en.wikipedia.org/wiki/Cross_compiler#External_links) for a good start
+on reading materials.
-> **``cd test && make PRODUCT_HOME=`pwd`/../build/*/images/j2sdk-image all``**
+Cross-compiling OpenJDK requires you to be able to build both for the build
+platform and for the target platform. The reason for the former is that we need
+to build and execute tools during the build process, both native tools and Java
+tools.
--------------------------------------------------------------------------------
+If all you want to do is to compile a 32-bit version, for the same OS, on a
+64-bit machine, consider using `--with-target-bits=32` instead of doing a
+full-blown cross-compilation. (While this surely is possible, it's a lot more
+work and will take much longer to build.)
-## Appendix A: Hints and Tips
+### Boot JDK and Build JDK
-### FAQ
+When cross-compiling, make sure you use a boot JDK that runs on the *build*
+system, and not on the *target* system.
-**Q:** The `generated-configure.sh` file looks horrible! How are you going to
-edit it? \
-**A:** The `generated-configure.sh` file is generated (think "compiled") by the
-autoconf tools. The source code is in `configure.ac` and various .m4 files in
-common/autoconf, which are much more readable.
+To be able to build, we need a "Build JDK", which is a JDK built from the
+current sources (that is, the same as the end result of the entire build
+process), but able to run on the *build* system, and not the *target* system.
+(In contrast, the Boot JDK should be from an older release, e.g. JDK 8 when
+building JDK 9.)
-**Q:** Why is the `generated-configure.sh` file checked in, if it is
-generated? \
-**A:** If it was not generated, every user would need to have the autoconf
-tools installed, and re-generate the `configure` file as the first step. Our
-goal is to minimize the work needed to be done by the user to start building
-OpenJDK, and to minimize the number of external dependencies required.
+The build process will create a minimal Build JDK for you, as part of building.
+To speed up the build, you can use `--with-build-jdk` to `configure` to point
+to a pre-built Build JDK. Please note that the build result is unpredictable,
+and can possibly break in subtle ways, if the Build JDK does not **exactly**
+match the current sources.
+
+### Specifying the Target Platform
-**Q:** Do you require a specific version of autoconf for regenerating
-`generated-configure.sh`? \
-**A:** Yes, version 2.69 is required and should be easy enough to aquire on all
-supported operating systems. The reason for this is to avoid large spurious
-changes in `generated-configure.sh`.
+You *must* specify the target platform when cross-compiling. Doing so will also
+automatically turn the build into a cross-compiling mode. The simplest way to
+do this is to use the `--openjdk-target` argument, e.g.
+`--openjdk-target=arm-linux-gnueabihf`. or `--openjdk-target=aarch64-oe-linux`.
+This will automatically set the `--build`, `--host` and `--target` options for
+autoconf, which can otherwise be confusing. (In autoconf terminology, the
+"target" is known as "host", and "target" is used for building a Canadian
+cross-compiler.)
+
+### Toolchain Considerations
-**Q:** How do you regenerate `generated-configure.sh` after making changes to
-the input files? \
-**A:** Regnerating `generated-configure.sh` should always be done using the
-script `common/autoconf/autogen.sh` to ensure that the correct files get
-updated. This script should also be run after mercurial tries to merge
-`generated-configure.sh` as a merge of the generated file is not guaranteed to
-be correct.
+You will need two copies of your toolchain, one which generates output that can
+run on the target system (the normal, or *target*, toolchain), and one that
+generates output that can run on the build system (the *build* toolchain). Note
+that cross-compiling is only supported for gcc at the time being. The gcc
+standard is to prefix cross-compiling toolchains with the target denominator.
+If you follow this standard, `configure` is likely to pick up the toolchain
+correctly.
-**Q:** What are the files in `common/makefiles/support/*` for? They look like
-gibberish. \
-**A:** They are a somewhat ugly hack to compensate for command line length
-limitations on certain platforms (Windows, Solaris). Due to a combination of
-limitations in make and the shell, command lines containing too many files will
-not work properly. These helper files are part of an elaborate hack that will
-compress the command line in the makefile and then uncompress it safely. We're
-not proud of it, but it does fix the problem. If you have any better
-suggestions, we're all ears! :-)
+The *build* toolchain will be autodetected just the same way the normal
+*build*/*target* toolchain will be autodetected when not cross-compiling. If
+this is not what you want, or if the autodetection fails, you can specify a
+devkit containing the *build* toolchain using `--with-build-devkit` to
+`configure`, or by giving `BUILD_CC` and `BUILD_CXX` arguments.
+
+It is often helpful to locate the cross-compilation tools, headers and
+libraries in a separate directory, outside the normal path, and point out that
+directory to `configure`. Do this by setting the sysroot (`--with-sysroot`) and
+appending the directory when searching for cross-compilations tools
+(`--with-toolchain-path`). As a compact form, you can also use `--with-devkit`
+to point to a single directory, if it is correctly setup. (See `basics.m4` for
+details.)
+
+If you are unsure what toolchain and versions to use, these have been proved
+working at the time of writing:
-**Q:** I want to see the output of the commands that make runs, like in the old
-build. How do I do that? \
-**A:** You specify the `LOG` variable to make. There are several log levels:
+ * [aarch64](
+https://releases.linaro.org/archive/13.11/components/toolchain/binaries/gcc-linaro-aarch64-linux-gnu-4.8-2013.11_linux.tar.xz)
+ * [arm 32-bit hardware floating point](
+https://launchpad.net/linaro-toolchain-unsupported/trunk/2012.09/+download/gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux.tar.bz2)
+
+### Native Libraries
+
+You will need copies of external native libraries for the *target* system,
+present on the *build* machine while building.
- * **`warn`** -- Default and very quiet.
- * **`info`** -- Shows more progress information than warn.
- * **`debug`** -- Echos all command lines and prints all macro calls for
- compilation definitions.
- * **`trace`** -- Echos all \$(shell) command lines as well.
+Take care not to replace the *build* system's version of these libraries by
+mistake, since that can render the *build* machine unusable.
-**Q:** When do I have to re-run `configure`? \
-**A:** Normally you will run `configure` only once for creating a
-configuration. You need to re-run configuration only if you want to change any
-configuration options, or if you pull down changes to the `configure` script.
+Make sure that the libraries you point to (ALSA, X11, etc) are for the
+*target*, not the *build*, platform.
+
+#### ALSA
+
+You will need alsa libraries suitable for your *target* system. For most cases,
+using Debian's pre-built libraries work fine.
-**Q:** I have added a new source file. Do I need to modify the makefiles? \
-**A:** Normally, no. If you want to create e.g. a new native library, you will
-need to modify the makefiles. But for normal file additions or removals, no
-changes are needed. There are certan exceptions for some native libraries where
-the source files are spread over many directories which also contain sources
-for other libraries. In these cases it was simply easier to create include
-lists rather than excludes.
+Note that alsa is needed even if you only want to build a headless JDK.
+
+ * Go to [Debian Package Search](https://www.debian.org/distrib/packages) and
+ search for the `libasound2` and `libasound2-dev` packages for your *target*
+ system. Download them to /tmp.
-**Q:** When I run `configure --help`, I see many strange options, like
-`--dvidir`. What is this? \
-**A:** Configure provides a slew of options by default, to all projects that
-use autoconf. Most of them are not used in OpenJDK, so you can safely ignore
-them. To list only OpenJDK specific features, use `configure --help=short`
-instead.
+ * Install the libraries into the cross-compilation toolchain. For instance:
+```
+cd /tools/gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux/arm-linux-gnueabihf/libc
+dpkg-deb -x /tmp/libasound2_1.0.25-4_armhf.deb .
+dpkg-deb -x /tmp/libasound2-dev_1.0.25-4_armhf.deb .
+```
-**Q:** `configure` provides OpenJDK-specific features such as
-`--with-builddeps-server` that are not described in this document. What about
-those? \
-**A:** Try them out if you like! But be aware that most of these are
-experimental features. Many of them don't do anything at all at the moment; the
-option is just a placeholder. Others depend on pieces of code or infrastructure
-that is currently not ready for prime time.
+ * If alsa is not properly detected by `configure`, you can point it out by
+ `--with-alsa`.
+
+#### X11
+
+You will need X11 libraries suitable for your *target* system. For most cases,
+using Debian's pre-built libraries work fine.
+
+Note that X11 is needed even if you only want to build a headless JDK.
-**Q:** How will you make sure you don't break anything? \
-**A:** We have a script that compares the result of the new build system with
-the result of the old. For most part, we aim for (and achieve) byte-by-byte
-identical output. There are however technical issues with e.g. native binaries,
-which might differ in a byte-by-byte comparison, even when building twice with
-the old build system. For these, we compare relevant aspects (e.g. the symbol
-table and file size). Note that we still don't have 100% equivalence, but we're
-close.
+ * Go to [Debian Package Search](https://www.debian.org/distrib/packages),
+ search for the following packages for your *target* system, and download them
+ to /tmp/target-x11:
+ * libxi
+ * libxi-dev
+ * x11proto-core-dev
+ * x11proto-input-dev
+ * x11proto-kb-dev
+ * x11proto-render-dev
+ * x11proto-xext-dev
+ * libice-dev
+ * libxrender
+ * libxrender-dev
+ * libsm-dev
+ * libxt-dev
+ * libx11
+ * libx11-dev
+ * libxtst
+ * libxtst-dev
+ * libxext
+ * libxext-dev
-**Q:** I noticed this thing X in the build that looks very broken by design.
-Why don't you fix it? \
-**A:** Our goal is to produce a build output that is as close as technically
-possible to the old build output. If things were weird in the old build, they
-will be weird in the new build. Often, things were weird before due to
-obscurity, but in the new build system the weird stuff comes up to the surface.
-The plan is to attack these things at a later stage, after the new build system
-is established.
+ * Install the libraries into the cross-compilation toolchain. For instance:
+ ```
+ cd /tools/gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux/arm-linux-gnueabihf/libc/usr
+ mkdir X11R6
+ cd X11R6
+ for deb in /tmp/target-x11/*.deb ; do dpkg-deb -x $deb . ; done
+ mv usr/* .
+ cd lib
+ cp arm-linux-gnueabihf/* .
+ ```
-**Q:** The code in the new build system is not that well-structured. Will you
-fix this? \
-**A:** Yes! The new build system has grown bit by bit as we converted the old
-system. When all of the old build system is converted, we can take a step back
-and clean up the structure of the new build system. Some of this we plan to do
-before replacing the old build system and some will need to wait until after.
+ You can ignore the following messages. These libraries are not needed to
+ successfully complete a full JDK build.
+ ```
+ cp: cannot stat `arm-linux-gnueabihf/libICE.so': No such file or directory
+ cp: cannot stat `arm-linux-gnueabihf/libSM.so': No such file or directory
+ cp: cannot stat `arm-linux-gnueabihf/libXt.so': No such file or directory
+ ```
+
+ * If the X11 libraries are not properly detected by `configure`, you can
+ point them out by `--with-x`.
+
+### Building for ARM/aarch64
+
+A common cross-compilation target is the ARM CPU. When building for ARM, it is
+useful to set the ABI profile. A number of pre-defined ABI profiles are
+available using `--with-abi-profile`: arm-vfp-sflt, arm-vfp-hflt, arm-sflt,
+armv5-vfp-sflt, armv6-vfp-hflt. Note that soft-float ABIs are no longer
+properly supported on OpenJDK.
-**Q:** Is anything able to use the results of the new build's default make
-target? \
-**A:** Yes, this is the minimal (or roughly minimal) set of compiled output
-needed for a developer to actually execute the newly built JDK. The idea is
-that in an incremental development fashion, when doing a normal make, you
-should only spend time recompiling what's changed (making it purely
-incremental) and only do the work that's needed to actually run and test your
-code. The packaging stuff that is part of the `images` target is not needed for
-a normal developer who wants to test his new code. Even if it's quite fast,
-it's still unnecessary. We're targeting sub-second incremental rebuilds! ;-)
-(Or, well, at least single-digit seconds...)
+OpenJDK contains two different ports for the aarch64 platform, one is the
+original aarch64 port from the [AArch64 Port Project](
+http://openjdk.java.net/projects/aarch64-port) and one is a 64-bit version of
+the Oracle contributed ARM port. When targeting aarch64, by the default the
+original aarch64 port is used. To select the Oracle ARM 64 port, use
+`--with-cpu-port=arm64`. Also set the corresponding value (`aarch64` or
+`arm64`) to --with-abi-profile, to ensure a consistent build.
+
+### Verifying the Build
-**Q:** I usually set a specific environment variable when building, but I can't
-find the equivalent in the new build. What should I do? \
-**A:** It might very well be that we have neglected to add support for an
-option that was actually used from outside the build system. Email us and we
-will add support for it!
+The build will end up in a directory named like
+`build/linux-arm-normal-server-release`.
-### Build Performance Tips
+Inside this build output directory, the `images/jdk` and `images/jre` will
+contain the newly built JDK and JRE, respectively, for your *target* system.
+
+Copy these folders to your *target* system. Then you can run e.g.
+`images/jdk/bin/java -version`.
+
+## Build Performance
Building OpenJDK requires a lot of horsepower. Some of the build tools can be
adjusted to utilize more or less of resources such as parallel threads and
@@ -718,398 +1188,696 @@
problems, such as out of memory conditions, you can modify the detected values
with:
- * **`--with-num-cores`** -- number of cores in the build system, e.g.
- `--with-num-cores=8`
- * **`--with-memory-size`** -- memory (in MB) available in the build system,
- e.g. `--with-memory-size=1024`
+ * `--with-num-cores` -- number of cores in the build system, e.g.
+ `--with-num-cores=8`.
+
+ * `--with-memory-size` -- memory (in MB) available in the build system, e.g.
+ `--with-memory-size=1024`
-It might also be necessary to specify the JVM arguments passed to the Bootstrap
-JDK, using e.g. `--with-boot-jdk-jvmargs="-Xmx8G -enableassertions"`. Doing
-this will override the default JVM arguments passed to the Bootstrap JDK.
+You can also specify directly the number of build jobs to use with
+`--with-jobs=N` to `configure`, or `JOBS=N` to `make`. Do not use the `-j` flag
+to `make`. In most cases it will be ignored by the makefiles, but it can cause
+problems for some make targets.
-One of the top goals of the new build system is to improve the build
-performance and decrease the time needed to build. This will soon also apply to
-the java compilation when the Smart Javac wrapper is fully supported.
+It might also be necessary to specify the JVM arguments passed to the Boot JDK,
+using e.g. `--with-boot-jdk-jvmargs="-Xmx8G"`. Doing so will override the
+default JVM arguments passed to the Boot JDK.
At the end of a successful execution of `configure`, you will get a performance
summary, indicating how well the build will perform. Here you will also get
performance hints. If you want to build fast, pay attention to those!
-#### Building with ccache
+If you want to tweak build performance, run with `make LOG=info` to get a build
+time summary at the end of the build process.
+
+### Disk Speed
+
+If you are using network shares, e.g. via NFS, for your source code, make sure
+the build directory is situated on local disk (e.g. by `ln -s
+/localdisk/jdk-build $JDK-SHARE/build`). The performance penalty is extremely
+high for building on a network share; close to unusable.
+
+Also, make sure that your build tools (including Boot JDK and toolchain) is
+located on a local disk and not a network share.
+
+As has been stressed elsewhere, do use SSD for source code and build directory,
+as well as (if possible) the build tools.
+
+### Virus Checking
+
+The use of virus checking software, especially on Windows, can *significantly*
+slow down building of OpenJDK. If possible, turn off such software, or exclude
+the directory containing the OpenJDK source code from on-the-fly checking.
+
+### Ccache
The OpenJDK build supports building with ccache when using gcc or clang. Using
ccache can radically speed up compilation of native code if you often rebuild
-the same sources. Your milage may vary however so we recommend evaluating it
+the same sources. Your milage may vary however, so we recommend evaluating it
for yourself. To enable it, make sure it's on the path and configure with
`--enable-ccache`.
-#### Building on local disk
+### Precompiled Headers
+
+By default, the Hotspot build uses preccompiled headers (PCH) on the toolchains
+were it is properly supported (clang, gcc, and Visual Studio). Normally, this
+speeds up the build process, but in some circumstances, it can actually slow
+things down.
-If you are using network shares, e.g. via NFS, for your source code, make sure
-the build directory is situated on local disk. The performance penalty is
-extremely high for building on a network share, close to unusable.
+You can experiment by disabling precompiled headers using
+`--disable-precompiled-headers`.
+
+### Icecc / icecream
-#### Building only one JVM
+[icecc/icecream](http://github.com/icecc/icecream) is a simple way to setup a
+distributed compiler network. If you have multiple machines available for
+building OpenJDK, you can drastically cut individual build times by utilizing
+it.
-The old build builds multiple JVMs on 32-bit systems (client and server; and on
-Windows kernel as well). In the new build we have changed this default to only
-build server when it's available. This improves build times for those not
-interested in multiple JVMs. To mimic the old behavior on platforms that
-support it, use `--with-jvm-variants=client,server`.
+To use, setup an icecc network, and install icecc on the build machine. Then
+run `configure` using `--enable-icecc`.
+
+### Using sjavac
+
+To speed up Java compilation, especially incremental compilations, you can try
+the experimental sjavac compiler by using `--enable-sjavac`.
-#### Selecting the number of cores to build on
+### Building the Right Target
+
+Selecting the proper target to build can have dramatic impact on build time.
+For normal usage, `jdk` or the default target is just fine. You only need to
+build `images` for shipping, or if your tests require it.
+
+See also [Using Fine-Grained Make Targets](#using-fine-grained-make-targets) on
+how to build an even smaller subset of the product.
+
+## Troubleshooting
-By default, `configure` will analyze your machine and run the make process in
-parallel with as many threads as you have cores. This behavior can be
-overridden, either "permanently" (on a `configure` basis) using
-`--with-num-cores=N` or for a single build only (on a make basis), using
-`make JOBS=N`.
+If your build fails, it can sometimes be difficult to pinpoint the problem or
+find a proper solution.
+
+### Locating the Source of the Error
-If you want to make a slower build just this time, to save some CPU power for
-other processes, you can run e.g. `make JOBS=2`. This will force the makefiles
-to only run 2 parallel processes, or even `make JOBS=1` which will disable
-parallelism.
+When a build fails, it can be hard to pinpoint the actual cause of the error.
+In a typical build process, different parts of the product build in parallel,
+with the output interlaced.
+
+#### Build Failure Summary
+
+To help you, the build system will print a failure summary at the end. It looks
+like this:
+
+```
+ERROR: Build failed for target 'hotspot' in configuration 'linux-x64' (exit code 2)
-If you want to have it the other way round, namely having slow builds default
-and override with fast if you're impatient, you should call `configure` with
-`--with-num-cores=2`, making 2 the default. If you want to run with more cores,
-run `make JOBS=8`
+=== Output from failing command(s) repeated here ===
+* For target hotspot_variant-server_libjvm_objs_psMemoryPool.o:
+/localhome/hg/jdk9-sandbox/hotspot/src/share/vm/services/psMemoryPool.cpp:1:1: error: 'failhere' does not name a type
+ ... (rest of output omitted)
-### Troubleshooting
+* All command lines available in /localhome/hg/jdk9-sandbox/build/linux-x64/make-support/failure-logs.
+=== End of repeated output ===
-#### Solving build problems
+=== Make failed targets repeated here ===
+lib/CompileJvm.gmk:207: recipe for target '/localhome/hg/jdk9-sandbox/build/linux-x64/hotspot/variant-server/libjvm/objs/psMemoryPool.o' failed
+make/Main.gmk:263: recipe for target 'hotspot-server-libs' failed
+=== End of repeated output ===
-If the build fails (and it's not due to a compilation error in a source file
-you've changed), the first thing you should do is to re-run the build with more
-verbosity. Do this by adding `LOG=debug` to your make command line.
+Hint: Try searching the build log for the name of the first failed target.
+Hint: If caused by a warning, try configure --disable-warnings-as-errors.
+```
-The build log (with both stdout and stderr intermingled, basically the same as
-you see on your console) can be found as `build.log` in your build directory.
+Let's break it down! First, the selected configuration, and the top-level
+target you entered on the command line that caused the failure is printed.
-You can ask for help on build problems with the new build system on either the
-[build-dev](http://mail.openjdk.java.net/mailman/listinfo/build-dev) or the
-[build-infra-dev](http://mail.openjdk.java.net/mailman/listinfo/build-infra-dev)
-mailing lists. Please include the relevant parts of the build log.
+Then, between the `Output from failing command(s) repeated here` and `End of
+repeated output` the first lines of output (stdout and stderr) from the actual
+failing command is repeated. In most cases, this is the error message that
+caused the build to fail. If multiple commands were failing (this can happen in
+a parallel build), output from all failed commands will be printed here.
+
+The path to the `failure-logs` directory is printed. In this file you will find
+a `<target>.log` file that contains the output from this command in its
+entirety, and also a `<target>.cmd`, which contain the complete command line
+used for running this command. You can re-run the failing command by executing
+`. <path to failure-logs>/<target>.cmd` in your shell.
-A build can fail for any number of reasons. Most failures are a result of
-trying to build in an environment in which all the pre-build requirements have
-not been met. The first step in troubleshooting a build failure is to recheck
-that you have satisfied all the pre-build requirements for your platform.
-Scanning the `configure` log is a good first step, making sure that what it
-found makes sense for your system. Look for strange error messages or any
-difficulties that `configure` had in finding things.
+Another way to trace the failure is to follow the chain of make targets, from
+top-level targets to individual file targets. Between `Make failed targets
+repeated here` and `End of repeated output` the output from make showing this
+chain is repeated. The first failed recipe will typically contain the full path
+to the file in question that failed to compile. Following lines will show a
+trace of make targets why we ended up trying to compile that file.
+
+Finally, some hints are given on how to locate the error in the complete log.
+In this example, we would try searching the log file for "`psMemoryPool.o`".
+Another way to quickly locate make errors in the log is to search for "`]
+Error`" or "`***`".
-Some of the more common problems with builds are briefly described below, with
-suggestions for remedies.
+Note that the build failure summary will only help you if the issue was a
+compilation failure or similar. If the problem is more esoteric, or is due to
+errors in the build machinery, you will likely get empty output logs, and `No
+indication of failed target found` instead of the make target chain.
+
+#### Checking the Build Log File
+
+The output (stdout and stderr) from the latest build is always stored in
+`$BUILD/build.log`. The previous build log is stored as `build.log.old`. This
+means that it is not necessary to redirect the build output yourself if you
+want to process it.
- * **Corrupted Bundles on Windows:** \
- Some virus scanning software has been known to corrupt the downloading of
- zip bundles. It may be necessary to disable the 'on access' or 'real time'
- virus scanning features to prevent this corruption. This type of 'real time'
- virus scanning can also slow down the build process significantly.
- Temporarily disabling the feature, or excluding the build output directory
- may be necessary to get correct and faster builds.
+You can increase the verbosity of the log file, by the `LOG` control variable
+to `make`. If you want to see the command lines used in compilations, use
+`LOG=cmdlines`. To increase the general verbosity, use `LOG=info`, `LOG=debug`
+or `LOG=trace`. Both of these can be combined with `cmdlines`, e.g.
+`LOG=info,cmdlines`. The `debug` log level will show most shell commands
+executed by make, and `trace` will show all. Beware that both these log levels
+will produce a massive build log!
+
+### Fixing Unexpected Build Failures
- * **Slow Builds:** \
- If your build machine seems to be overloaded from too many simultaneous C++
- compiles, try setting the `JOBS=1` on the `make` command line. Then try
- increasing the count slowly to an acceptable level for your system. Also:
+Most of the time, the build will fail due to incorrect changes in the source
+code.
+
+Sometimes the build can fail with no apparent changes that have caused the
+failure. If this is the first time you are building OpenJDK on this particular
+computer, and the build fails, the problem is likely with your build
+environment. But even if you have previously built OpenJDK with success, and it
+now fails, your build environment might have changed (perhaps due to OS
+upgrades or similar). But most likely, such failures are due to problems with
+the incremental rebuild.
+
+#### Problems with the Build Environment
- Creating the javadocs can be very slow, if you are running javadoc, consider
- skipping that step.
+Make sure your configuration is correct. Re-run `configure`, and look for any
+warnings. Warnings that appear in the middle of the `configure` output is also
+repeated at the end, after the summary. The entire log is stored in
+`$BUILD/configure.log`.
- Faster CPUs, more RAM, and a faster DISK usually helps. The VM build tends
- to be CPU intensive (many C++ compiles), and the rest of the JDK will often
- be disk intensive.
+Verify that the summary at the end looks correct. Are you indeed using the Boot
+JDK and native toolchain that you expect?
- Faster compiles are possible using a tool called
- [ccache](http://ccache.samba.org/).
+By default, OpenJDK has a strict approach where warnings from the compiler is
+considered errors which fail the build. For very new or very old compiler
+versions, this can trigger new classes of warnings, which thus fails the build.
+Run `configure` with `--disable-warnings-as-errors` to turn of this behavior.
+(The warnings will still show, but not make the build fail.)
- * **File time issues:** \
- If you see warnings that refer to file time stamps, e.g.
+#### Problems with Incremental Rebuilds
- > _Warning message:_ ` File 'xxx' has modification time in the future.` \
- > _Warning message:_ ` Clock skew detected. Your build may be incomplete.`
+Incremental rebuilds mean that when you modify part of the product, only the
+affected parts get rebuilt. While this works great in most cases, and
+significantly speed up the development process, from time to time complex
+interdependencies will result in an incorrect build result. This is the most
+common cause for unexpected build problems, together with inconsistencies
+between the different Mercurial repositories in the forest.
- These warnings can occur when the clock on the build machine is out of sync
- with the timestamps on the source files. Other errors, apparently unrelated
- but in fact caused by the clock skew, can occur along with the clock skew
- warnings. These secondary errors may tend to obscure the fact that the true
- root cause of the problem is an out-of-sync clock.
+Here are a suggested list of things to try if you are having unexpected build
+problems. Each step requires more time than the one before, so try them in
+order. Most issues will be solved at step 1 or 2.
+
+ 1. Make sure your forest is up-to-date
+
+ Run `bash get_source.sh` to make sure you have the latest version of all
+ repositories.
+
+ 2. Clean build results
+
+ The simplest way to fix incremental rebuild issues is to run `make clean`.
+ This will remove all build results, but not the configuration or any build
+ system support artifacts. In most cases, this will solve build errors
+ resulting from incremental build mismatches.
- If you see these warnings, reset the clock on the build machine, run
- "`gmake clobber`" or delete the directory containing the build output, and
- restart the build from the beginning.
+ 3. Completely clean the build directory.
+
+ If this does not work, the next step is to run `make dist-clean`, or
+ removing the build output directory (`$BUILD`). This will clean all
+ generated output, including your configuration. You will need to re-run
+ `configure` after this step. A good idea is to run `make
+ print-configuration` before running `make dist-clean`, as this will print
+ your current `configure` command line. Here's a way to do this:
- * **Error message: `Trouble writing out table to disk`** \
- Increase the amount of swap space on your build machine. This could be
- caused by overloading the system and it may be necessary to use:
+ ```
+ make print-configuration > current-configuration
+ make dist-clean
+ bash configure $(cat current-configuration)
+ make
+ ```
- > `make JOBS=1`
-
- to reduce the load on the system.
+ 4. Re-clone the Mercurial forest
- * **Error Message: `libstdc++ not found`:** \
- This is caused by a missing libstdc++.a library. This is installed as part
- of a specific package (e.g. libstdc++.so.devel.386). By default some 64-bit
- Linux versions (e.g. Fedora) only install the 64-bit version of the
- libstdc++ package. Various parts of the JDK build require a static link of
- the C++ runtime libraries to allow for maximum portability of the built
- images.
+ Sometimes the Mercurial repositories themselves gets in a state that causes
+ the product to be un-buildable. In such a case, the simplest solution is
+ often the "sledgehammer approach": delete the entire forest, and re-clone
+ it. If you have local changes, save them first to a different location
+ using `hg export`.
+
+### Specific Build Issues
+
+#### Clock Skew
- * **Linux Error Message: `cannot restore segment prot after reloc`** \
- This is probably an issue with SELinux (See [SELinux on
- Wikipedia](http://en.wikipedia.org/wiki/SELinux)). Parts of the VM is built
- without the `-fPIC` for performance reasons.
-
- To completely disable SELinux:
+If you get an error message like this:
+```
+File 'xxx' has modification time in the future.
+Clock skew detected. Your build may be incomplete.
+```
+then the clock on your build machine is out of sync with the timestamps on the
+source files. Other errors, apparently unrelated but in fact caused by the
+clock skew, can occur along with the clock skew warnings. These secondary
+errors may tend to obscure the fact that the true root cause of the problem is
+an out-of-sync clock.
- 1. `$ su root`
- 2. `# system-config-securitylevel`
- 3. `In the window that appears, select the SELinux tab`
- 4. `Disable SELinux`
+If you see these warnings, reset the clock on the build machine, run `make
+clean` and restart the build.
+
+#### Out of Memory Errors
+
+On Solaris, you might get an error message like this:
+```
+Trouble writing out table to disk
+```
+To solve this, increase the amount of swap space on your build machine.
- Alternatively, instead of completely disabling it you could disable just
- this one check.
+On Windows, you might get error messages like this:
+```
+fatal error - couldn't allocate heap
+cannot create ... Permission denied
+spawn failed
+```
+This can be a sign of a Cygwin problem. See the information about solving
+problems in the [Cygwin](#cygwin) section. Rebooting the computer might help
+temporarily.
- 1. Select System->Administration->SELinux Management
- 2. In the SELinux Management Tool which appears, select "Boolean" from the
- menu on the left
- 3. Expand the "Memory Protection" group
- 4. Check the first item, labeled "Allow all unconfined executables to use
- libraries requiring text relocation ..."
+### Getting Help
- * **Windows Error Messages:** \
- `*** fatal error - couldn't allocate heap, ... ` \
- `rm fails with "Directory not empty"` \
- `unzip fails with "cannot create ... Permission denied"` \
- `unzip fails with "cannot create ... Error 50"`
+If none of the suggestions in this document helps you, or if you find what you
+believe is a bug in the build system, please contact the Build Group by sending
+a mail to [build-dev@openjdk.java.net](mailto:build-dev@openjdk.java.net).
+Please include the relevant parts of the configure and/or build log.
+
+If you need general help or advice about developing for OpenJDK, you can also
+contact the Adoption Group. See the section on [Contributing to OpenJDK](
+#contributing-to-openjdk) for more information.
- The CYGWIN software can conflict with other non-CYGWIN software. See the
- CYGWIN FAQ section on [BLODA (applications that interfere with
- CYGWIN)](http://cygwin.com/faq/faq.using.html#faq.using.bloda).
+## Hints and Suggestions for Advanced Users
+
+### Setting Up a Forest for Pushing Changes (defpath)
+
+To help you prepare a proper push path for a Mercurial repository, there exists
+a useful tool known as [defpath](
+http://openjdk.java.net/projects/code-tools/defpath). It will help you setup a
+proper push path for pushing changes to OpenJDK.
- * **Windows Error Message: `spawn failed`** \
- Try rebooting the system, or there could be some kind of issue with the disk
- or disk partition being used. Sometimes it comes with a "Permission Denied"
- message.
+Install the extension by cloning
+`http://hg.openjdk.java.net/code-tools/defpath` and updating your `.hgrc` file.
+Here's one way to do this:
--------------------------------------------------------------------------------
-
-## Appendix B: GNU make
+```
+cd ~
+mkdir hg-ext
+cd hg-ext
+hg clone http://hg.openjdk.java.net/code-tools/defpath
+cat << EOT >> ~/.hgrc
+[extensions]
+defpath=~/hg-ext/defpath/defpath.py
+EOT
+```
-The Makefiles in the OpenJDK are only valid when used with the GNU version of
-the utility command `make` (usually called `gmake` on Solaris). A few notes
-about using GNU make:
+You can now setup a proper push path using:
+```
+hg defpath -d -u <your OpenJDK username>
+```
- * You need GNU make version 3.81 or newer. On Windows 4.0 or newer is
- recommended. If the GNU make utility on your systems is not of a suitable
- version, see "[Building GNU make](#buildgmake)".
- * Place the location of the GNU make binary in the `PATH`.
- * **Solaris:** Do NOT use `/usr/bin/make` on Solaris. If your Solaris system
- has the software from the Solaris Developer Companion CD installed, you
- should try and use `/usr/bin/gmake` or `/usr/gnu/bin/make`.
- * **Windows:** Make sure you start your build inside a bash shell.
- * **Mac OS X:** The XCode "command line tools" must be installed on your Mac.
+If you also have the `trees` extension installed in Mercurial, you will
+automatically get a `tdefpath` command, which is even more useful. By running
+`hg tdefpath -du <username>` in the top repository of your forest, all repos
+will get setup automatically. This is the recommended usage.
+
+### Bash Completion
+
+The `configure` and `make` commands tries to play nice with bash command-line
+completion (using `<tab>` or `<tab><tab>`). To use this functionality, make
+sure you enable completion in your `~/.bashrc` (see instructions for bash in
+your operating system).
+
+Make completion will work out of the box, and will complete valid make targets.
+For instance, typing `make jdk-i<tab>` will complete to `make jdk-image`.
+
+The `configure` script can get completion for options, but for this to work you
+need to help `bash` on the way. The standard way of running the script, `bash
+configure`, will not be understood by bash completion. You need `configure` to
+be the command to run. One way to achieve this is to add a simple helper script
+to your path:
-Information on GNU make, and access to ftp download sites, are available on the
-[GNU make web site](http://www.gnu.org/software/make/make.html). The latest
-source to GNU make is available at
-[ftp.gnu.org/pub/gnu/make/](http://ftp.gnu.org/pub/gnu/make/).
-
-### Building GNU make
+```
+cat << EOT > /tmp/configure
+#!/bin/bash
+if [ \$(pwd) = \$(cd \$(dirname \$0); pwd) ] ; then
+ echo >&2 "Abort: Trying to call configure helper recursively"
+ exit 1
+fi
-First step is to get the GNU make 3.81 or newer source from
-[ftp.gnu.org/pub/gnu/make/](http://ftp.gnu.org/pub/gnu/make/). Building is a
-little different depending on the OS but is basically done with:
+bash \$PWD/configure "\$@"
+EOT
+chmod +x /tmp/configure
+sudo mv /tmp/configure /usr/local/bin
+```
+
+Now `configure --en<tab>-dt<tab>` will result in `configure --enable-dtrace`.
- bash ./configure
- make
+### Using Multiple Configurations
--------------------------------------------------------------------------------
+You can have multiple configurations for a single source forest. When you
+create a new configuration, run `configure --with-conf-name=<name>` to create a
+configuration with the name `<name>`. Alternatively, you can create a directory
+under `build` and run `configure` from there, e.g. `mkdir build/<name> && cd
+build/<name> && bash ../../configure`.
-## Appendix C: Build Environments
+Then you can build that configuration using `make CONF_NAME=<name>` or `make
+CONF=<pattern>`, where `<pattern>` is a substring matching one or several
+configurations, e.g. `CONF=debug`. The special empty pattern (`CONF=`) will
+match *all* available configuration, so `make CONF= hotspot` will build the
+`hotspot` target for all configurations. Alternatively, you can execute `make`
+in the configuration directory, e.g. `cd build/<name> && make`.
+
+### Handling Reconfigurations
-### Minimum Build Environments
+If you update the forest and part of the configure script has changed, the
+build system will force you to re-run `configure`.
+
+Most of the time, you will be fine by running `configure` again with the same
+arguments as the last time, which can easily be performed by `make
+reconfigure`. To simplify this, you can use the `CONF_CHECK` make control
+variable, either as `make CONF_CHECK=auto`, or by setting an environment
+variable. For instance, if you add `export CONF_CHECK=auto` to your `.bashrc`
+file, `make` will always run `reconfigure` automatically whenever the configure
+script has changed.
-This file often describes specific requirements for what we call the "minimum
-build environments" (MBE) for this specific release of the JDK. What is listed
-below is what the Oracle Release Engineering Team will use to build the Oracle
-JDK product. Building with the MBE will hopefully generate the most compatible
-bits that install on, and run correctly on, the most variations of the same
-base OS and hardware architecture. In some cases, these represent what is often
-called the least common denominator, but each Operating System has different
-aspects to it.
+You can also use `CONF_CHECK=ignore` to skip the check for a needed configure
+update. This might speed up the build, but comes at the risk of an incorrect
+build result. This is only recommended if you know what you're doing.
+
+From time to time, you will also need to modify the command line to `configure`
+due to changes. Use `make print-configure` to show the command line used for
+your current configuration.
+
+### Using Fine-Grained Make Targets
-In all cases, the Bootstrap JDK version minimum is critical, we cannot
-guarantee builds will work with older Bootstrap JDK's. Also in all cases, more
-RAM and more processors is better, the minimums listed below are simply
-recommendations.
+The default behavior for make is to create consistent and correct output, at
+the expense of build speed, if necessary.
-With Solaris and Mac OS X, the version listed below is the oldest release we
-can guarantee builds and works, and the specific version of the compilers used
-could be critical.
+If you are prepared to take some risk of an incorrect build, and know enough of
+the system to understand how things build and interact, you can speed up the
+build process considerably by instructing make to only build a portion of the
+product.
+
+#### Building Individual Modules
-With Windows the critical aspect is the Visual Studio compiler used, which due
-to it's runtime, generally dictates what Windows systems can do the builds and
-where the resulting bits can be used.
+The safe way to use fine-grained make targets is to use the module specific
+make targets. All source code in JDK 9 is organized so it belongs to a module,
+e.g. `java.base` or `jdk.jdwp.agent`. You can build only a specific module, by
+giving it as make target: `make jdk.jdwp.agent`. If the specified module
+depends on other modules (e.g. `java.base`), those modules will be built first.
-**NOTE: We expect a change here off these older Windows OS releases and to a
-'less older' one, probably Windows 2008R2 X64.**
+You can also specify a set of modules, just as you can always specify a set of
+make targets: `make jdk.crypto.cryptoki jdk.crypto.ec jdk.crypto.mscapi
+jdk.crypto.ucrypto`
-With Linux, it was just a matter of picking a stable distribution that is a
-good representative for Linux in general.
+#### Building Individual Module Phases
+
+The build process for each module is divided into separate phases. Not all
+modules need all phases. Which are needed depends on what kind of source code
+and other artifact the module consists of. The phases are:
-It is understood that most developers will NOT be using these specific
-versions, and in fact creating these specific versions may be difficult due to
-the age of some of this software. It is expected that developers are more often
-using the more recent releases and distributions of these operating systems.
+ * `gensrc` (Generate source code to compile)
+ * `gendata` (Generate non-source code artifacts)
+ * `copy` (Copy resource artifacts)
+ * `java` (Compile Java code)
+ * `launchers` (Compile native executables)
+ * `libs` (Compile native libraries)
+ * `rmic` (Run the `rmic` tool)
+
+You can build only a single phase for a module by using the notation
+`$MODULE-$PHASE`. For instance, to build the `gensrc` phase for `java.base`,
+use `make java.base-gensrc`.
-Compilation problems with newer or different C/C++ compilers is a common
-problem. Similarly, compilation problems related to changes to the
-`/usr/include` or system header files is also a common problem with older,
-newer, or unreleased OS versions. Please report these types of problems as bugs
-so that they can be dealt with accordingly.
+Note that some phases may depend on others, e.g. `java` depends on `gensrc` (if
+present). Make will build all needed prerequisites before building the
+requested phase.
+
+#### Skipping the Dependency Check
-Bootstrap JDK: JDK 8
+When using an iterative development style with frequent quick rebuilds, the
+dependency check made by make can take up a significant portion of the time
+spent on the rebuild. In such cases, it can be useful to bypass the dependency
+check in make.
+
+> **Note that if used incorrectly, this can lead to a broken build!**
- Base OS and Architecture OS C/C++ Compiler Processors RAM Minimum DISK Needs
- ------------------------------------- ----------------------------- ------------------------------------------------------- ------------ ------------- ------------
- Linux X86 (32-bit) and X64 (64-bit) Oracle Enterprise Linux 6.4 gcc 4.9.2 2 or more 1 GB 6 GB
- Solaris SPARCV9 (64-bit) Solaris 11 Update 1 Studio 12 Update 4 + patches 4 or more 4 GB 8 GB
- Solaris X64 (64-bit) Solaris 11 Update 1 Studio 12 Update 4 + patches 4 or more 4 GB 8 GB
- Windows X86 (32-bit) Windows Server 2012 R2 x64 Microsoft Visual Studio C++ 2013 Professional Edition 2 or more 2 GB 6 GB
- Windows X64 (64-bit) Windows Server 2012 R2 x64 Microsoft Visual Studio C++ 2013 Professional Edition 2 or more 2 GB 6 GB
- Mac OS X X64 (64-bit) Mac OS X 10.9 "Mavericks" Xcode 6.3 or newer 2 or more 4 GB 6 GB
+To achieve this, append `-only` to the build target. For instance, `make
+jdk.jdwp.agent-java-only` will *only* build the `java` phase of the
+`jdk.jdwp.agent` module. If the required dependencies are not present, the
+build can fail. On the other hand, the execution time measures in milliseconds.
--------------------------------------------------------------------------------
+A useful pattern is to build the first time normally (e.g. `make
+jdk.jdwp.agent`) and then on subsequent builds, use the `-only` make target.
+
+#### Rebuilding Part of java.base (JDK\_FILTER)
+
+If you are modifying files in `java.base`, which is the by far largest module
+in OpenJDK, then you need to rebuild all those files whenever a single file has
+changed. (This inefficiency will hopefully be addressed in JDK 10.)
-### Specific Developer Build Environments
+As a hack, you can use the make control variable `JDK_FILTER` to specify a
+pattern that will be used to limit the set of files being recompiled. For
+instance, `make java.base JDK_FILTER=javax/crypto` (or, to combine methods,
+`make java.base-java-only JDK_FILTER=javax/crypto`) will limit the compilation
+to files in the `javax.crypto` package.
-We won't be listing all the possible environments, but we will try to provide
-what information we have available to us.
+### Learn About Mercurial
+
+To become an efficient OpenJDK developer, it is recommended that you invest in
+learning Mercurial properly. Here are some links that can get you started:
-**NOTE: The community can help out by updating this part of the document.**
-
-#### Fedora
+ * [Mercurial for git users](http://www.mercurial-scm.org/wiki/GitConcepts)
+ * [The official Mercurial tutorial](http://www.mercurial-scm.org/wiki/Tutorial)
+ * [hg init](http://hginit.com/)
+ * [Mercurial: The Definitive Guide](http://hgbook.red-bean.com/read/)
-After installing the latest [Fedora](http://fedoraproject.org) you need to
-install several build dependencies. The simplest way to do it is to execute the
-following commands as user `root`:
+## Understanding the Build System
+
+This section will give you a more technical description on the details of the
+build system.
+
+### Configurations
- yum-builddep java-1.7.0-openjdk
- yum install gcc gcc-c++
-
-In addition, it's necessary to set a few environment variables for the build:
+The build system expects to find one or more configuration. These are
+technically defined by the `spec.gmk` in a subdirectory to the `build`
+subdirectory. The `spec.gmk` file is generated by `configure`, and contains in
+principle the configuration (directly or by files included by `spec.gmk`).
- export LANG=C
- export PATH="/usr/lib/jvm/java-openjdk/bin:${PATH}"
+You can, in fact, select a configuration to build by pointing to the `spec.gmk`
+file with the `SPEC` make control variable, e.g. `make SPEC=$BUILD/spec.gmk`.
+While this is not the recommended way to call `make` as a user, it is what is
+used under the hood by the build system.
-#### CentOS 5.5
+### Build Output Structure
+
+The build output for a configuration will end up in `build/<configuration
+name>`, which we refer to as `$BUILD` in this document. The `$BUILD` directory
+contains the following important directories:
-After installing [CentOS 5.5](http://www.centos.org/) you need to make sure you
-have the following Development bundles installed:
+```
+buildtools/
+configure-support/
+hotspot/
+images/
+jdk/
+make-support/
+support/
+test-results/
+test-support/
+```
+
+This is what they are used for:
- * Development Libraries
- * Development Tools
- * Java Development
- * X Software Development (Including XFree86-devel)
+ * `images`: This is the directory were the output of the `*-image` make
+ targets end up. For instance, `make jdk-image` ends up in `images/jdk`.
+
+ * `jdk`: This is the "exploded image". After `make jdk`, you will be able to
+ launch the newly built JDK by running `$BUILD/jdk/bin/java`.
-Plus the following packages:
+ * `test-results`: This directory contains the results from running tests.
- * cups devel: Cups Development Package
- * alsa devel: Alsa Development Package
- * Xi devel: libXi.so Development Package
+ * `support`: This is an area for intermediate files needed during the build,
+ e.g. generated source code, object files and class files. Some noteworthy
+ directories in `support` is `gensrc`, which contains the generated source
+ code, and the `modules_*` directories, which contains the files in a
+ per-module hierarchy that will later be collapsed into the `jdk` directory
+ of the exploded image.
-The freetype 2.3 packages don't seem to be available, but the freetype 2.3
-sources can be downloaded, built, and installed easily enough from [the
-freetype site](http://downloads.sourceforge.net/freetype). Build and install
-with something like:
+ * `buildtools`: This is an area for tools compiled for the build platform
+ that are used during the rest of the build.
+
+ * `hotspot`: This is an area for intermediate files needed when building
+ hotspot.
+
+ * `configure-support`, `make-support` and `test-support`: These directories
+ contain files that are needed by the build system for `configure`, `make`
+ and for running tests.
- bash ./configure
- make
- sudo -u root make install
+### Fixpath
+
+Windows path typically look like `C:\User\foo`, while Unix paths look like
+`/home/foo`. Tools with roots from Unix often experience issues related to this
+mismatch when running on Windows.
+
+In the OpenJDK build, we always use Unix paths internally, and only just before
+calling a tool that does not understand Unix paths do we convert them to
+Windows paths.
-Mercurial packages could not be found easily, but a Google search should find
-ones, and they usually include Python if it's needed.
+This conversion is done by the `fixpath` tool, which is a small wrapper that
+modifies unix-style paths to Windows-style paths in command lines. Fixpath is
+compiled automatically by `configure`.
-#### Debian 5.0 (Lenny)
+### Native Debug Symbols
-After installing [Debian](http://debian.org) 5 you need to install several
-build dependencies. The simplest way to install the build dependencies is to
-execute the following commands as user `root`:
+Native libraries and executables can have debug symbol (and other debug
+information) associated with them. How this works is very much platform
+dependent, but a common problem is that debug symbol information takes a lot of
+disk space, but is rarely needed by the end user.
- aptitude build-dep openjdk-7
- aptitude install openjdk-7-jdk libmotif-dev
+The OpenJDK supports different methods on how to handle debug symbols. The
+method used is selected by `--with-native-debug-symbols`, and available methods
+are `none`, `internal`, `external`, `zipped`.
-In addition, it's necessary to set a few environment variables for the build:
+ * `none` means that no debug symbols will be generated during the build.
+
+ * `internal` means that debug symbols will be generated during the build, and
+ they will be stored in the generated binary.
- export LANG=C
- export PATH="/usr/lib/jvm/java-7-openjdk/bin:${PATH}"
+ * `external` means that debug symbols will be generated during the build, and
+ after the compilation, they will be moved into a separate `.debuginfo` file.
+ (This was previously known as FDS, Full Debug Symbols).
+
+ * `zipped` is like `external`, but the .debuginfo file will also be zipped
+ into a `.diz` file.
-#### Ubuntu 12.04
+When building for distribution, `zipped` is a good solution. Binaries built
+with `internal` is suitable for use by developers, since they facilitate
+debugging, but should be stripped before distributed to end users.
-After installing [Ubuntu](http://ubuntu.org) 12.04 you need to install several
-build dependencies. The simplest way to do it is to execute the following
-commands:
+### Autoconf Details
+
+The `configure` script is based on the autoconf framework, but in some details
+deviate from a normal autoconf `configure` script.
- sudo aptitude build-dep openjdk-7
- sudo aptitude install openjdk-7-jdk
+The `configure` script in the top level directory of OpenJDK is just a thin
+wrapper that calls `common/autoconf/configure`. This in turn provides
+functionality that is not easily expressed in the normal Autoconf framework,
+and then calls into the core of the `configure` script, which is the
+`common/autoconf/generated-configure.sh` file.
-In addition, it's necessary to set a few environment variables for the build:
+As the name implies, this file is generated by Autoconf. It is checked in after
+regeneration, to alleviate the common user to have to install Autoconf.
- export LANG=C
- export PATH="/usr/lib/jvm/java-7-openjdk/bin:${PATH}"
+The build system will detect if the Autoconf source files have changed, and
+will trigger a regeneration of `common/autoconf/generated-configure.sh` if
+needed. You can also manually request such an update by `bash
+common/autoconf/autogen.sh`.
-#### OpenSUSE 11.1
+If you make changes to the build system that requires a re-generation, note the
+following:
-After installing [OpenSUSE](http://opensuse.org) 11.1 you need to install
-several build dependencies. The simplest way to install the build dependencies
-is to execute the following commands:
+ * You must use *exactly* version 2.69 of autoconf for your patch to be
+ accepted. This is to avoid spurious changes in the generated file. Note
+ that Ubuntu 16.04 ships a patched version of autoconf which claims to be
+ 2.69, but is not.
+
+ * You do not need to include the generated file in reviews.
- sudo zypper source-install -d java-1_7_0-openjdk
- sudo zypper install make
+ * If the generated file needs updating, the Oracle JDK closed counter-part
+ will also need to be updated. It is very much appreciated if you ask for an
+ Oracle engineer to sponsor your push so this can be made in tandem.
-In addition, it is necessary to set a few environment variables for the build:
+### Developing the Build System Itself
- export LANG=C
- export PATH="/usr/lib/jvm/java-1.7.0-openjdk/bin:$[PATH}"
+This section contains a few remarks about how to develop for the build system
+itself. It is not relevant if you are only making changes in the product source
+code.
-Finally, you need to unset the `JAVA_HOME` environment variable:
+While technically using `make`, the make source files of the OpenJDK does not
+resemble most other Makefiles. Instead of listing specific targets and actions
+(perhaps using patterns), the basic modus operandi is to call a high-level
+function (or properly, macro) from the API in `make/common`. For instance, to
+compile all classes in the `jdk.internal.foo` package in the `jdk.foo` module,
+a call like this would be made:
- export -n JAVA_HOME`
-
-#### Mandriva Linux One 2009 Spring
+```
+$(eval $(call SetupJavaCompilation, BUILD_FOO_CLASSES, \
+ SETUP := GENERATE_OLDBYTECODE, \
+ SRC := $(JDK_TOPDIR)/src/jkd.foo/share/classes, \
+ INCLUDES := jdk/internal/foo, \
+ BIN := $(SUPPORT_OUTPUTDIR)/foo_classes, \
+))
+```
-After installing [Mandriva](http://mandriva.org) Linux One 2009 Spring you need
-to install several build dependencies. The simplest way to install the build
-dependencies is to execute the following commands as user `root`:
+By encapsulating and expressing the high-level knowledge of *what* should be
+done, rather than *how* it should be done (as is normal in Makefiles), we can
+build a much more powerful and flexible build system.
+
+Correct dependency tracking is paramount. Sloppy dependency tracking will lead
+to improper parallelization, or worse, race conditions.
- urpmi java-1.7.0-openjdk-devel make gcc gcc-c++ freetype-devel zip unzip
- libcups2-devel libxrender1-devel libalsa2-devel libstc++-static-devel
- libxtst6-devel libxi-devel
+To test for/debug race conditions, try running `make JOBS=1` and `make
+JOBS=100` and see if it makes any difference. (It shouldn't).
+
+To compare the output of two different builds and see if, and how, they differ,
+run `$BUILD1/compare.sh -o $BUILD2`, where `$BUILD1` and `$BUILD2` are the two
+builds you want to compare.
-In addition, it is necessary to set a few environment variables for the build:
-
- export LANG=C
- export PATH="/usr/lib/jvm/java-1.7.0-openjdk/bin:${PATH}"
+To automatically build two consecutive versions and compare them, use
+`COMPARE_BUILD`. The value of `COMPARE_BUILD` is a set of variable=value
+assignments, like this:
+```
+make COMPARE_BUILD=CONF=--enable-new-hotspot-feature:MAKE=hotspot
+```
+See `make/InitSupport.gmk` for details on how to use `COMPARE_BUILD`.
-#### OpenSolaris 2009.06
+To analyze build performance, run with `LOG=trace` and check `$BUILD/build-trace-time.log`.
+Use `JOBS=1` to avoid parallelism.
-After installing [OpenSolaris](http://opensolaris.org) 2009.06 you need to
-install several build dependencies. The simplest way to install the build
-dependencies is to execute the following commands:
+Please check that you adhere to the [Code Conventions for the Build System](
+http://openjdk.java.net/groups/build/doc/code-conventions.html) before
+submitting patches. Also see the section in [Autoconf Details](
+#autoconf-details) about the generated configure script.
+
+## Contributing to OpenJDK
+
+So, now you've build your OpenJDK, and made your first patch, and want to
+contribute it back to the OpenJDK community.
- pfexec pkg install SUNWgmake SUNWj7dev sunstudioexpress SUNWcups SUNWzip
- SUNWunzip SUNWxwhl SUNWxorg-headers SUNWaudh SUNWfreetype2
+First of all: Thank you! We gladly welcome your contribution to the OpenJDK.
+However, please bear in mind that OpenJDK is a massive project, and we must ask
+you to follow our rules and guidelines to be able to accept your contribution.
-In addition, it is necessary to set a few environment variables for the build:
+The official place to start is the ['How to contribute' page](
+http://openjdk.java.net/contribute/). There is also an official (but somewhat
+outdated and skimpy on details) [Developer's Guide](
+http://openjdk.java.net/guide/).
- export LANG=C
- export PATH="/opt/SunStudioExpress/bin:${PATH}"
+If this seems overwhelming to you, the Adoption Group is there to help you! A
+good place to start is their ['New Contributor' page](
+https://wiki.openjdk.java.net/display/Adoption/New+Contributor), or start
+reading the comprehensive [Getting Started Kit](
+https://adoptopenjdk.gitbooks.io/adoptopenjdk-getting-started-kit/en/). The
+Adoption Group will also happily answer any questions you have about
+contributing. Contact them by [mail](
+http://mail.openjdk.java.net/mailman/listinfo/adoption-discuss) or [IRC](
+http://openjdk.java.net/irc/).
--------------------------------------------------------------------------------
-
-End of the OpenJDK build README document.
-
-Please come again!
+---
+# Override styles from the base CSS file that are not ideal for this document.
+header-includes:
+ - '<style type="text/css">pre, code, tt { color: #1d6ae5; }</style>'
+---
--- a/common/doc/testing.html Tue Jun 20 13:12:42 2017 +0200
+++ b/common/doc/testing.html Wed Jun 21 12:51:25 2017 +0200
@@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>Testing OpenJDK</title>
<style type="text/css">code{white-space: pre;}</style>
- <link rel="stylesheet" href="../../jdk/make/data/docs-resources/specs/resources/jdk-default.css">
+ <link rel="stylesheet" href="../../jdk/make/data/docs-resources/resources/jdk-default.css">
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
<![endif]-->
--- a/make/Init.gmk Tue Jun 20 13:12:42 2017 +0200
+++ b/make/Init.gmk Wed Jun 21 12:51:25 2017 +0200
@@ -327,7 +327,7 @@
$(call ReportBuildTimes)
$(call PrintFailureReports)
$(call PrintBuildLogFailures)
- $(PRINTF) "Hint: If caused by a warning, try configure --disable-warnings-as-errors.\n\n"
+ $(PRINTF) "Hint: See common/doc/building.html#troubleshooting for assistance.\n\n"
ifneq ($(COMPARE_BUILD), )
$(call CleanupCompareBuild)
endif
--- a/make/UpdateBuildDocs.gmk Tue Jun 20 13:12:42 2017 +0200
+++ b/make/UpdateBuildDocs.gmk Wed Jun 21 12:51:25 2017 +0200
@@ -39,7 +39,7 @@
$(error Cannot continue)
endif
-GLOBAL_SPECS_DEFAULT_CSS_FILE := $(JDK_TOPDIR)/make/data/docs-resources/specs/resources/jdk-default.css
+GLOBAL_SPECS_DEFAULT_CSS_FILE := $(JDK_TOPDIR)/make/data/docs-resources/resources/jdk-default.css
################################################################################
@@ -49,6 +49,7 @@
FILES := $(DOCS_DIR)/building.md, \
DEST := $(DOCS_DIR), \
CSS := $(GLOBAL_SPECS_DEFAULT_CSS_FILE), \
+ OPTIONS := --toc, \
))
TARGETS += $(building)