doc/building.html
changeset 47217 72e3ae9a25eb
parent 47216 71c04702a3d5
child 47219 fd36993f7bf5
equal deleted inserted replaced
47216:71c04702a3d5 47217:72e3ae9a25eb
     4   <meta charset="utf-8">
     4   <meta charset="utf-8">
     5   <meta name="generator" content="pandoc">
     5   <meta name="generator" content="pandoc">
     6   <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
     6   <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
     7   <title>Building OpenJDK</title>
     7   <title>Building OpenJDK</title>
     8   <style type="text/css">code{white-space: pre;}</style>
     8   <style type="text/css">code{white-space: pre;}</style>
     9   <link rel="stylesheet" href="../../jdk/make/data/docs-resources/resources/jdk-default.css">
     9   <link rel="stylesheet" href="../make/data/docs-resources/resources/jdk-default.css">
    10   <!--[if lt IE 9]>
    10   <!--[if lt IE 9]>
    11     <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
    11     <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
    12   <![endif]-->
    12   <![endif]-->
    13   <style type="text/css">pre, code, tt { color: #1d6ae5; }</style>
    13   <style type="text/css">pre, code, tt { color: #1d6ae5; }</style>
    14 </head>
    14 </head>
    20 <ul>
    20 <ul>
    21 <li><a href="#tldr-instructions-for-the-impatient">TL;DR (Instructions for the Impatient)</a></li>
    21 <li><a href="#tldr-instructions-for-the-impatient">TL;DR (Instructions for the Impatient)</a></li>
    22 <li><a href="#introduction">Introduction</a></li>
    22 <li><a href="#introduction">Introduction</a></li>
    23 <li><a href="#getting-the-source-code">Getting the Source Code</a><ul>
    23 <li><a href="#getting-the-source-code">Getting the Source Code</a><ul>
    24 <li><a href="#special-considerations">Special Considerations</a></li>
    24 <li><a href="#special-considerations">Special Considerations</a></li>
    25 <li><a href="#using-get_source.sh">Using get_source.sh</a></li>
       
    26 <li><a href="#using-hgforest.sh">Using hgforest.sh</a></li>
       
    27 <li><a href="#using-the-trees-extension">Using the Trees Extension</a></li>
       
    28 </ul></li>
    25 </ul></li>
    29 <li><a href="#build-hardware-requirements">Build Hardware Requirements</a><ul>
    26 <li><a href="#build-hardware-requirements">Build Hardware Requirements</a><ul>
    30 <li><a href="#building-on-x86">Building on x86</a></li>
    27 <li><a href="#building-on-x86">Building on x86</a></li>
    31 <li><a href="#building-on-sparc">Building on sparc</a></li>
    28 <li><a href="#building-on-sparc">Building on sparc</a></li>
    32 <li><a href="#building-on-armaarch64">Building on arm/aarch64</a></li>
    29 <li><a href="#building-on-armaarch64">Building on arm/aarch64</a></li>
   117 </nav>
   114 </nav>
   118 <h2 id="tldr-instructions-for-the-impatient">TL;DR (Instructions for the Impatient)</h2>
   115 <h2 id="tldr-instructions-for-the-impatient">TL;DR (Instructions for the Impatient)</h2>
   119 <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>
   116 <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>
   120 <ol type="1">
   117 <ol type="1">
   121 <li><p><a href="#getting-the-source-code">Get the complete source code</a>:<br />
   118 <li><p><a href="#getting-the-source-code">Get the complete source code</a>:<br />
   122 <code>bash get_source.sh</code></p></li>
   119 <code>hg clone http://hg.openjdk.java.net/jdk10/master</code></p></li>
   123 <li><p><a href="#running-configure">Run configure</a>:<br />
   120 <li><p><a href="#running-configure">Run configure</a>:<br />
   124 <code>bash configure</code></p>
   121 <code>bash configure</code></p>
   125 <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>
   122 <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>
   126 <li><p><a href="#running-make">Run make</a>:<br />
   123 <li><p><a href="#running-make">Run make</a>:<br />
   127 <code>make images</code></p></li>
   124 <code>make images</code></p></li>
   133 <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>
   130 <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>
   134 <h2 id="introduction">Introduction</h2>
   131 <h2 id="introduction">Introduction</h2>
   135 <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>
   132 <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>
   136 <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>
   133 <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>
   137 <h2 id="getting-the-source-code">Getting the Source Code</h2>
   134 <h2 id="getting-the-source-code">Getting the Source Code</h2>
   138 <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 (&quot;forest&quot;) 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>
   135 <p>Make sure you are getting the correct version. As of JDK 10, the source is no longer split into separate repositories so you only need to clone one single repository. 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>
   139 <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>
       
   140 <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>
   136 <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>
   141 <h3 id="special-considerations">Special Considerations</h3>
   137 <h3 id="special-considerations">Special Considerations</h3>
   142 <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>
   138 <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>
   143 <ul>
   139 <ul>
   144 <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>
   140 <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>
   150 <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>
   146 <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>
   151 <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>
   147 <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>
   152 </ul>
   148 </ul>
   153 <p>Failure to follow this procedure might result in hard-to-debug build problems.</p></li>
   149 <p>Failure to follow this procedure might result in hard-to-debug build problems.</p></li>
   154 </ul>
   150 </ul>
   155 <h3 id="using-get_source.sh">Using get_source.sh</h3>
       
   156 <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>
       
   157 <pre><code>hg clone http://hg.openjdk.java.net/jdk9/jdk9
       
   158 cd jdk9
       
   159 bash get_source.sh</code></pre>
       
   160 <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>
       
   161 <h3 id="using-hgforest.sh">Using hgforest.sh</h3>
       
   162 <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>
       
   163 <ul>
       
   164 <li><p>Cloning the forest:</p>
       
   165 <pre><code>hg clone http://hg.openjdk.java.net/jdk9/jdk9
       
   166 cd jdk9
       
   167 bash common/bin/hgforest.sh clone</code></pre></li>
       
   168 <li><p>Pulling and updating the forest:</p>
       
   169 <pre><code>bash common/bin/hgforest.sh pull -u</code></pre></li>
       
   170 <li><p>Merging over the entire forest:</p>
       
   171 <pre><code>bash common/bin/hgforest.sh merge</code></pre></li>
       
   172 </ul>
       
   173 <h3 id="using-the-trees-extension">Using the Trees Extension</h3>
       
   174 <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>
       
   175 <h4 id="installing-the-extension">Installing the Extension</h4>
       
   176 <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>
       
   177 <pre><code>cd ~
       
   178 mkdir hg-ext
       
   179 cd hg-ext
       
   180 hg clone http://hg.openjdk.java.net/code-tools/trees
       
   181 cat &lt;&lt; EOT &gt;&gt; ~/.hgrc
       
   182 [extensions]
       
   183 trees=~/hg-ext/trees/trees.py
       
   184 EOT</code></pre>
       
   185 <h4 id="initializing-the-tree">Initializing the Tree</h4>
       
   186 <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>
       
   187 <pre><code>hg tconf --set --walk --depth</code></pre>
       
   188 <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>
       
   189 <pre><code>hg tclone http://hg.openjdk.java.net/jdk9/jdk9</code></pre>
       
   190 <p>In this case, the forest will be properly initialized from the start.</p>
       
   191 <h4 id="other-operations">Other Operations</h4>
       
   192 <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>
       
   193 <pre><code>hg tpull -u</code></pre>
       
   194 <h2 id="build-hardware-requirements">Build Hardware Requirements</h2>
   151 <h2 id="build-hardware-requirements">Build Hardware Requirements</h2>
   195 <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>
   152 <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>
   196 <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>
   153 <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>
   197 <h3 id="building-on-x86">Building on x86</h3>
   154 <h3 id="building-on-x86">Building on x86</h3>
   198 <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>
   155 <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>
   325 <td style="text-align: left;">Microsoft Visual Studio 2013 update 4</td>
   282 <td style="text-align: left;">Microsoft Visual Studio 2013 update 4</td>
   326 </tr>
   283 </tr>
   327 </tbody>
   284 </tbody>
   328 </table>
   285 </table>
   329 <h3 id="gcc">gcc</h3>
   286 <h3 id="gcc">gcc</h3>
   330 <p>The minimum accepted version of gcc is 4.3. Older versions will not be accepted by <code>configure</code>.</p>
   287 <p>The minimum accepted version of gcc is 4.7. Older versions will generate a warning by <code>configure</code> and are unlikely to work.</p>
   331 <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>
       
   332 <p>OpenJDK 9 includes patches that should allow gcc 6 to compile, but this should be considered experimental.</p>
   288 <p>OpenJDK 9 includes patches that should allow gcc 6 to compile, but this should be considered experimental.</p>
   333 <p>In general, any version between these two should be usable.</p>
   289 <p>In general, any version between these two should be usable.</p>
   334 <h3 id="clang">clang</h3>
   290 <h3 id="clang">clang</h3>
   335 <p>The minimum accepted version of clang is 3.2. Older versions will not be accepted by <code>configure</code>.</p>
   291 <p>The minimum accepted version of clang is 3.2. Older versions will not be accepted by <code>configure</code>.</p>
   336 <p>To use clang instead of gcc on Linux, use <code>--with-toolchain-type=clang</code>.</p>
   292 <p>To use clang instead of gcc on Linux, use <code>--with-toolchain-type=clang</code>.</p>