doc/building.html
changeset 50586 4bba6dea2e73
parent 50490 cbae0e359538
child 50885 7c728fa9d1af
equal deleted inserted replaced
50585:1bddf2ab9ae7 50586:4bba6dea2e73
   156 <h3 id="building-on-armaarch64">Building on arm/aarch64</h3>
   156 <h3 id="building-on-armaarch64">Building on arm/aarch64</h3>
   157 <p>This is not recommended. Instead, see the section on <a href="#cross-compiling">Cross-compiling</a>.</p>
   157 <p>This is not recommended. Instead, see the section on <a href="#cross-compiling">Cross-compiling</a>.</p>
   158 <h2 id="operating-system-requirements">Operating System Requirements</h2>
   158 <h2 id="operating-system-requirements">Operating System Requirements</h2>
   159 <p>The mainline OpenJDK project supports Linux, Solaris, macOS, AIX and Windows. Support for other operating system, e.g. BSD, exists in separate &quot;port&quot; projects.</p>
   159 <p>The mainline OpenJDK project supports Linux, Solaris, macOS, AIX and Windows. Support for other operating system, e.g. BSD, exists in separate &quot;port&quot; projects.</p>
   160 <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>
   160 <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>
   161 <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>
   161 <p>This table lists the OS versions used by Oracle when building OpenJDK. Such information is always subject to change, but this table is up to date at the time of writing.</p>
   162 <table>
   162 <table>
   163 <thead>
   163 <thead>
   164 <tr class="header">
   164 <tr class="header">
   165 <th style="text-align: left;">Operating system</th>
   165 <th style="text-align: left;">Operating system</th>
   166 <th style="text-align: left;">Vendor/version used</th>
   166 <th style="text-align: left;">Vendor/version used</th>
   188 <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>
   188 <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>
   189 <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>
   189 <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>
   190 <h3 id="windows">Windows</h3>
   190 <h3 id="windows">Windows</h3>
   191 <p>Windows XP is not a supported platform, but all newer Windows should be able to build OpenJDK.</p>
   191 <p>Windows XP is not a supported platform, but all newer Windows should be able to build OpenJDK.</p>
   192 <p>On Windows, it is important that you pay attention to the instructions in the <a href="#special-considerations">Special Considerations</a>.</p>
   192 <p>On Windows, it is important that you pay attention to the instructions in the <a href="#special-considerations">Special Considerations</a>.</p>
   193 <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>
   193 <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. Currently, 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>
   194 <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-msvcr-dll=/cygdrive/c/msvcr100.dll</code> rather than <code>--with-msvcr-dll=c:\msvcr100.dll</code>. For details on this conversion, see the section on <a href="#fixpath">Fixpath</a>.</p>
   194 <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-msvcr-dll=/cygdrive/c/msvcr100.dll</code> rather than <code>--with-msvcr-dll=c:\msvcr100.dll</code>. For details on this conversion, see the section on <a href="#fixpath">Fixpath</a>.</p>
   195 <h4 id="cygwin">Cygwin</h4>
   195 <h4 id="cygwin">Cygwin</h4>
   196 <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>
   196 <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>
   197 <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>
   197 <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>
   198 <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>
   198 <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>
   263 </tr>
   263 </tr>
   264 </thead>
   264 </thead>
   265 <tbody>
   265 <tbody>
   266 <tr class="odd">
   266 <tr class="odd">
   267 <td style="text-align: left;">Linux</td>
   267 <td style="text-align: left;">Linux</td>
   268 <td style="text-align: left;">gcc 4.9.2</td>
   268 <td style="text-align: left;">gcc 7.3.0</td>
   269 </tr>
   269 </tr>
   270 <tr class="even">
   270 <tr class="even">
   271 <td style="text-align: left;">macOS</td>
   271 <td style="text-align: left;">macOS</td>
   272 <td style="text-align: left;">Apple Xcode 6.3 (using clang 6.1.0)</td>
   272 <td style="text-align: left;">Apple Xcode 6.3 (using clang 6.1.0)</td>
   273 </tr>
   273 </tr>
   280 <td style="text-align: left;">Microsoft Visual Studio 2013 update 4</td>
   280 <td style="text-align: left;">Microsoft Visual Studio 2013 update 4</td>
   281 </tr>
   281 </tr>
   282 </tbody>
   282 </tbody>
   283 </table>
   283 </table>
   284 <h3 id="gcc">gcc</h3>
   284 <h3 id="gcc">gcc</h3>
   285 <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>
   285 <p>The minimum accepted version of gcc is 4.8. Older versions will generate a warning by <code>configure</code> and are unlikely to work.</p>
   286 <p>OpenJDK 9 includes patches that should allow gcc 6 to compile, but this should be considered experimental.</p>
   286 <p>OpenJDK is currently known to be able to compile with at least version 7.4 of gcc.</p>
   287 <p>In general, any version between these two should be usable.</p>
   287 <p>In general, any version between these two should be usable.</p>
   288 <h3 id="clang">clang</h3>
   288 <h3 id="clang">clang</h3>
   289 <p>The minimum accepted version of clang is 3.2. Older versions will not be accepted by <code>configure</code>.</p>
   289 <p>The minimum accepted version of clang is 3.2. Older versions will not be accepted by <code>configure</code>.</p>
   290 <p>To use clang instead of gcc on Linux, use <code>--with-toolchain-type=clang</code>.</p>
   290 <p>To use clang instead of gcc on Linux, use <code>--with-toolchain-type=clang</code>.</p>
   291 <h3 id="apple-xcode">Apple Xcode</h3>
   291 <h3 id="apple-xcode">Apple Xcode</h3>
   786 <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>
   786 <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>
   787 <h3 id="using-fine-grained-make-targets">Using Fine-Grained Make Targets</h3>
   787 <h3 id="using-fine-grained-make-targets">Using Fine-Grained Make Targets</h3>
   788 <p>The default behavior for make is to create consistent and correct output, at the expense of build speed, if necessary.</p>
   788 <p>The default behavior for make is to create consistent and correct output, at the expense of build speed, if necessary.</p>
   789 <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>
   789 <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>
   790 <h4 id="building-individual-modules">Building Individual Modules</h4>
   790 <h4 id="building-individual-modules">Building Individual Modules</h4>
   791 <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>
   791 <p>The safe way to use fine-grained make targets is to use the module specific make targets. All source code in OpenJDK 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>
   792 <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>
   792 <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>
   793 <h4 id="building-individual-module-phases">Building Individual Module Phases</h4>
   793 <h4 id="building-individual-module-phases">Building Individual Module Phases</h4>
   794 <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>
   794 <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>
   795 <ul>
   795 <ul>
   796 <li><code>gensrc</code> (Generate source code to compile)</li>
   796 <li><code>gensrc</code> (Generate source code to compile)</li>