< prev index next >

doc/building.html

Print this page




 280 </thead>
 281 <tbody>
 282 <tr class="odd">
 283 <td style="text-align: left;">Linux</td>
 284 <td style="text-align: left;">gcc 8.2.0</td>
 285 </tr>
 286 <tr class="even">
 287 <td style="text-align: left;">macOS</td>
 288 <td style="text-align: left;">Apple Xcode 10.1 (using clang 10.0.0)</td>
 289 </tr>
 290 <tr class="odd">
 291 <td style="text-align: left;">Solaris</td>
 292 <td style="text-align: left;">Oracle Solaris Studio 12.6 (with compiler version 5.15)</td>
 293 </tr>
 294 <tr class="even">
 295 <td style="text-align: left;">Windows</td>
 296 <td style="text-align: left;">Microsoft Visual Studio 2017 update 15.9.6</td>
 297 </tr>
 298 </tbody>
 299 </table>
 300 <p>All compilers are expected to be able to compile to the C99 language standard, as some C99 features are used in the source code. Microsoft Visual Studio doesn't fully support C99 so in practice shared code is limited to using C99 features that it does support.</p>



 301 <h3 id="gcc">gcc</h3>
 302 <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>
 303 <p>The JDK is currently known to be able to compile with at least version 7.4 of gcc.</p>
 304 <p>In general, any version between these two should be usable.</p>
 305 <h3 id="clang">clang</h3>
 306 <p>The minimum accepted version of clang is 3.2. Older versions will not be accepted by <code>configure</code>.</p>
 307 <p>To use clang instead of gcc on Linux, use <code>--with-toolchain-type=clang</code>.</p>
 308 <h3 id="apple-xcode">Apple Xcode</h3>
 309 <p>The oldest supported version of Xcode is 8.</p>
 310 <p>You will need the Xcode command lines developers tools to be able to build the JDK. (Actually, <em>only</em> the command lines tools are needed, not the IDE.) The simplest way to install these is to run:</p>
 311 <pre><code>xcode-select --install</code></pre>
 312 <p>It is advisable to keep an older version of Xcode for building the JDK 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/Xcode8.app/Contents/Developer/usr/bin</code></p>
 313 <p>If you have recently (inadvertently) updated your OS and/or Xcode version, and the JDK 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>
 314 <h3 id="oracle-solaris-studio">Oracle Solaris Studio</h3>
 315 <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>
 316 <p>The Solaris Studio installation should contain at least these packages:</p>
 317 <table>
 318 <thead>
 319 <tr class="header">
 320 <th style="text-align: left;">Package</th>


 555 <ul>
 556 <li><code>JOBS</code> - Specify the number of jobs to build with. See <a href="#build-performance">Build Performance</a>.</li>
 557 <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>
 558 <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>
 559 </ul>
 560 <h4 id="test-make-control-variables">Test Make Control Variables</h4>
 561 <p>These make control variables only make sense when running tests. Please see <a href="testing.html">Testing the JDK</a> for details.</p>
 562 <ul>
 563 <li><code>TEST</code></li>
 564 <li><code>TEST_JOBS</code></li>
 565 <li><code>JTREG</code></li>
 566 <li><code>GTEST</code></li>
 567 </ul>
 568 <h4 id="advanced-make-control-variables">Advanced Make Control Variables</h4>
 569 <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>
 570 <ul>
 571 <li><code>SPEC</code></li>
 572 <li><code>CONF_CHECK</code></li>
 573 <li><code>COMPARE_BUILD</code></li>
 574 <li><code>JDK_FILTER</code></li>
 575 <li><code>SPEC_FILTER</code></li>
 576 </ul>
 577 <h2 id="running-tests">Running Tests</h2>
 578 <p>Most of the JDK 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=&lt;path to jtreg home&gt;</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>
 579 <p>The <a href="https://wiki.openjdk.java.net/display/Adoption">Adoption Group</a> provides recent builds of jtreg <a href="https://adopt-openjdk.ci.cloudbees.com/job/jtreg/lastSuccessfulBuild/artifact">here</a>. Download the latest <code>.tar.gz</code> file, unpack it, and point <code>--with-jtreg</code> to the <code>jtreg</code> directory that you just unpacked.</p>
 580 <p>To execute the most basic tests (tier 1), use:</p>
 581 <pre><code>make run-test-tier1</code></pre>
 582 <p>For more details on how to run tests, please see the <a href="testing.html">Testing the JDK</a> document.</p>
 583 <h2 id="cross-compiling">Cross-compiling</h2>
 584 <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>
 585 <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>
 586 <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 the JDK. 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>
 587 <p>Cross-compiling the JDK 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>
 588 <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>
 589 <h3 id="cross-compiling-the-easy-way-with-openjdk-devkits">Cross compiling the easy way with OpenJDK devkits</h3>
 590 <p>The OpenJDK build system provides out-of-the box support for creating and using so called devkits. A <code>devkit</code> is basically a collection of a cross-compiling toolchain and a sysroot environment which can easily be used together with the <code>--with-devkit</code> configure option to cross compile the OpenJDK. On Linux/x86_64, the following command:</p>
 591 <pre><code>bash configure --with-devkit=&lt;devkit-path&gt; --openjdk-target=ppc64-linux-gnu &amp;&amp; make</code></pre>
 592 <p>will configure and build OpenJDK for Linux/ppc64 assuming that <code>&lt;devkit-path&gt;</code> points to a Linux/x86_64 to Linux/ppc64 devkit.</p>
 593 <p>Devkits can be created from the <code>make/devkit</code> directory by executing:</p>
 594 <pre><code>make [ TARGETS=&quot;&lt;TARGET_TRIPLET&gt;+&quot; ] [ BASE_OS=&lt;OS&gt; ] [ BASE_OS_VERSION=&lt;VER&gt; ]</code></pre>
 595 <p>where <code>TARGETS</code> contains one or more <code>TARGET_TRIPLET</code>s of the form described in <a href="https://sourceware.org/autobook/autobook/autobook_17.html">section 3.4 of the GNU Autobook</a>. If no targets are given, a native toolchain for the current platform will be created. Currently, at least the following targets are known to work:</p>




 280 </thead>
 281 <tbody>
 282 <tr class="odd">
 283 <td style="text-align: left;">Linux</td>
 284 <td style="text-align: left;">gcc 8.2.0</td>
 285 </tr>
 286 <tr class="even">
 287 <td style="text-align: left;">macOS</td>
 288 <td style="text-align: left;">Apple Xcode 10.1 (using clang 10.0.0)</td>
 289 </tr>
 290 <tr class="odd">
 291 <td style="text-align: left;">Solaris</td>
 292 <td style="text-align: left;">Oracle Solaris Studio 12.6 (with compiler version 5.15)</td>
 293 </tr>
 294 <tr class="even">
 295 <td style="text-align: left;">Windows</td>
 296 <td style="text-align: left;">Microsoft Visual Studio 2017 update 15.9.6</td>
 297 </tr>
 298 </tbody>
 299 </table>
 300 <p>All compilers are expected to be able to compile to the C99 language standard,
 301 as some C99 features are used in the source code. Microsoft Visual Studio
 302 doesn't fully support C99 so in practice shared code is limited to using C99
 303 features that it does support.</p>
 304 <h3 id="gcc">gcc</h3>
 305 <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>
 306 <p>The JDK is currently known to be able to compile with at least version 7.4 of gcc.</p>
 307 <p>In general, any version between these two should be usable.</p>
 308 <h3 id="clang">clang</h3>
 309 <p>The minimum accepted version of clang is 3.2. Older versions will not be accepted by <code>configure</code>.</p>
 310 <p>To use clang instead of gcc on Linux, use <code>--with-toolchain-type=clang</code>.</p>
 311 <h3 id="apple-xcode">Apple Xcode</h3>
 312 <p>The oldest supported version of Xcode is 8.</p>
 313 <p>You will need the Xcode command lines developers tools to be able to build the JDK. (Actually, <em>only</em> the command lines tools are needed, not the IDE.) The simplest way to install these is to run:</p>
 314 <pre><code>xcode-select --install</code></pre>
 315 <p>It is advisable to keep an older version of Xcode for building the JDK 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/Xcode8.app/Contents/Developer/usr/bin</code></p>
 316 <p>If you have recently (inadvertently) updated your OS and/or Xcode version, and the JDK 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>
 317 <h3 id="oracle-solaris-studio">Oracle Solaris Studio</h3>
 318 <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>
 319 <p>The Solaris Studio installation should contain at least these packages:</p>
 320 <table>
 321 <thead>
 322 <tr class="header">
 323 <th style="text-align: left;">Package</th>


 558 <ul>
 559 <li><code>JOBS</code> - Specify the number of jobs to build with. See <a href="#build-performance">Build Performance</a>.</li>
 560 <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>
 561 <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>
 562 </ul>
 563 <h4 id="test-make-control-variables">Test Make Control Variables</h4>
 564 <p>These make control variables only make sense when running tests. Please see <a href="testing.html">Testing the JDK</a> for details.</p>
 565 <ul>
 566 <li><code>TEST</code></li>
 567 <li><code>TEST_JOBS</code></li>
 568 <li><code>JTREG</code></li>
 569 <li><code>GTEST</code></li>
 570 </ul>
 571 <h4 id="advanced-make-control-variables">Advanced Make Control Variables</h4>
 572 <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>
 573 <ul>
 574 <li><code>SPEC</code></li>
 575 <li><code>CONF_CHECK</code></li>
 576 <li><code>COMPARE_BUILD</code></li>
 577 <li><code>JDK_FILTER</code></li>

 578 </ul>
 579 <h2 id="running-tests">Running Tests</h2>
 580 <p>Most of the JDK 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=&lt;path to jtreg home&gt;</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>
 581 <p>The <a href="https://wiki.openjdk.java.net/display/Adoption">Adoption Group</a> provides recent builds of jtreg <a href="https://adopt-openjdk.ci.cloudbees.com/job/jtreg/lastSuccessfulBuild/artifact">here</a>. Download the latest <code>.tar.gz</code> file, unpack it, and point <code>--with-jtreg</code> to the <code>jtreg</code> directory that you just unpacked.</p>
 582 <p>To execute the most basic tests (tier 1), use:</p>
 583 <pre><code>make run-test-tier1</code></pre>
 584 <p>For more details on how to run tests, please see the <a href="testing.html">Testing the JDK</a> document.</p>
 585 <h2 id="cross-compiling">Cross-compiling</h2>
 586 <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>
 587 <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>
 588 <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 the JDK. 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>
 589 <p>Cross-compiling the JDK 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>
 590 <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>
 591 <h3 id="cross-compiling-the-easy-way-with-openjdk-devkits">Cross compiling the easy way with OpenJDK devkits</h3>
 592 <p>The OpenJDK build system provides out-of-the box support for creating and using so called devkits. A <code>devkit</code> is basically a collection of a cross-compiling toolchain and a sysroot environment which can easily be used together with the <code>--with-devkit</code> configure option to cross compile the OpenJDK. On Linux/x86_64, the following command:</p>
 593 <pre><code>bash configure --with-devkit=&lt;devkit-path&gt; --openjdk-target=ppc64-linux-gnu &amp;&amp; make</code></pre>
 594 <p>will configure and build OpenJDK for Linux/ppc64 assuming that <code>&lt;devkit-path&gt;</code> points to a Linux/x86_64 to Linux/ppc64 devkit.</p>
 595 <p>Devkits can be created from the <code>make/devkit</code> directory by executing:</p>
 596 <pre><code>make [ TARGETS=&quot;&lt;TARGET_TRIPLET&gt;+&quot; ] [ BASE_OS=&lt;OS&gt; ] [ BASE_OS_VERSION=&lt;VER&gt; ]</code></pre>
 597 <p>where <code>TARGETS</code> contains one or more <code>TARGET_TRIPLET</code>s of the form described in <a href="https://sourceware.org/autobook/autobook/autobook_17.html">section 3.4 of the GNU Autobook</a>. If no targets are given, a native toolchain for the current platform will be created. Currently, at least the following targets are known to work:</p>


< prev index next >