< prev index next >

doc/building.html

Print this page
rev 53999 : 8220164: Fix build instructions for AIX


 220 <h4 id="windows-subsystem-for-linux-wsl">Windows Subsystem for Linux (WSL)</h4>
 221 <p>Windows 10 1809 or newer is supported due to a dependency on the wslpath utility and support for environment variable sharing through WSLENV. Version 1803 can work but intermittent build failures have been observed.</p>
 222 <p>It's possible to build both Windows and Linux binaries from WSL. To build Windows binaries, you must use a Windows boot JDK (located in a Windows-accessible directory). To build Linux binaries, you must use a Linux boot JDK. The default behavior is to build for Windows. To build for Linux, pass <code>--build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu</code> to <code>configure</code>.</p>
 223 <p>If building Windows binaries, the source code must be located in a Windows- accessible directory. This is because Windows executables (such as Visual Studio and the boot JDK) must be able to access the source code. Also, the drive where the source is stored must be mounted as case-insensitive by changing either /etc/fstab or /etc/wsl.conf in WSL. Individual directories may be corrected using the fsutil tool in case the source was cloned before changing the mount options.</p>
 224 <p>Note that while it's possible to build on WSL, testing is still not fully supported.</p>
 225 <h3 id="solaris">Solaris</h3>
 226 <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>
 227 <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>
 228 <h3 id="macos">macOS</h3>
 229 <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 such as the JDK 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>
 230 <p>It is recommended that you use at least Mac OS X 10.13 (High Sierra). At the time of writing, the JDK has been successfully compiled on macOS 10.12 (Sierra).</p>
 231 <p>The standard macOS environment contains the basic tooling needed to build, but for external libraries a package manager is recommended. The JDK uses <a href="https://brew.sh/">homebrew</a> in the examples, but feel free to use whatever manager you want (or none).</p>
 232 <h3 id="linux">Linux</h3>
 233 <p>It is often not much problem to build the JDK on Linux. The only general advice is to try to use the compilers, external libraries and header files as provided by your distribution.</p>
 234 <p>The basic tooling is provided as part of the core operating system, but you will most likely need to install developer packages.</p>
 235 <p>For apt-based distributions (Debian, Ubuntu, etc), try this:</p>
 236 <pre><code>sudo apt-get install build-essential</code></pre>
 237 <p>For rpm-based distributions (Fedora, Red Hat, etc), try this:</p>
 238 <pre><code>sudo yum groupinstall &quot;Development Tools&quot;</code></pre>
 239 <h3 id="aix">AIX</h3>
 240 <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>
 241 <h2 id="native-compiler-toolchain-requirements">Native Compiler (Toolchain) Requirements</h2>
 242 <p>Large portions of the JDK 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>
 243 <table>
 244 <thead>
 245 <tr class="header">
 246 <th style="text-align: left;">Operating system</th>
 247 <th style="text-align: left;">Supported toolchain</th>
 248 </tr>
 249 </thead>
 250 <tbody>
 251 <tr class="odd">
 252 <td style="text-align: left;">Linux</td>
 253 <td style="text-align: left;">gcc, clang</td>
 254 </tr>
 255 <tr class="even">
 256 <td style="text-align: left;">macOS</td>
 257 <td style="text-align: left;">Apple Xcode (using clang)</td>
 258 </tr>
 259 <tr class="odd">
 260 <td style="text-align: left;">Solaris</td>


 356 <tr class="odd">
 357 <td style="text-align: left;">developer/solarisstudio-124/studio-legal</td>
 358 <td style="text-align: left;">12.4-1.0.0.1</td>
 359 </tr>
 360 <tr class="even">
 361 <td style="text-align: left;">developer/solarisstudio-124/studio-zhCN</td>
 362 <td style="text-align: left;">12.4-1.0.0.1</td>
 363 </tr>
 364 </tbody>
 365 </table>
 366 <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>
 367 <pre><code>$ cc -V
 368 cc: Sun C 5.13 SunOS_i386 2014/10/20
 369 $ CC -V
 370 CC: Sun C++ 5.13 SunOS_i386 151846-10 2015/10/30</code></pre>
 371 <h3 id="microsoft-visual-studio">Microsoft Visual Studio</h3>
 372 <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 2017. Versions older than 2017 are unlikely to continue working for long.</p>
 373 <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=2015</code>.</p>
 374 <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>
 375 <h3 id="ibm-xl-cc">IBM XL C/C++</h3>
 376 <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>
 377 <p>See the <a href="http://cr.openjdk.java.net/~simonis/ppc-aix-port">OpenJDK PowerPC Port Status Page</a> for details.</p>
 378 <h2 id="boot-jdk-requirements">Boot JDK Requirements</h2>
 379 <p>Paradoxically, building the JDK requires a pre-existing JDK. This is called the &quot;boot JDK&quot;. The boot JDK does not, however, have to be a JDK built directly from the source code available in the OpenJDK Community. If you are porting the JDK to a new platform, chances are that there already exists another JDK for that platform that is usable as boot JDK.</p>
 380 <p>The rule of thumb is that the boot JDK for building JDK major version <em>N</em> should be a JDK of major version <em>N-1</em>, so for building JDK 9 a JDK 8 would be suitable as boot JDK. However, the JDK should be able to &quot;build itself&quot;, so an up-to-date build of the current JDK source is an acceptable alternative. If you are following the <em>N-1</em> rule, make sure you've got the latest update version, since JDK 8 GA might not be able to build JDK 9 on all platforms.</p>
 381 <p>Early in the release cycle, version <em>N-1</em> may not yet have been released. In that case, the preferred boot JDK will be version <em>N-2</em> until version <em>N-1</em> is available.</p>
 382 <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>
 383 <h3 id="getting-jdk-binaries">Getting JDK binaries</h3>
 384 <p>JDK binaries for Linux, Windows and macOS can be downloaded from <a href="http://jdk.java.net">jdk.java.net</a>. 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 various platforms.</p>
 385 <p>On Linux you can also get a JDK from the Linux distribution. On apt-based distros (like Debian and Ubuntu), <code>sudo apt-get install openjdk-&lt;VERSION&gt;-jdk</code> is typically enough to install a JDK &lt;VERSION&gt;. On rpm-based distros (like Fedora and Red Hat), try <code>sudo yum install java-&lt;VERSION&gt;-openjdk-devel</code>.</p>
 386 <h2 id="external-library-requirements">External Library Requirements</h2>
 387 <p>Different platforms require different external libraries. In general, libraries are not optional - that is, they are either required or not used.</p>
 388 <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-&lt;LIB&gt;=&lt;path&gt;</code> or <code>--with-&lt;LIB&gt;-include=&lt;path to include&gt; --with-&lt;LIB&gt;-lib=&lt;path to lib&gt;</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>
 389 <p>As a fallback, the second version allows you to point to the include directory and the lib directory separately.</p>
 390 <h3 id="freetype">FreeType</h3>
 391 <p>FreeType2 from <a href="http://www.freetype.org/">The FreeType Project</a> is not required on any platform. The exception is on Unix-based platforms when configuring such that the build artifacts will reference a system installed library, rather than bundling the JDK’s own copy.</p>
 392 <ul>
 393 <li>To install on an apt-based Linux, try running <code>sudo apt-get install libfreetype6-dev</code>.</li>
 394 <li>To install on an rpm-based Linux, try running <code>sudo yum install freetype-devel</code>.</li>
 395 <li>To install on Solaris, try running <code>pkg install system/library/freetype-2</code>.</li>
 396 </ul>
 397 <p>Use <code>--with-freetype-include=&lt;path&gt;</code> and <code>--with-freetype-lib=&lt;path&gt;</code> if <code>configure</code> does not automatically locate the platform FreeType files.</p>




 220 <h4 id="windows-subsystem-for-linux-wsl">Windows Subsystem for Linux (WSL)</h4>
 221 <p>Windows 10 1809 or newer is supported due to a dependency on the wslpath utility and support for environment variable sharing through WSLENV. Version 1803 can work but intermittent build failures have been observed.</p>
 222 <p>It's possible to build both Windows and Linux binaries from WSL. To build Windows binaries, you must use a Windows boot JDK (located in a Windows-accessible directory). To build Linux binaries, you must use a Linux boot JDK. The default behavior is to build for Windows. To build for Linux, pass <code>--build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu</code> to <code>configure</code>.</p>
 223 <p>If building Windows binaries, the source code must be located in a Windows- accessible directory. This is because Windows executables (such as Visual Studio and the boot JDK) must be able to access the source code. Also, the drive where the source is stored must be mounted as case-insensitive by changing either /etc/fstab or /etc/wsl.conf in WSL. Individual directories may be corrected using the fsutil tool in case the source was cloned before changing the mount options.</p>
 224 <p>Note that while it's possible to build on WSL, testing is still not fully supported.</p>
 225 <h3 id="solaris">Solaris</h3>
 226 <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>
 227 <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>
 228 <h3 id="macos">macOS</h3>
 229 <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 such as the JDK 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>
 230 <p>It is recommended that you use at least Mac OS X 10.13 (High Sierra). At the time of writing, the JDK has been successfully compiled on macOS 10.12 (Sierra).</p>
 231 <p>The standard macOS environment contains the basic tooling needed to build, but for external libraries a package manager is recommended. The JDK uses <a href="https://brew.sh/">homebrew</a> in the examples, but feel free to use whatever manager you want (or none).</p>
 232 <h3 id="linux">Linux</h3>
 233 <p>It is often not much problem to build the JDK on Linux. The only general advice is to try to use the compilers, external libraries and header files as provided by your distribution.</p>
 234 <p>The basic tooling is provided as part of the core operating system, but you will most likely need to install developer packages.</p>
 235 <p>For apt-based distributions (Debian, Ubuntu, etc), try this:</p>
 236 <pre><code>sudo apt-get install build-essential</code></pre>
 237 <p>For rpm-based distributions (Fedora, Red Hat, etc), try this:</p>
 238 <pre><code>sudo yum groupinstall &quot;Development Tools&quot;</code></pre>
 239 <h3 id="aix">AIX</h3>
 240 <p>Please consult the AIX section of the <a href="https://wiki.openjdk.java.net/display/Build/Supported+Build+Platforms">Supported Build Platforms</a> OpenJDK Build Wiki page for details about which versions of AIX are supported.</p>
 241 <h2 id="native-compiler-toolchain-requirements">Native Compiler (Toolchain) Requirements</h2>
 242 <p>Large portions of the JDK 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>
 243 <table>
 244 <thead>
 245 <tr class="header">
 246 <th style="text-align: left;">Operating system</th>
 247 <th style="text-align: left;">Supported toolchain</th>
 248 </tr>
 249 </thead>
 250 <tbody>
 251 <tr class="odd">
 252 <td style="text-align: left;">Linux</td>
 253 <td style="text-align: left;">gcc, clang</td>
 254 </tr>
 255 <tr class="even">
 256 <td style="text-align: left;">macOS</td>
 257 <td style="text-align: left;">Apple Xcode (using clang)</td>
 258 </tr>
 259 <tr class="odd">
 260 <td style="text-align: left;">Solaris</td>


 356 <tr class="odd">
 357 <td style="text-align: left;">developer/solarisstudio-124/studio-legal</td>
 358 <td style="text-align: left;">12.4-1.0.0.1</td>
 359 </tr>
 360 <tr class="even">
 361 <td style="text-align: left;">developer/solarisstudio-124/studio-zhCN</td>
 362 <td style="text-align: left;">12.4-1.0.0.1</td>
 363 </tr>
 364 </tbody>
 365 </table>
 366 <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>
 367 <pre><code>$ cc -V
 368 cc: Sun C 5.13 SunOS_i386 2014/10/20
 369 $ CC -V
 370 CC: Sun C++ 5.13 SunOS_i386 151846-10 2015/10/30</code></pre>
 371 <h3 id="microsoft-visual-studio">Microsoft Visual Studio</h3>
 372 <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 2017. Versions older than 2017 are unlikely to continue working for long.</p>
 373 <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=2015</code>.</p>
 374 <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>
 375 <h3 id="ibm-xl-cc">IBM XL C/C++</h3>
 376 <p>Please consult the AIX section of the <a href="https://wiki.openjdk.java.net/display/Build/Supported+Build+Platforms">Supported Build Platforms</a> OpenJDK Build Wiki page for details about which versions of XLC are supported.</p>

 377 <h2 id="boot-jdk-requirements">Boot JDK Requirements</h2>
 378 <p>Paradoxically, building the JDK requires a pre-existing JDK. This is called the &quot;boot JDK&quot;. The boot JDK does not, however, have to be a JDK built directly from the source code available in the OpenJDK Community. If you are porting the JDK to a new platform, chances are that there already exists another JDK for that platform that is usable as boot JDK.</p>
 379 <p>The rule of thumb is that the boot JDK for building JDK major version <em>N</em> should be a JDK of major version <em>N-1</em>, so for building JDK 9 a JDK 8 would be suitable as boot JDK. However, the JDK should be able to &quot;build itself&quot;, so an up-to-date build of the current JDK source is an acceptable alternative. If you are following the <em>N-1</em> rule, make sure you've got the latest update version, since JDK 8 GA might not be able to build JDK 9 on all platforms.</p>
 380 <p>Early in the release cycle, version <em>N-1</em> may not yet have been released. In that case, the preferred boot JDK will be version <em>N-2</em> until version <em>N-1</em> is available.</p>
 381 <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>
 382 <h3 id="getting-jdk-binaries">Getting JDK binaries</h3>
 383 <p>JDK binaries for Linux, Windows and macOS can be downloaded from <a href="http://jdk.java.net">jdk.java.net</a>. 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 various platforms.</p>
 384 <p>On Linux you can also get a JDK from the Linux distribution. On apt-based distros (like Debian and Ubuntu), <code>sudo apt-get install openjdk-&lt;VERSION&gt;-jdk</code> is typically enough to install a JDK &lt;VERSION&gt;. On rpm-based distros (like Fedora and Red Hat), try <code>sudo yum install java-&lt;VERSION&gt;-openjdk-devel</code>.</p>
 385 <h2 id="external-library-requirements">External Library Requirements</h2>
 386 <p>Different platforms require different external libraries. In general, libraries are not optional - that is, they are either required or not used.</p>
 387 <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-&lt;LIB&gt;=&lt;path&gt;</code> or <code>--with-&lt;LIB&gt;-include=&lt;path to include&gt; --with-&lt;LIB&gt;-lib=&lt;path to lib&gt;</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>
 388 <p>As a fallback, the second version allows you to point to the include directory and the lib directory separately.</p>
 389 <h3 id="freetype">FreeType</h3>
 390 <p>FreeType2 from <a href="http://www.freetype.org/">The FreeType Project</a> is not required on any platform. The exception is on Unix-based platforms when configuring such that the build artifacts will reference a system installed library, rather than bundling the JDK’s own copy.</p>
 391 <ul>
 392 <li>To install on an apt-based Linux, try running <code>sudo apt-get install libfreetype6-dev</code>.</li>
 393 <li>To install on an rpm-based Linux, try running <code>sudo yum install freetype-devel</code>.</li>
 394 <li>To install on Solaris, try running <code>pkg install system/library/freetype-2</code>.</li>
 395 </ul>
 396 <p>Use <code>--with-freetype-include=&lt;path&gt;</code> and <code>--with-freetype-lib=&lt;path&gt;</code> if <code>configure</code> does not automatically locate the platform FreeType files.</p>


< prev index next >