doc/building.html
author darcy
Tue, 15 Oct 2019 13:25:57 -0700
changeset 58609 fbfc72ec8e6b
parent 58559 06bd38a9bc5a
child 58679 9c3209ff7550
child 58909 66f7d2494d4e
permissions -rw-r--r--
8232234: Suppress warnings on non-serializable non-transient instance fields in java.rmi Reviewed-by: rriggs
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
45227
97be1bcd7b25 8180472: Pandoc should generate html5 from markdown
ihse
parents: 45103
diff changeset
     1
<!DOCTYPE html>
52941
a430555c3d4e 8215131: Pandoc 2.3/build documentation fixes
ihse
parents: 52921
diff changeset
     2
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
44078
673240c54c2e 8176509: Use pandoc for converting build readme to html
ihse
parents: 41040
diff changeset
     3
<head>
52941
a430555c3d4e 8215131: Pandoc 2.3/build documentation fixes
ihse
parents: 52921
diff changeset
     4
  <meta charset="utf-8" />
a430555c3d4e 8215131: Pandoc 2.3/build documentation fixes
ihse
parents: 52921
diff changeset
     5
  <meta name="generator" content="pandoc" />
a430555c3d4e 8215131: Pandoc 2.3/build documentation fixes
ihse
parents: 52921
diff changeset
     6
  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
     7
  <title>Building the JDK</title>
52941
a430555c3d4e 8215131: Pandoc 2.3/build documentation fixes
ihse
parents: 52921
diff changeset
     8
  <style type="text/css">
a430555c3d4e 8215131: Pandoc 2.3/build documentation fixes
ihse
parents: 52921
diff changeset
     9
      code{white-space: pre-wrap;}
a430555c3d4e 8215131: Pandoc 2.3/build documentation fixes
ihse
parents: 52921
diff changeset
    10
      span.smallcaps{font-variant: small-caps;}
a430555c3d4e 8215131: Pandoc 2.3/build documentation fixes
ihse
parents: 52921
diff changeset
    11
      span.underline{text-decoration: underline;}
a430555c3d4e 8215131: Pandoc 2.3/build documentation fixes
ihse
parents: 52921
diff changeset
    12
      div.column{display: inline-block; vertical-align: top; width: 50%;}
a430555c3d4e 8215131: Pandoc 2.3/build documentation fixes
ihse
parents: 52921
diff changeset
    13
  </style>
a430555c3d4e 8215131: Pandoc 2.3/build documentation fixes
ihse
parents: 52921
diff changeset
    14
  <link rel="stylesheet" href="../make/data/docs-resources/resources/jdk-default.css" />
45227
97be1bcd7b25 8180472: Pandoc should generate html5 from markdown
ihse
parents: 45103
diff changeset
    15
  <!--[if lt IE 9]>
97be1bcd7b25 8180472: Pandoc should generate html5 from markdown
ihse
parents: 45103
diff changeset
    16
    <script src="//cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv-printshiv.min.js"></script>
97be1bcd7b25 8180472: Pandoc should generate html5 from markdown
ihse
parents: 45103
diff changeset
    17
  <![endif]-->
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    18
  <style type="text/css">pre, code, tt { color: #1d6ae5; }</style>
44078
673240c54c2e 8176509: Use pandoc for converting build readme to html
ihse
parents: 41040
diff changeset
    19
</head>
673240c54c2e 8176509: Use pandoc for converting build readme to html
ihse
parents: 41040
diff changeset
    20
<body>
52941
a430555c3d4e 8215131: Pandoc 2.3/build documentation fixes
ihse
parents: 52921
diff changeset
    21
<header id="title-block-header">
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
    22
<h1 class="title">Building the JDK</h1>
45227
97be1bcd7b25 8180472: Pandoc should generate html5 from markdown
ihse
parents: 45103
diff changeset
    23
</header>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    24
<nav id="TOC">
33030
de12d9a875ed 8139668: Generate README-build.html from markdown
ihse
parents: 29865
diff changeset
    25
<ul>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    26
<li><a href="#tldr-instructions-for-the-impatient">TL;DR (Instructions for the Impatient)</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    27
<li><a href="#introduction">Introduction</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    28
<li><a href="#getting-the-source-code">Getting the Source Code</a><ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    29
<li><a href="#special-considerations">Special Considerations</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    30
</ul></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    31
<li><a href="#build-hardware-requirements">Build Hardware Requirements</a><ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    32
<li><a href="#building-on-x86">Building on x86</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    33
<li><a href="#building-on-sparc">Building on sparc</a></li>
51644
0df09dadd445 8182733: aarch64 build documentation misleading
ihse
parents: 51515
diff changeset
    34
<li><a href="#building-on-aarch64">Building on aarch64</a></li>
0df09dadd445 8182733: aarch64 build documentation misleading
ihse
parents: 51515
diff changeset
    35
<li><a href="#building-on-32-bit-arm">Building on 32-bit arm</a></li>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    36
</ul></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    37
<li><a href="#operating-system-requirements">Operating System Requirements</a><ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    38
<li><a href="#windows">Windows</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    39
<li><a href="#solaris">Solaris</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    40
<li><a href="#macos">macOS</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    41
<li><a href="#linux">Linux</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    42
<li><a href="#aix">AIX</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    43
</ul></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    44
<li><a href="#native-compiler-toolchain-requirements">Native Compiler (Toolchain) Requirements</a><ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    45
<li><a href="#gcc">gcc</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    46
<li><a href="#clang">clang</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    47
<li><a href="#apple-xcode">Apple Xcode</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    48
<li><a href="#oracle-solaris-studio">Oracle Solaris Studio</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    49
<li><a href="#microsoft-visual-studio">Microsoft Visual Studio</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    50
<li><a href="#ibm-xl-cc">IBM XL C/C++</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    51
</ul></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    52
<li><a href="#boot-jdk-requirements">Boot JDK Requirements</a><ul>
49159
436f1e03fd04 8199266: Update boot and build jdk requirements in configure
erikj
parents: 48743
diff changeset
    53
<li><a href="#getting-jdk-binaries">Getting JDK binaries</a></li>
33030
de12d9a875ed 8139668: Generate README-build.html from markdown
ihse
parents: 29865
diff changeset
    54
</ul></li>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    55
<li><a href="#external-library-requirements">External Library Requirements</a><ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    56
<li><a href="#freetype">FreeType</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    57
<li><a href="#cups">CUPS</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    58
<li><a href="#x11">X11</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    59
<li><a href="#alsa">ALSA</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    60
<li><a href="#libffi">libffi</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    61
</ul></li>
48743
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents: 47928
diff changeset
    62
<li><a href="#build-tools-requirements">Build Tools Requirements</a><ul>
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents: 47928
diff changeset
    63
<li><a href="#autoconf">Autoconf</a></li>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    64
<li><a href="#gnu-make">GNU Make</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    65
<li><a href="#gnu-bash">GNU Bash</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    66
</ul></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    67
<li><a href="#running-configure">Running Configure</a><ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    68
<li><a href="#common-configure-arguments">Common Configure Arguments</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    69
<li><a href="#configure-control-variables">Configure Control Variables</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    70
</ul></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    71
<li><a href="#running-make">Running Make</a><ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    72
<li><a href="#common-make-targets">Common Make Targets</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    73
<li><a href="#make-control-variables">Make Control Variables</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    74
</ul></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    75
<li><a href="#running-tests">Running Tests</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    76
<li><a href="#cross-compiling">Cross-compiling</a><ul>
52665
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
    77
<li><a href="#cross-compiling-the-easy-way-with-openjdk-devkits">Cross compiling the easy way with OpenJDK devkits</a></li>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    78
<li><a href="#boot-jdk-and-build-jdk">Boot JDK and Build JDK</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    79
<li><a href="#specifying-the-target-platform">Specifying the Target Platform</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    80
<li><a href="#toolchain-considerations">Toolchain Considerations</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    81
<li><a href="#native-libraries">Native Libraries</a></li>
51515
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
    82
<li><a href="#creating-and-using-sysroots-with-qemu-deboostrap">Creating And Using Sysroots With qemu-deboostrap</a></li>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    83
<li><a href="#building-for-armaarch64">Building for ARM/aarch64</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    84
<li><a href="#verifying-the-build">Verifying the Build</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    85
</ul></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    86
<li><a href="#build-performance">Build Performance</a><ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    87
<li><a href="#disk-speed">Disk Speed</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    88
<li><a href="#virus-checking">Virus Checking</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    89
<li><a href="#ccache">Ccache</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    90
<li><a href="#precompiled-headers">Precompiled Headers</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    91
<li><a href="#icecc-icecream">Icecc / icecream</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    92
<li><a href="#using-sjavac">Using sjavac</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    93
<li><a href="#building-the-right-target">Building the Right Target</a></li>
33030
de12d9a875ed 8139668: Generate README-build.html from markdown
ihse
parents: 29865
diff changeset
    94
</ul></li>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    95
<li><a href="#troubleshooting">Troubleshooting</a><ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    96
<li><a href="#locating-the-source-of-the-error">Locating the Source of the Error</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    97
<li><a href="#fixing-unexpected-build-failures">Fixing Unexpected Build Failures</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    98
<li><a href="#specific-build-issues">Specific Build Issues</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
    99
<li><a href="#getting-help">Getting Help</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   100
</ul></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   101
<li><a href="#hints-and-suggestions-for-advanced-users">Hints and Suggestions for Advanced Users</a><ul>
52610
7ac273f045e3 8214062: JDK-8167368 Leftover: get_source.sh in build documentation
erikj
parents: 52351
diff changeset
   102
<li><a href="#setting-up-a-repository-for-pushing-changes-defpath">Setting Up a Repository for Pushing Changes (defpath)</a></li>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   103
<li><a href="#bash-completion">Bash Completion</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   104
<li><a href="#using-multiple-configurations">Using Multiple Configurations</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   105
<li><a href="#handling-reconfigurations">Handling Reconfigurations</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   106
<li><a href="#using-fine-grained-make-targets">Using Fine-Grained Make Targets</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   107
<li><a href="#learn-about-mercurial">Learn About Mercurial</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   108
</ul></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   109
<li><a href="#understanding-the-build-system">Understanding the Build System</a><ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   110
<li><a href="#configurations">Configurations</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   111
<li><a href="#build-output-structure">Build Output Structure</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   112
<li><a href="#fixpath">Fixpath</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   113
<li><a href="#native-debug-symbols">Native Debug Symbols</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   114
<li><a href="#autoconf-details">Autoconf Details</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   115
<li><a href="#developing-the-build-system-itself">Developing the Build System Itself</a></li>
33030
de12d9a875ed 8139668: Generate README-build.html from markdown
ihse
parents: 29865
diff changeset
   116
</ul></li>
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
   117
<li><a href="#contributing-to-the-jdk">Contributing to the JDK</a></li>
33030
de12d9a875ed 8139668: Generate README-build.html from markdown
ihse
parents: 29865
diff changeset
   118
</ul>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   119
</nav>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   120
<h2 id="tldr-instructions-for-the-impatient">TL;DR (Instructions for the Impatient)</h2>
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
   121
<p>If you are eager to try out building the JDK, 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 JDK repository that you want to build.</p>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   122
<ol type="1">
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   123
<li><p><a href="#getting-the-source-code">Get the complete source code</a>:<br />
48743
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents: 47928
diff changeset
   124
<code>hg clone http://hg.openjdk.java.net/jdk/jdk</code></p></li>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   125
<li><p><a href="#running-configure">Run configure</a>:<br />
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   126
<code>bash configure</code></p>
48743
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents: 47928
diff changeset
   127
<p>If <code>configure</code> fails due to missing dependencies (to either the <a href="#native-compiler-toolchain-requirements">toolchain</a>, <a href="#build-tools-requirements">build tools</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>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   128
<li><p><a href="#running-make">Run make</a>:<br />
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   129
<code>make images</code></p></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   130
<li><p>Verify your newly built JDK:<br />
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   131
<code>./build/*/images/jdk/bin/java -version</code></p></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   132
<li><p><a href="##running-tests">Run basic tests</a>:<br />
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   133
<code>make run-test-tier1</code></p></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   134
</ol>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   135
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   136
<h2 id="introduction">Introduction</h2>
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
   137
<p>The JDK 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>
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
   138
<p>If you just want to use the JDK 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 JDK.</p>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   139
<h2 id="getting-the-source-code">Getting the Source Code</h2>
52610
7ac273f045e3 8214062: JDK-8167368 Leftover: get_source.sh in build documentation
erikj
parents: 52351
diff changeset
   140
<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 repositories. 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>
51237
ea900a7dc7d7 8208096: Update build documentation to reflect compiler upgrades at Oracle
erikj
parents: 50885
diff changeset
   141
<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>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   142
<h3 id="special-considerations">Special Considerations</h3>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   143
<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>
33030
de12d9a875ed 8139668: Generate README-build.html from markdown
ihse
parents: 29865
diff changeset
   144
<ul>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   145
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   146
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   147
<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>
53110
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52941
diff changeset
   148
<li><p>On Windows, if using <a href="#cygwin">Cygwin</a>, extra care must be taken to make sure the environment is consistent. It is recommended that you follow this procedure:</p>
33030
de12d9a875ed 8139668: Generate README-build.html from markdown
ihse
parents: 29865
diff changeset
   149
<ul>
51237
ea900a7dc7d7 8208096: Update build documentation to reflect compiler upgrades at Oracle
erikj
parents: 50885
diff changeset
   150
<li><p>Create the directory that is going to contain the top directory of the JDK 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>
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
   151
<li><p>Do not put the JDK 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>
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
   152
<li><p>Clone the JDK 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>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   153
</ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   154
<p>Failure to follow this procedure might result in hard-to-debug build problems.</p></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   155
</ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   156
<h2 id="build-hardware-requirements">Build Hardware Requirements</h2>
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
   157
<p>The JDK 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>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   158
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   159
<h3 id="building-on-x86">Building on x86</h3>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   160
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   161
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   162
<h3 id="building-on-sparc">Building on sparc</h3>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   163
<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>
51644
0df09dadd445 8182733: aarch64 build documentation misleading
ihse
parents: 51515
diff changeset
   164
<h3 id="building-on-aarch64">Building on aarch64</h3>
0df09dadd445 8182733: aarch64 build documentation misleading
ihse
parents: 51515
diff changeset
   165
<p>At a minimum, a machine with 8 cores is advisable, as well as 8 GB of RAM. (The more cores to use, the more memory you need.) At least 6 GB of free disk space is required.</p>
0df09dadd445 8182733: aarch64 build documentation misleading
ihse
parents: 51515
diff changeset
   166
<p>If you do not have access to sufficiently powerful hardware, it is also possible to use <a href="#cross-compiling">cross-compiling</a>.</p>
0df09dadd445 8182733: aarch64 build documentation misleading
ihse
parents: 51515
diff changeset
   167
<h3 id="building-on-32-bit-arm">Building on 32-bit arm</h3>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   168
<p>This is not recommended. Instead, see the section on <a href="#cross-compiling">Cross-compiling</a>.</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   169
<h2 id="operating-system-requirements">Operating System Requirements</h2>
51237
ea900a7dc7d7 8208096: Update build documentation to reflect compiler upgrades at Oracle
erikj
parents: 50885
diff changeset
   170
<p>The mainline JDK project supports Linux, Solaris, macOS, AIX and Windows. Support for other operating system, e.g. BSD, exists in separate &quot;port&quot; projects.</p>
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
   171
<p>In general, the JDK 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>
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
   172
<p>This table lists the OS versions used by Oracle when building the JDK. Such information is always subject to change, but this table is up to date at the time of writing.</p>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   173
<table>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   174
<thead>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   175
<tr class="header">
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   176
<th style="text-align: left;">Operating system</th>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   177
<th style="text-align: left;">Vendor/version used</th>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   178
</tr>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   179
</thead>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   180
<tbody>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   181
<tr class="odd">
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   182
<td style="text-align: left;">Linux</td>
54581
5c456dd47ff1 8222735: Update doc/building.md with current Oracle build platforms and compilers
erikj
parents: 54001
diff changeset
   183
<td style="text-align: left;">Oracle Enterprise Linux 6.4 / 7.6</td>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   184
</tr>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   185
<tr class="even">
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   186
<td style="text-align: left;">Solaris</td>
54918
b88bcaa94c10 8223944: fix zlib related building docu and comments
mbaesken
parents: 54635
diff changeset
   187
<td style="text-align: left;">Solaris 11.3 SRU 20</td>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   188
</tr>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   189
<tr class="odd">
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   190
<td style="text-align: left;">macOS</td>
54581
5c456dd47ff1 8222735: Update doc/building.md with current Oracle build platforms and compilers
erikj
parents: 54001
diff changeset
   191
<td style="text-align: left;">Mac OS X 10.13 (High Sierra)</td>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   192
</tr>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   193
<tr class="even">
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   194
<td style="text-align: left;">Windows</td>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   195
<td style="text-align: left;">Windows Server 2012 R2</td>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   196
</tr>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   197
</tbody>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   198
</table>
54581
5c456dd47ff1 8222735: Update doc/building.md with current Oracle build platforms and compilers
erikj
parents: 54001
diff changeset
   199
<p>The double version numbers for Linux and Solaris are due to the hybrid model used at Oracle, where header files and external libraries from an older version are used when building on a more modern version of the OS.</p>
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
   200
<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 contributors to list successes or failures of building on different platforms.</p>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   201
<h3 id="windows">Windows</h3>
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
   202
<p>Windows XP is not a supported platform, but all newer Windows should be able to build the JDK.</p>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   203
<p>On Windows, it is important that you pay attention to the instructions in the <a href="#special-considerations">Special Considerations</a>.</p>
53110
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52941
diff changeset
   204
<p>Windows is the only non-POSIX OS supported by the JDK, and as such, requires some extra care. A POSIX support layer is required to build on Windows. Currently, the only supported such layers are Cygwin and Windows Subsystem for Linux (WSL). (Msys is no longer supported due to a too old bash; msys2 would likely be possible to support in a future version but that would require effort to implement.)</p>
51237
ea900a7dc7d7 8208096: Update build documentation to reflect compiler upgrades at Oracle
erikj
parents: 50885
diff changeset
   205
<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>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   206
<h4 id="cygwin">Cygwin</h4>
53110
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52941
diff changeset
   207
<p>A functioning <a href="http://www.cygwin.com/">Cygwin</a> environment is required for building the JDK on Windows. If you have a 64-bit OS, we strongly recommend using the 64-bit version of Cygwin.</p>
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
   208
<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 JDK build process, and that can cause unexpected build problems.</p>
53110
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52941
diff changeset
   209
<p>The JDK requires GNU Make 4.0 or greater in Cygwin. This is usually not a problem, since Cygwin currently only distributes GNU Make at a version above 4.0.</p>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   210
<p>Apart from the basic Cygwin installation, the following packages must also be installed:</p>
33030
de12d9a875ed 8139668: Generate README-build.html from markdown
ihse
parents: 29865
diff changeset
   211
<ul>
48743
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents: 47928
diff changeset
   212
<li><code>autoconf</code></li>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   213
<li><code>make</code></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   214
<li><code>zip</code></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   215
<li><code>unzip</code></li>
33030
de12d9a875ed 8139668: Generate README-build.html from markdown
ihse
parents: 29865
diff changeset
   216
</ul>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   217
<p>Often, you can install these packages using the following command line:</p>
48743
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents: 47928
diff changeset
   218
<pre><code>&lt;path to Cygwin setup&gt;/setup-x86_64 -q -P autoconf -P make -P unzip -P zip</code></pre>
51237
ea900a7dc7d7 8208096: Update build documentation to reflect compiler upgrades at Oracle
erikj
parents: 50885
diff changeset
   219
<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">&quot;BLODA&quot; list</a> and the section on <a href="https://cygwin.com/faq/faq.html#faq.using.fixing-fork-failures">fork() failures</a>.</p>
53110
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52941
diff changeset
   220
<h4 id="windows-subsystem-for-linux-wsl">Windows Subsystem for Linux (WSL)</h4>
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52941
diff changeset
   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>
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52941
diff changeset
   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>
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52941
diff changeset
   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>
50677f43ac3d 8215445: Enable building for Windows in WSL
erikj
parents: 52941
diff changeset
   224
<p>Note that while it's possible to build on WSL, testing is still not fully supported.</p>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   225
<h3 id="solaris">Solaris</h3>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   228
<h3 id="macos">macOS</h3>
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
   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>
51237
ea900a7dc7d7 8208096: Update build documentation to reflect compiler upgrades at Oracle
erikj
parents: 50885
diff changeset
   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>
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
   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>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   232
<h3 id="linux">Linux</h3>
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
   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>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   235
<p>For apt-based distributions (Debian, Ubuntu, etc), try this:</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   236
<pre><code>sudo apt-get install build-essential</code></pre>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   237
<p>For rpm-based distributions (Fedora, Red Hat, etc), try this:</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   238
<pre><code>sudo yum groupinstall &quot;Development Tools&quot;</code></pre>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   239
<h3 id="aix">AIX</h3>
54001
b4e59fc5edd1 8220164: Fix build instructions for AIX
simonis
parents: 53110
diff changeset
   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>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   241
<h2 id="native-compiler-toolchain-requirements">Native Compiler (Toolchain) Requirements</h2>
51237
ea900a7dc7d7 8208096: Update build documentation to reflect compiler upgrades at Oracle
erikj
parents: 50885
diff changeset
   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>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   243
<table>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   244
<thead>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   245
<tr class="header">
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   246
<th style="text-align: left;">Operating system</th>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   247
<th style="text-align: left;">Supported toolchain</th>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   248
</tr>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   249
</thead>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   250
<tbody>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   251
<tr class="odd">
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   252
<td style="text-align: left;">Linux</td>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   253
<td style="text-align: left;">gcc, clang</td>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   254
</tr>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   255
<tr class="even">
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   256
<td style="text-align: left;">macOS</td>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   257
<td style="text-align: left;">Apple Xcode (using clang)</td>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   258
</tr>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   259
<tr class="odd">
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   260
<td style="text-align: left;">Solaris</td>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   261
<td style="text-align: left;">Oracle Solaris Studio</td>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   262
</tr>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   263
<tr class="even">
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   264
<td style="text-align: left;">AIX</td>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   265
<td style="text-align: left;">IBM XL C/C++</td>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   266
</tr>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   267
<tr class="odd">
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   268
<td style="text-align: left;">Windows</td>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   269
<td style="text-align: left;">Microsoft Visual Studio</td>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   270
</tr>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   271
</tbody>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   272
</table>
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
   273
<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 the JDK. It should be possible to compile the JDK 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>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   274
<table>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   275
<thead>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   276
<tr class="header">
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   277
<th style="text-align: left;">Operating system</th>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   278
<th style="text-align: left;">Toolchain version</th>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   279
</tr>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   280
</thead>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   281
<tbody>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   282
<tr class="odd">
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   283
<td style="text-align: left;">Linux</td>
58558
67daaa6c8d2b 8232133: Change to GCC 8.3 for building on Linux at Oracle
erikj
parents: 57881
diff changeset
   284
<td style="text-align: left;">gcc 8.3.0</td>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   285
</tr>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   286
<tr class="even">
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   287
<td style="text-align: left;">macOS</td>
54581
5c456dd47ff1 8222735: Update doc/building.md with current Oracle build platforms and compilers
erikj
parents: 54001
diff changeset
   288
<td style="text-align: left;">Apple Xcode 10.1 (using clang 10.0.0)</td>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   289
</tr>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   290
<tr class="odd">
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   291
<td style="text-align: left;">Solaris</td>
54581
5c456dd47ff1 8222735: Update doc/building.md with current Oracle build platforms and compilers
erikj
parents: 54001
diff changeset
   292
<td style="text-align: left;">Oracle Solaris Studio 12.6 (with compiler version 5.15)</td>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   293
</tr>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   294
<tr class="even">
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   295
<td style="text-align: left;">Windows</td>
58559
06bd38a9bc5a 8232134: Change to Visual Studio 2017 15.9.16 for building on Windows at Oracle
erikj
parents: 58558
diff changeset
   296
<td style="text-align: left;">Microsoft Visual Studio 2017 update 15.9.16</td>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   297
</tr>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   298
</tbody>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   299
</table>
57493
b95ebdbf68ca 8226910: make it possible to use jtreg's -match via run-test framework
iignatyev
parents: 54999
diff changeset
   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>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   301
<h3 id="gcc">gcc</h3>
50586
4bba6dea2e73 8200867: Remove references to "jdk 9" in build system
ihse
parents: 50490
diff changeset
   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>
58558
67daaa6c8d2b 8232133: Change to GCC 8.3 for building on Linux at Oracle
erikj
parents: 57881
diff changeset
   303
<p>The JDK is currently known to be able to compile with at least version 8.3 of gcc.</p>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   304
<p>In general, any version between these two should be usable.</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   305
<h3 id="clang">clang</h3>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   306
<p>The minimum accepted version of clang is 3.2. Older versions will not be accepted by <code>configure</code>.</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   307
<p>To use clang instead of gcc on Linux, use <code>--with-toolchain-type=clang</code>.</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   308
<h3 id="apple-xcode">Apple Xcode</h3>
51237
ea900a7dc7d7 8208096: Update build documentation to reflect compiler upgrades at Oracle
erikj
parents: 50885
diff changeset
   309
<p>The oldest supported version of Xcode is 8.</p>
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
   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>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   311
<pre><code>xcode-select --install</code></pre>
51237
ea900a7dc7d7 8208096: Update build documentation to reflect compiler upgrades at Oracle
erikj
parents: 50885
diff changeset
   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>
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
   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>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   314
<h3 id="oracle-solaris-studio">Oracle Solaris Studio</h3>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   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>
44078
673240c54c2e 8176509: Use pandoc for converting build readme to html
ihse
parents: 41040
diff changeset
   316
<p>The Solaris Studio installation should contain at least these packages:</p>
673240c54c2e 8176509: Use pandoc for converting build readme to html
ihse
parents: 41040
diff changeset
   317
<table>
673240c54c2e 8176509: Use pandoc for converting build readme to html
ihse
parents: 41040
diff changeset
   318
<thead>
673240c54c2e 8176509: Use pandoc for converting build readme to html
ihse
parents: 41040
diff changeset
   319
<tr class="header">
45227
97be1bcd7b25 8180472: Pandoc should generate html5 from markdown
ihse
parents: 45103
diff changeset
   320
<th style="text-align: left;">Package</th>
97be1bcd7b25 8180472: Pandoc should generate html5 from markdown
ihse
parents: 45103
diff changeset
   321
<th style="text-align: left;">Version</th>
44078
673240c54c2e 8176509: Use pandoc for converting build readme to html
ihse
parents: 41040
diff changeset
   322
</tr>
673240c54c2e 8176509: Use pandoc for converting build readme to html
ihse
parents: 41040
diff changeset
   323
</thead>
673240c54c2e 8176509: Use pandoc for converting build readme to html
ihse
parents: 41040
diff changeset
   324
<tbody>
673240c54c2e 8176509: Use pandoc for converting build readme to html
ihse
parents: 41040
diff changeset
   325
<tr class="odd">
45227
97be1bcd7b25 8180472: Pandoc should generate html5 from markdown
ihse
parents: 45103
diff changeset
   326
<td style="text-align: left;">developer/solarisstudio-124/backend</td>
97be1bcd7b25 8180472: Pandoc should generate html5 from markdown
ihse
parents: 45103
diff changeset
   327
<td style="text-align: left;">12.4-1.0.6.0</td>
44078
673240c54c2e 8176509: Use pandoc for converting build readme to html
ihse
parents: 41040
diff changeset
   328
</tr>
673240c54c2e 8176509: Use pandoc for converting build readme to html
ihse
parents: 41040
diff changeset
   329
<tr class="even">
45227
97be1bcd7b25 8180472: Pandoc should generate html5 from markdown
ihse
parents: 45103
diff changeset
   330
<td style="text-align: left;">developer/solarisstudio-124/c++</td>
97be1bcd7b25 8180472: Pandoc should generate html5 from markdown
ihse
parents: 45103
diff changeset
   331
<td style="text-align: left;">12.4-1.0.10.0</td>
44078
673240c54c2e 8176509: Use pandoc for converting build readme to html
ihse
parents: 41040
diff changeset
   332
</tr>
673240c54c2e 8176509: Use pandoc for converting build readme to html
ihse
parents: 41040
diff changeset
   333
<tr class="odd">
45227
97be1bcd7b25 8180472: Pandoc should generate html5 from markdown
ihse
parents: 45103
diff changeset
   334
<td style="text-align: left;">developer/solarisstudio-124/cc</td>
97be1bcd7b25 8180472: Pandoc should generate html5 from markdown
ihse
parents: 45103
diff changeset
   335
<td style="text-align: left;">12.4-1.0.4.0</td>
44078
673240c54c2e 8176509: Use pandoc for converting build readme to html
ihse
parents: 41040
diff changeset
   336
</tr>
673240c54c2e 8176509: Use pandoc for converting build readme to html
ihse
parents: 41040
diff changeset
   337
<tr class="even">
45227
97be1bcd7b25 8180472: Pandoc should generate html5 from markdown
ihse
parents: 45103
diff changeset
   338
<td style="text-align: left;">developer/solarisstudio-124/library/c++-libs</td>
97be1bcd7b25 8180472: Pandoc should generate html5 from markdown
ihse
parents: 45103
diff changeset
   339
<td style="text-align: left;">12.4-1.0.10.0</td>
44078
673240c54c2e 8176509: Use pandoc for converting build readme to html
ihse
parents: 41040
diff changeset
   340
</tr>
673240c54c2e 8176509: Use pandoc for converting build readme to html
ihse
parents: 41040
diff changeset
   341
<tr class="odd">
45227
97be1bcd7b25 8180472: Pandoc should generate html5 from markdown
ihse
parents: 45103
diff changeset
   342
<td style="text-align: left;">developer/solarisstudio-124/library/math-libs</td>
97be1bcd7b25 8180472: Pandoc should generate html5 from markdown
ihse
parents: 45103
diff changeset
   343
<td style="text-align: left;">12.4-1.0.0.1</td>
44078
673240c54c2e 8176509: Use pandoc for converting build readme to html
ihse
parents: 41040
diff changeset
   344
</tr>
673240c54c2e 8176509: Use pandoc for converting build readme to html
ihse
parents: 41040
diff changeset
   345
<tr class="even">
45227
97be1bcd7b25 8180472: Pandoc should generate html5 from markdown
ihse
parents: 45103
diff changeset
   346
<td style="text-align: left;">developer/solarisstudio-124/library/studio-gccrt</td>
97be1bcd7b25 8180472: Pandoc should generate html5 from markdown
ihse
parents: 45103
diff changeset
   347
<td style="text-align: left;">12.4-1.0.0.1</td>
44078
673240c54c2e 8176509: Use pandoc for converting build readme to html
ihse
parents: 41040
diff changeset
   348
</tr>
673240c54c2e 8176509: Use pandoc for converting build readme to html
ihse
parents: 41040
diff changeset
   349
<tr class="odd">
45227
97be1bcd7b25 8180472: Pandoc should generate html5 from markdown
ihse
parents: 45103
diff changeset
   350
<td style="text-align: left;">developer/solarisstudio-124/studio-common</td>
97be1bcd7b25 8180472: Pandoc should generate html5 from markdown
ihse
parents: 45103
diff changeset
   351
<td style="text-align: left;">12.4-1.0.0.1</td>
44078
673240c54c2e 8176509: Use pandoc for converting build readme to html
ihse
parents: 41040
diff changeset
   352
</tr>
673240c54c2e 8176509: Use pandoc for converting build readme to html
ihse
parents: 41040
diff changeset
   353
<tr class="even">
45227
97be1bcd7b25 8180472: Pandoc should generate html5 from markdown
ihse
parents: 45103
diff changeset
   354
<td style="text-align: left;">developer/solarisstudio-124/studio-ja</td>
97be1bcd7b25 8180472: Pandoc should generate html5 from markdown
ihse
parents: 45103
diff changeset
   355
<td style="text-align: left;">12.4-1.0.0.1</td>
44078
673240c54c2e 8176509: Use pandoc for converting build readme to html
ihse
parents: 41040
diff changeset
   356
</tr>
673240c54c2e 8176509: Use pandoc for converting build readme to html
ihse
parents: 41040
diff changeset
   357
<tr class="odd">
45227
97be1bcd7b25 8180472: Pandoc should generate html5 from markdown
ihse
parents: 45103
diff changeset
   358
<td style="text-align: left;">developer/solarisstudio-124/studio-legal</td>
97be1bcd7b25 8180472: Pandoc should generate html5 from markdown
ihse
parents: 45103
diff changeset
   359
<td style="text-align: left;">12.4-1.0.0.1</td>
44078
673240c54c2e 8176509: Use pandoc for converting build readme to html
ihse
parents: 41040
diff changeset
   360
</tr>
673240c54c2e 8176509: Use pandoc for converting build readme to html
ihse
parents: 41040
diff changeset
   361
<tr class="even">
45227
97be1bcd7b25 8180472: Pandoc should generate html5 from markdown
ihse
parents: 45103
diff changeset
   362
<td style="text-align: left;">developer/solarisstudio-124/studio-zhCN</td>
97be1bcd7b25 8180472: Pandoc should generate html5 from markdown
ihse
parents: 45103
diff changeset
   363
<td style="text-align: left;">12.4-1.0.0.1</td>
44078
673240c54c2e 8176509: Use pandoc for converting build readme to html
ihse
parents: 41040
diff changeset
   364
</tr>
673240c54c2e 8176509: Use pandoc for converting build readme to html
ihse
parents: 41040
diff changeset
   365
</tbody>
673240c54c2e 8176509: Use pandoc for converting build readme to html
ihse
parents: 41040
diff changeset
   366
</table>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   367
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   368
<pre><code>$ cc -V
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   369
cc: Sun C 5.13 SunOS_i386 2014/10/20
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   370
$ CC -V
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   371
CC: Sun C++ 5.13 SunOS_i386 151846-10 2015/10/30</code></pre>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   372
<h3 id="microsoft-visual-studio">Microsoft Visual Studio</h3>
54635
14615b8ac24c 8221988: add possibility to build with Visual Studio 2019
avoitylov
parents: 54581
diff changeset
   373
<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 2019. Versions older than 2017 are unlikely to continue working for long.</p>
51237
ea900a7dc7d7 8208096: Update build documentation to reflect compiler upgrades at Oracle
erikj
parents: 50885
diff changeset
   374
<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>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   375
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   376
<h3 id="ibm-xl-cc">IBM XL C/C++</h3>
54001
b4e59fc5edd1 8220164: Fix build instructions for AIX
simonis
parents: 53110
diff changeset
   377
<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>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   378
<h2 id="boot-jdk-requirements">Boot JDK Requirements</h2>
51237
ea900a7dc7d7 8208096: Update build documentation to reflect compiler upgrades at Oracle
erikj
parents: 50885
diff changeset
   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>
ea900a7dc7d7 8208096: Update build documentation to reflect compiler upgrades at Oracle
erikj
parents: 50885
diff changeset
   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>
49159
436f1e03fd04 8199266: Update boot and build jdk requirements in configure
erikj
parents: 48743
diff changeset
   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>
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
   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>
49159
436f1e03fd04 8199266: Update boot and build jdk requirements in configure
erikj
parents: 48743
diff changeset
   383
<h3 id="getting-jdk-binaries">Getting JDK binaries</h3>
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
   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>
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
   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>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   386
<h2 id="external-library-requirements">External Library Requirements</h2>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   387
<p>Different platforms require different external libraries. In general, libraries are not optional - that is, they are either required or not used.</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   389
<p>As a fallback, the second version allows you to point to the include directory and the lib directory separately.</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   390
<h3 id="freetype">FreeType</h3>
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
   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>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   392
<ul>
49234
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 49159
diff changeset
   393
<li>To install on an apt-based Linux, try running <code>sudo apt-get install libfreetype6-dev</code>.</li>
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 49159
diff changeset
   394
<li>To install on an rpm-based Linux, try running <code>sudo yum install freetype-devel</code>.</li>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   395
<li>To install on Solaris, try running <code>pkg install system/library/freetype-2</code>.</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   396
</ul>
49234
3375a8039fde 8193017: Import freetype sources into OpenJDK source tree
prr
parents: 49159
diff changeset
   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>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   398
<h3 id="cups">CUPS</h3>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   399
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   400
<ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   401
<li>To install on an apt-based Linux, try running <code>sudo apt-get install libcups2-dev</code>.</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   402
<li>To install on an rpm-based Linux, try running <code>sudo yum install cups-devel</code>.</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   403
<li>To install on Solaris, try running <code>pkg install print/cups</code>.</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   404
</ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   405
<p>Use <code>--with-cups=&lt;path&gt;</code> if <code>configure</code> does not properly locate your CUPS files.</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   406
<h3 id="x11">X11</h3>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   407
<p>Certain <a href="http://www.x.org/">X11</a> libraries and include files are required on Linux and Solaris.</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   408
<ul>
52921
f83b21839314 8215129: Update build documentation with Xrandr
ihse
parents: 52734
diff changeset
   409
<li>To install on an apt-based Linux, try running <code>sudo apt-get install libx11-dev libxext-dev libxrender-dev libxrandr-dev libxtst-dev libxt-dev</code>.</li>
f83b21839314 8215129: Update build documentation with Xrandr
ihse
parents: 52734
diff changeset
   410
<li>To install on an rpm-based Linux, try running <code>sudo yum install libXtst-devel libXt-devel libXrender-devel libXrandr-devel libXi-devel</code>.</li>
f83b21839314 8215129: Update build documentation with Xrandr
ihse
parents: 52734
diff changeset
   411
<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/libxrandr x11/library/libxscrnsaver x11/library/libxtst x11/library/toolkit/libxt</code>.</li>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   412
</ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   413
<p>Use <code>--with-x=&lt;path&gt;</code> if <code>configure</code> does not properly locate your X11 files.</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   414
<h3 id="alsa">ALSA</h3>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   415
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   416
<ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   417
<li>To install on an apt-based Linux, try running <code>sudo apt-get install libasound2-dev</code>.</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   418
<li>To install on an rpm-based Linux, try running <code>sudo yum install alsa-lib-devel</code>.</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   419
</ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   420
<p>Use <code>--with-alsa=&lt;path&gt;</code> if <code>configure</code> does not properly locate your ALSA files.</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   421
<h3 id="libffi">libffi</h3>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   422
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   423
<ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   424
<li>To install on an apt-based Linux, try running <code>sudo apt-get install libffi-dev</code>.</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   425
<li>To install on an rpm-based Linux, try running <code>sudo yum install libffi-devel</code>.</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   426
</ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   427
<p>Use <code>--with-libffi=&lt;path&gt;</code> if <code>configure</code> does not properly locate your libffi files.</p>
48743
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents: 47928
diff changeset
   428
<h2 id="build-tools-requirements">Build Tools Requirements</h2>
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents: 47928
diff changeset
   429
<h3 id="autoconf">Autoconf</h3>
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
   430
<p>The JDK requires <a href="http://www.gnu.org/software/autoconf">Autoconf</a> on all platforms. At least version 2.69 is required.</p>
48743
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents: 47928
diff changeset
   431
<ul>
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents: 47928
diff changeset
   432
<li>To install on an apt-based Linux, try running <code>sudo apt-get install autoconf</code>.</li>
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents: 47928
diff changeset
   433
<li>To install on an rpm-based Linux, try running <code>sudo yum install autoconf</code>.</li>
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents: 47928
diff changeset
   434
<li>To install on macOS, try running <code>brew install autoconf</code>.</li>
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents: 47928
diff changeset
   435
<li>To install on Windows, try running <code>&lt;path to Cygwin setup&gt;/setup-x86_64 -q -P autoconf</code>.</li>
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents: 47928
diff changeset
   436
</ul>
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents: 47928
diff changeset
   437
<p>If <code>configure</code> has problems locating your installation of autoconf, you can specify it using the <code>AUTOCONF</code> environment variable, like this:</p>
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents: 47928
diff changeset
   438
<pre><code>AUTOCONF=&lt;path to autoconf&gt; configure ...</code></pre>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   439
<h3 id="gnu-make">GNU Make</h3>
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
   440
<p>The JDK requires <a href="http://www.gnu.org/software/make">GNU Make</a>. No other flavors of make are supported.</p>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   441
<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>
51237
ea900a7dc7d7 8208096: Update build documentation to reflect compiler upgrades at Oracle
erikj
parents: 50885
diff changeset
   442
<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 &quot;bootstrap make&quot;, 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>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   443
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   444
<p>On Solaris, it is common to call the GNU version of make by using <code>gmake</code>.</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   445
<h3 id="gnu-bash">GNU Bash</h3>
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
   446
<p>The JDK requires <a href="http://www.gnu.org/software/bash">GNU Bash</a>. No other shells are supported.</p>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   447
<p>At least version 3.2 of GNU Bash must be used.</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   448
<h2 id="running-configure">Running Configure</h2>
51237
ea900a7dc7d7 8208096: Update build documentation to reflect compiler upgrades at Oracle
erikj
parents: 50885
diff changeset
   449
<p>To build the JDK, you need a &quot;configuration&quot;, 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 the JDK is built.</p>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   450
<p>The configuration is created by the <code>configure</code> script. The basic invocation of the <code>configure</code> script looks like this:</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   451
<pre><code>bash configure [options]</code></pre>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   452
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   453
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   454
<p>Some command line examples:</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   455
<ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   456
<li><p>Create a 32-bit build for Windows with FreeType2 in <code>C:\freetype-i586</code>:</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   457
<pre><code>bash configure --with-freetype=/cygdrive/c/freetype-i586 --with-target-bits=32</code></pre></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   458
<li><p>Create a debug build with the <code>server</code> JVM and DTrace enabled:</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   459
<pre><code>bash configure --enable-debug --with-jvm-variants=server --enable-dtrace</code></pre></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   460
</ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   461
<h3 id="common-configure-arguments">Common Configure Arguments</h3>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   462
<p>Here follows some of the most common and important <code>configure</code> argument.</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   463
<p>To get up-to-date information on <em>all</em> available <code>configure</code> argument, please run:</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   464
<pre><code>bash configure --help</code></pre>
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
   465
<p>(Note that this help text also include general autoconf options, like <code>--dvidir</code>, that is not relevant to the JDK. To list only JDK-specific features, use <code>bash configure --help=short</code> instead.)</p>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   466
<h4 id="configure-arguments-for-tailoring-the-build">Configure Arguments for Tailoring the Build</h4>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   467
<ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   468
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   469
<li><code>--with-debug-level=&lt;level&gt;</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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   470
<li><code>--with-native-debug-symbols=&lt;method&gt;</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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   471
<li><code>--with-version-string=&lt;string&gt;</code> - Specify the version string this build will be identified with.</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   472
<li><code>--with-version-&lt;part&gt;=&lt;value&gt;</code> - A group of options, where <code>&lt;part&gt;</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>
47687
fb290fd1f9d4 8171853: Remove Shark compiler
rkennke
parents: 47219
diff changeset
   473
<li><code>--with-jvm-variants=&lt;variant&gt;[,&lt;variant&gt;...]</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>custom</code>. Note that not all variants are possible to combine in a single build.</li>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   474
<li><code>--with-jvm-features=&lt;feature&gt;[,&lt;feature&gt;...]</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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   475
<li><code>--with-target-bits=&lt;bits&gt;</code> - Create a target binary suitable for running on a <code>&lt;bits&gt;</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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   476
</ul>
52734
d537553ed639 8214332: Add a flag for overriding default JNI library search path
dholmes
parents: 52665
diff changeset
   477
<p>On Linux, BSD and AIX, it is possible to override where Java by default searches for runtime/JNI libraries. This can be useful in situations where there is a special shared directory for system JNI libraries. This setting can in turn be overriden at runtime by setting the <code>java.library.path</code> property.</p>
d537553ed639 8214332: Add a flag for overriding default JNI library search path
dholmes
parents: 52665
diff changeset
   478
<ul>
d537553ed639 8214332: Add a flag for overriding default JNI library search path
dholmes
parents: 52665
diff changeset
   479
<li><code>--with-jni-libpath=&lt;path&gt;</code> - Use the specified path as a default when searching for runtime libraries.</li>
d537553ed639 8214332: Add a flag for overriding default JNI library search path
dholmes
parents: 52665
diff changeset
   480
</ul>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   481
<h4 id="configure-arguments-for-native-compilation">Configure Arguments for Native Compilation</h4>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   482
<ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   483
<li><code>--with-devkit=&lt;path&gt;</code> - Use this devkit for compilers, tools and resources</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   484
<li><code>--with-sysroot=&lt;path&gt;</code> - Use this directory as sysroot</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   485
<li><code>--with-extra-path=&lt;path&gt;[;&lt;path&gt;]</code> - Prepend these directories to the default path when searching for all kinds of binaries</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   486
<li><code>--with-toolchain-path=&lt;path&gt;[;&lt;path&gt;]</code> - Prepend these directories when searching for toolchain binaries (compilers etc)</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   487
<li><code>--with-extra-cflags=&lt;flags&gt;</code> - Append these flags when compiling JDK C files</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   488
<li><code>--with-extra-cxxflags=&lt;flags&gt;</code> - Append these flags when compiling JDK C++ files</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   489
<li><code>--with-extra-ldflags=&lt;flags&gt;</code> - Append these flags when linking JDK libraries</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   490
</ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   491
<h4 id="configure-arguments-for-external-dependencies">Configure Arguments for External Dependencies</h4>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   492
<ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   493
<li><code>--with-boot-jdk=&lt;path&gt;</code> - Set the path to the <a href="#boot-jdk-requirements">Boot JDK</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   494
<li><code>--with-freetype=&lt;path&gt;</code> - Set the path to <a href="#freetype">FreeType</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   495
<li><code>--with-cups=&lt;path&gt;</code> - Set the path to <a href="#cups">CUPS</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   496
<li><code>--with-x=&lt;path&gt;</code> - Set the path to <a href="#x11">X11</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   497
<li><code>--with-alsa=&lt;path&gt;</code> - Set the path to <a href="#alsa">ALSA</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   498
<li><code>--with-libffi=&lt;path&gt;</code> - Set the path to <a href="#libffi">libffi</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   499
<li><code>--with-jtreg=&lt;path&gt;</code> - Set the path to JTReg. See <a href="#running-tests">Running Tests</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   500
</ul>
54918
b88bcaa94c10 8223944: fix zlib related building docu and comments
mbaesken
parents: 54635
diff changeset
   501
<p>Certain third-party libraries used by the JDK (libjpeg, giflib, libpng, lcms and zlib) are included in the JDK repository. The default behavior of the JDK build is to use the included (&quot;bundled&quot;) versions of libjpeg, giflib, libpng and lcms. For zlib, the system lib (if present) is used except on Windows and AIX. However the bundled libraries may be replaced by an external version. To do so, specify <code>system</code> as the <code>&lt;source&gt;</code> option in these arguments. (The default is <code>bundled</code>).</p>
33030
de12d9a875ed 8139668: Generate README-build.html from markdown
ihse
parents: 29865
diff changeset
   502
<ul>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   503
<li><code>--with-libjpeg=&lt;source&gt;</code> - Use the specified source for libjpeg</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   504
<li><code>--with-giflib=&lt;source&gt;</code> - Use the specified source for giflib</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   505
<li><code>--with-libpng=&lt;source&gt;</code> - Use the specified source for libpng</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   506
<li><code>--with-lcms=&lt;source&gt;</code> - Use the specified source for lcms</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   507
<li><code>--with-zlib=&lt;source&gt;</code> - Use the specified source for zlib</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   508
</ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   509
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   510
<ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   511
<li><code>--with-stdc++lib=&lt;method&gt;</code> - Use the specified method (<code>static</code>, <code>dynamic</code> or <code>default</code>) for linking the C++ runtime.</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   512
</ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   513
<h3 id="configure-control-variables">Configure Control Variables</h3>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   514
<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>
51237
ea900a7dc7d7 8208096: Update build documentation to reflect compiler upgrades at Oracle
erikj
parents: 50885
diff changeset
   515
<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>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   516
<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>
51237
ea900a7dc7d7 8208096: Update build documentation to reflect compiler upgrades at Oracle
erikj
parents: 50885
diff changeset
   517
<p>If a configure argument exists, use that instead, e.g. use <code>--with-jtreg</code> instead of setting <code>JTREGEXE</code>.</p>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   518
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   519
<h2 id="running-make">Running Make</h2>
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
   520
<p>When you have a proper configuration, all you need to do to build the JDK 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>
51237
ea900a7dc7d7 8208096: Update build documentation to reflect compiler upgrades at Oracle
erikj
parents: 50885
diff changeset
   521
<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 &quot;exploded image&quot;) 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>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   522
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   523
<h3 id="common-make-targets">Common Make Targets</h3>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   524
<p>Apart from the default target, here are some common make targets:</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   525
<ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   526
<li><code>hotspot</code> - Build all of hotspot (but only hotspot)</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   527
<li><code>hotspot-&lt;variant&gt;</code> - Build just the specified jvm variant</li>
50490
cbae0e359538 8200132: Remove jre images and bundles
erikj
parents: 50267
diff changeset
   528
<li><code>images</code> or <code>product-images</code> - Build the JDK image</li>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   529
<li><code>docs</code> or <code>docs-image</code> - Build the documentation image</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   530
<li><code>test-image</code> - Build the test image</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   531
<li><code>all</code> or <code>all-images</code> - Build all images (product, docs and test)</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   532
<li><code>bootcycle-images</code> - Build images twice, second time with newly built JDK (good for testing)</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   533
<li><code>clean</code> - Remove all files generated by make, but not those generated by configure</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   534
<li><code>dist-clean</code> - Remove all files, including configuration</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   535
</ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   536
<p>Run <code>make help</code> to get an up-to-date list of important make targets and make control variables.</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   537
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   538
<ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   539
<li><code>&lt;phase&gt;</code> - Build the specified phase and everything it depends on</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   540
<li><code>&lt;module&gt;</code> - Build the specified module and everything it depends on</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   541
<li><code>&lt;module&gt;-&lt;phase&gt;</code> - Compile the specified phase for the specified module and everything it depends on</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   542
</ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   543
<p>Similarly, it is possible to clean just a part of the build by creating make targets according to these patterns:</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   544
<ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   545
<li><code>clean-&lt;outputdir&gt;</code> - Remove the subdir in the output dir with the name</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   546
<li><code>clean-&lt;phase&gt;</code> - Remove all build results related to a certain build phase</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   547
<li><code>clean-&lt;module&gt;</code> - Remove all build results related to a certain module</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   548
<li><code>clean-&lt;module&gt;-&lt;phase&gt;</code> - Remove all build results related to a certain module and phase</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   549
</ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   550
<h3 id="make-control-variables">Make Control Variables</h3>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   551
<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>
51237
ea900a7dc7d7 8208096: Update build documentation to reflect compiler upgrades at Oracle
erikj
parents: 50885
diff changeset
   552
<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>
ea900a7dc7d7 8208096: Update build documentation to reflect compiler upgrades at Oracle
erikj
parents: 50885
diff changeset
   553
<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 &quot;make time&quot; configuration, as opposed to the &quot;configure time&quot; configuration.</p>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   554
<h4 id="general-make-control-variables">General Make Control Variables</h4>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   555
<ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   556
<li><code>JOBS</code> - Specify the number of jobs to build with. See <a href="#build-performance">Build Performance</a>.</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   559
</ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   560
<h4 id="test-make-control-variables">Test Make Control Variables</h4>
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
   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>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   562
<ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   563
<li><code>TEST</code></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   564
<li><code>TEST_JOBS</code></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   565
<li><code>JTREG</code></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   566
<li><code>GTEST</code></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   567
</ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   568
<h4 id="advanced-make-control-variables">Advanced Make Control Variables</h4>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   570
<ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   571
<li><code>SPEC</code></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   572
<li><code>CONF_CHECK</code></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   573
<li><code>COMPARE_BUILD</code></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   574
<li><code>JDK_FILTER</code></li>
57881
c414c554b38b 8230079: Update test document by changing "TIMEOUT" to "TIMEOUT_FACTOR"
erikj
parents: 57493
diff changeset
   575
<li><code>SPEC_FILTER</code></li>
33030
de12d9a875ed 8139668: Generate README-build.html from markdown
ihse
parents: 29865
diff changeset
   576
</ul>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   577
<h2 id="running-tests">Running Tests</h2>
51237
ea900a7dc7d7 8208096: Update build documentation to reflect compiler upgrades at Oracle
erikj
parents: 50885
diff changeset
   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>
50267
1582de22e3a1 8198323: testing.md not updated for repository layout change
ihse
parents: 49234
diff changeset
   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>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   580
<p>To execute the most basic tests (tier 1), use:</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   581
<pre><code>make run-test-tier1</code></pre>
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
   582
<p>For more details on how to run tests, please see the <a href="testing.html">Testing the JDK</a> document.</p>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   583
<h2 id="cross-compiling">Cross-compiling</h2>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   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>
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
   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>
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
   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>
51237
ea900a7dc7d7 8208096: Update build documentation to reflect compiler upgrades at Oracle
erikj
parents: 50885
diff changeset
   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>
52665
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   589
<h3 id="cross-compiling-the-easy-way-with-openjdk-devkits">Cross compiling the easy way with OpenJDK devkits</h3>
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   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>
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   591
<pre><code>bash configure --with-devkit=&lt;devkit-path&gt; --openjdk-target=ppc64-linux-gnu &amp;&amp; make</code></pre>
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   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>
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   593
<p>Devkits can be created from the <code>make/devkit</code> directory by executing:</p>
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   594
<pre><code>make [ TARGETS=&quot;&lt;TARGET_TRIPLET&gt;+&quot; ] [ BASE_OS=&lt;OS&gt; ] [ BASE_OS_VERSION=&lt;VER&gt; ]</code></pre>
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   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>
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   596
<table>
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   597
<thead>
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   598
<tr class="header">
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   599
<th style="text-align: left;">Supported devkit targets</th>
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   600
</tr>
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   601
</thead>
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   602
<tbody>
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   603
<tr class="odd">
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   604
<td style="text-align: left;">x86_64-linux-gnu</td>
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   605
</tr>
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   606
<tr class="even">
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   607
<td style="text-align: left;">aarch64-linux-gnu</td>
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   608
</tr>
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   609
<tr class="odd">
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   610
<td style="text-align: left;">arm-linux-gnueabihf</td>
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   611
</tr>
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   612
<tr class="even">
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   613
<td style="text-align: left;">ppc64-linux-gnu</td>
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   614
</tr>
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   615
<tr class="odd">
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   616
<td style="text-align: left;">ppc64le-linux-gnu</td>
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   617
</tr>
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   618
<tr class="even">
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   619
<td style="text-align: left;">s390x-linux-gnu</td>
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   620
</tr>
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   621
</tbody>
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   622
</table>
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   623
<p><code>BASE_OS</code> must be one of &quot;OEL6&quot; for Oracle Enterprise Linux 6 or &quot;Fedora&quot; (if not specified &quot;OEL6&quot; will be the default). If the base OS is &quot;Fedora&quot; the corresponding Fedora release can be specified with the help of the <code>BASE_OS_VERSION</code> option (with &quot;27&quot; as default version). If the build is successful, the new devkits can be found in the <code>build/devkit/result</code> subdirectory:</p>
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   624
<pre><code>cd make/devkit
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   625
make TARGETS=&quot;ppc64le-linux-gnu aarch64-linux-gnu&quot; BASE_OS=Fedora BASE_OS_VERSION=21
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   626
ls -1 ../../build/devkit/result/
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   627
x86_64-linux-gnu-to-aarch64-linux-gnu
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   628
x86_64-linux-gnu-to-ppc64le-linux-gnu</code></pre>
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   629
<p>Notice that devkits are not only useful for targeting different build platforms. Because they contain the full build dependencies for a system (i.e. compiler and root file system), they can easily be used to build well-known, reliable and reproducible build environments. You can for example create and use a devkit with GCC 7.3 and a Fedora 12 sysroot environment (with glibc 2.11) on Ubuntu 14.04 (which doesn't have GCC 7.3 by default) to produce OpenJDK binaries which will run on all Linux systems with runtime libraries newer than the ones from Fedora 12 (e.g. Ubuntu 16.04, SLES 11 or RHEL 6).</p>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   630
<h3 id="boot-jdk-and-build-jdk">Boot JDK and Build JDK</h3>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   631
<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>
51237
ea900a7dc7d7 8208096: Update build documentation to reflect compiler upgrades at Oracle
erikj
parents: 50885
diff changeset
   632
<p>To be able to build, we need a &quot;Build JDK&quot;, 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>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   633
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   634
<h3 id="specifying-the-target-platform">Specifying the Target Platform</h3>
51237
ea900a7dc7d7 8208096: Update build documentation to reflect compiler upgrades at Oracle
erikj
parents: 50885
diff changeset
   635
<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 &quot;target&quot; is known as &quot;host&quot;, and &quot;target&quot; is used for building a Canadian cross-compiler.)</p>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   636
<h3 id="toolchain-considerations">Toolchain Considerations</h3>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   637
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   638
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   639
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   640
<p>If you are unsure what toolchain and versions to use, these have been proved working at the time of writing:</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   641
<ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   642
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   643
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   644
</ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   645
<h3 id="native-libraries">Native Libraries</h3>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   646
<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>
51237
ea900a7dc7d7 8208096: Update build documentation to reflect compiler upgrades at Oracle
erikj
parents: 50885
diff changeset
   647
<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>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   648
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   649
<h4 id="alsa-1">ALSA</h4>
51237
ea900a7dc7d7 8208096: Update build documentation to reflect compiler upgrades at Oracle
erikj
parents: 50885
diff changeset
   650
<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>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   651
<p>Note that alsa is needed even if you only want to build a headless JDK.</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   652
<ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   653
<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>
52941
a430555c3d4e 8215131: Pandoc 2.3/build documentation fixes
ihse
parents: 52921
diff changeset
   654
<li>Install the libraries into the cross-compilation toolchain. For instance:</li>
a430555c3d4e 8215131: Pandoc 2.3/build documentation fixes
ihse
parents: 52921
diff changeset
   655
</ul>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   656
<pre><code>cd /tools/gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux/arm-linux-gnueabihf/libc
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   657
dpkg-deb -x /tmp/libasound2_1.0.25-4_armhf.deb .
52941
a430555c3d4e 8215131: Pandoc 2.3/build documentation fixes
ihse
parents: 52921
diff changeset
   658
dpkg-deb -x /tmp/libasound2-dev_1.0.25-4_armhf.deb .</code></pre>
a430555c3d4e 8215131: Pandoc 2.3/build documentation fixes
ihse
parents: 52921
diff changeset
   659
<ul>
a430555c3d4e 8215131: Pandoc 2.3/build documentation fixes
ihse
parents: 52921
diff changeset
   660
<li>If alsa is not properly detected by <code>configure</code>, you can point it out by <code>--with-alsa</code>.</li>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   661
</ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   662
<h4 id="x11-1">X11</h4>
51237
ea900a7dc7d7 8208096: Update build documentation to reflect compiler upgrades at Oracle
erikj
parents: 50885
diff changeset
   663
<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>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   664
<p>Note that X11 is needed even if you only want to build a headless JDK.</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   665
<ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   666
<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:
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   667
<ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   668
<li>libxi</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   669
<li>libxi-dev</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   670
<li>x11proto-core-dev</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   671
<li>x11proto-input-dev</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   672
<li>x11proto-kb-dev</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   673
<li>x11proto-render-dev</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   674
<li>x11proto-xext-dev</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   675
<li>libice-dev</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   676
<li>libxrender</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   677
<li>libxrender-dev</li>
52921
f83b21839314 8215129: Update build documentation with Xrandr
ihse
parents: 52734
diff changeset
   678
<li>libxrandr-dev</li>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   679
<li>libsm-dev</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   680
<li>libxt-dev</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   681
<li>libx11</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   682
<li>libx11-dev</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   683
<li>libxtst</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   684
<li>libxtst-dev</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   685
<li>libxext</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   686
<li>libxext-dev</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   687
</ul></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   688
<li><p>Install the libraries into the cross-compilation toolchain. For instance:</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   689
<pre><code>cd /tools/gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux/arm-linux-gnueabihf/libc/usr
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   690
mkdir X11R6
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   691
cd X11R6
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   692
for deb in /tmp/target-x11/*.deb ; do dpkg-deb -x $deb . ; done
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   693
mv usr/* .
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   694
cd lib
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   695
cp arm-linux-gnueabihf/* .</code></pre>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   696
<p>You can ignore the following messages. These libraries are not needed to successfully complete a full JDK build.</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   697
<pre><code>cp: cannot stat `arm-linux-gnueabihf/libICE.so&#39;: No such file or directory
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   698
cp: cannot stat `arm-linux-gnueabihf/libSM.so&#39;: No such file or directory
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   699
cp: cannot stat `arm-linux-gnueabihf/libXt.so&#39;: No such file or directory</code></pre></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   700
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   701
</ul>
51515
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   702
<h3 id="creating-and-using-sysroots-with-qemu-deboostrap">Creating And Using Sysroots With qemu-deboostrap</h3>
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   703
<p>Fortunately, you can create sysroots for foreign architectures with tools provided by your OS. On Debian/Ubuntu systems, one could use <code>qemu-deboostrap</code> to create the <em>target</em> system chroot, which would have the native libraries and headers specific to that <em>target</em> system. After that, we can use the cross-compiler on the <em>build</em> system, pointing into chroot to get the build dependencies right. This allows building for foreign architectures with native compilation speed.</p>
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   704
<p>For example, cross-compiling to AArch64 from x86_64 could be done like this:</p>
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   705
<ul>
52941
a430555c3d4e 8215131: Pandoc 2.3/build documentation fixes
ihse
parents: 52921
diff changeset
   706
<li>Install cross-compiler on the <em>build</em> system:</li>
a430555c3d4e 8215131: Pandoc 2.3/build documentation fixes
ihse
parents: 52921
diff changeset
   707
</ul>
a430555c3d4e 8215131: Pandoc 2.3/build documentation fixes
ihse
parents: 52921
diff changeset
   708
<pre><code>apt install g++-aarch64-linux-gnu gcc-aarch64-linux-gnu</code></pre>
a430555c3d4e 8215131: Pandoc 2.3/build documentation fixes
ihse
parents: 52921
diff changeset
   709
<ul>
a430555c3d4e 8215131: Pandoc 2.3/build documentation fixes
ihse
parents: 52921
diff changeset
   710
<li>Create chroot on the <em>build</em> system, configuring it for <em>target</em> system:</li>
a430555c3d4e 8215131: Pandoc 2.3/build documentation fixes
ihse
parents: 52921
diff changeset
   711
</ul>
51515
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   712
<pre><code>sudo qemu-debootstrap --arch=arm64 --verbose \
52941
a430555c3d4e 8215131: Pandoc 2.3/build documentation fixes
ihse
parents: 52921
diff changeset
   713
       --include=fakeroot,build-essential,libx11-dev,libxext-dev,libxrender-dev,libxrandr-dev,libxtst-dev,libxt-dev,libcups2-dev,libfontconfig1-dev,libasound2-dev,libfreetype6-dev,libpng12-dev \
a430555c3d4e 8215131: Pandoc 2.3/build documentation fixes
ihse
parents: 52921
diff changeset
   714
       --resolve-deps jessie /chroots/arm64 http://httpredir.debian.org/debian/</code></pre>
a430555c3d4e 8215131: Pandoc 2.3/build documentation fixes
ihse
parents: 52921
diff changeset
   715
<ul>
a430555c3d4e 8215131: Pandoc 2.3/build documentation fixes
ihse
parents: 52921
diff changeset
   716
<li>Configure and build with newly created chroot as sysroot/toolchain-path:</li>
a430555c3d4e 8215131: Pandoc 2.3/build documentation fixes
ihse
parents: 52921
diff changeset
   717
</ul>
51515
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   718
<pre><code>CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ sh ./configure --openjdk-target=aarch64-linux-gnu --with-sysroot=/chroots/arm64/ --with-toolchain-path=/chroots/arm64/
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   719
make images
52941
a430555c3d4e 8215131: Pandoc 2.3/build documentation fixes
ihse
parents: 52921
diff changeset
   720
ls build/linux-aarch64-normal-server-release/</code></pre>
51515
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   721
<p>The build does not create new files in that chroot, so it can be reused for multiple builds without additional cleanup.</p>
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   722
<p>Architectures that are known to successfully cross-compile like this are:</p>
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   723
<table>
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   724
<thead>
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   725
<tr class="header">
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   726
<th style="text-align: left;">Target</th>
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   727
<th style="text-align: left;"><code>CC</code></th>
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   728
<th style="text-align: left;"><code>CXX</code></th>
52665
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   729
<th style="text-align: left;"><code>--arch=...</code></th>
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   730
<th style="text-align: left;"><code>--openjdk-target=...</code></th>
51515
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   731
</tr>
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   732
</thead>
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   733
<tbody>
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   734
<tr class="odd">
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   735
<td style="text-align: left;">x86</td>
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   736
<td style="text-align: left;">default</td>
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   737
<td style="text-align: left;">default</td>
52665
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   738
<td style="text-align: left;">i386</td>
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   739
<td style="text-align: left;">i386-linux-gnu</td>
51515
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   740
</tr>
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   741
<tr class="even">
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   742
<td style="text-align: left;">armhf</td>
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   743
<td style="text-align: left;">gcc-arm-linux-gnueabihf</td>
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   744
<td style="text-align: left;">g++-arm-linux-gnueabihf</td>
52665
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   745
<td style="text-align: left;">armhf</td>
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   746
<td style="text-align: left;">arm-linux-gnueabihf</td>
51515
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   747
</tr>
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   748
<tr class="odd">
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   749
<td style="text-align: left;">aarch64</td>
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   750
<td style="text-align: left;">gcc-aarch64-linux-gnu</td>
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   751
<td style="text-align: left;">g++-aarch64-linux-gnu</td>
52665
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   752
<td style="text-align: left;">arm64</td>
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   753
<td style="text-align: left;">aarch64-linux-gnu</td>
51515
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   754
</tr>
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   755
<tr class="even">
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   756
<td style="text-align: left;">ppc64el</td>
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   757
<td style="text-align: left;">gcc-powerpc64le-linux-gnu</td>
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   758
<td style="text-align: left;">g++-powerpc64le-linux-gnu</td>
52665
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   759
<td style="text-align: left;">ppc64el</td>
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   760
<td style="text-align: left;">powerpc64le-linux-gnu</td>
51515
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   761
</tr>
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   762
<tr class="odd">
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   763
<td style="text-align: left;">s390x</td>
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   764
<td style="text-align: left;">gcc-s390x-linux-gnu</td>
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   765
<td style="text-align: left;">g++-s390x-linux-gnu</td>
52665
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   766
<td style="text-align: left;">s390x</td>
61dcd7cd48c3 8213698: Improve devkit creation and add support for linux/ppc64/ppc64le/s390x
simonis
parents: 52610
diff changeset
   767
<td style="text-align: left;">s390x-linux-gnu</td>
51515
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   768
</tr>
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   769
</tbody>
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   770
</table>
fa378e035b81 8208665: Amend cross-compilation docs with qemu-debootstrap recipe
shade
parents: 51237
diff changeset
   771
<p>Additional architectures might be supported by Debian/Ubuntu Ports.</p>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   772
<h3 id="building-for-armaarch64">Building for ARM/aarch64</h3>
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
   773
<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 by the JDK.</p>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   774
<h3 id="verifying-the-build">Verifying the Build</h3>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   775
<p>The build will end up in a directory named like <code>build/linux-arm-normal-server-release</code>.</p>
50490
cbae0e359538 8200132: Remove jre images and bundles
erikj
parents: 50267
diff changeset
   776
<p>Inside this build output directory, the <code>images/jdk</code> will contain the newly built JDK, for your <em>target</em> system.</p>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   777
<p>Copy these folders to your <em>target</em> system. Then you can run e.g. <code>images/jdk/bin/java -version</code>.</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   778
<h2 id="build-performance">Build Performance</h2>
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
   779
<p>Building the JDK 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>
33030
de12d9a875ed 8139668: Generate README-build.html from markdown
ihse
parents: 29865
diff changeset
   780
<ul>
51237
ea900a7dc7d7 8208096: Update build documentation to reflect compiler upgrades at Oracle
erikj
parents: 50885
diff changeset
   781
<li><p><code>--with-num-cores</code> -- number of cores in the build system, e.g. <code>--with-num-cores=8</code>.</p></li>
ea900a7dc7d7 8208096: Update build documentation to reflect compiler upgrades at Oracle
erikj
parents: 50885
diff changeset
   782
<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>
33030
de12d9a875ed 8139668: Generate README-build.html from markdown
ihse
parents: 29865
diff changeset
   783
</ul>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   784
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   785
<p>It might also be necessary to specify the JVM arguments passed to the Boot JDK, using e.g. <code>--with-boot-jdk-jvmargs=&quot;-Xmx8G&quot;</code>. Doing so will override the default JVM arguments passed to the Boot JDK.</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   786
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   787
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   788
<h3 id="disk-speed">Disk Speed</h3>
51237
ea900a7dc7d7 8208096: Update build documentation to reflect compiler upgrades at Oracle
erikj
parents: 50885
diff changeset
   789
<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>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   790
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   791
<p>As has been stressed elsewhere, do use SSD for source code and build directory, as well as (if possible) the build tools.</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   792
<h3 id="virus-checking">Virus Checking</h3>
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
   793
<p>The use of virus checking software, especially on Windows, can <em>significantly</em> slow down building of the JDK. If possible, turn off such software, or exclude the directory containing the JDK source code from on-the-fly checking.</p>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   794
<h3 id="ccache">Ccache</h3>
51237
ea900a7dc7d7 8208096: Update build documentation to reflect compiler upgrades at Oracle
erikj
parents: 50885
diff changeset
   795
<p>The JDK 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>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   796
<h3 id="precompiled-headers">Precompiled Headers</h3>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   797
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   798
<p>You can experiment by disabling precompiled headers using <code>--disable-precompiled-headers</code>.</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   799
<h3 id="icecc-icecream">Icecc / icecream</h3>
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
   800
<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 the JDK, you can drastically cut individual build times by utilizing it.</p>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   801
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   802
<h3 id="using-sjavac">Using sjavac</h3>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   803
<p>To speed up Java compilation, especially incremental compilations, you can try the experimental sjavac compiler by using <code>--enable-sjavac</code>.</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   804
<h3 id="building-the-right-target">Building the Right Target</h3>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   805
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   806
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   807
<h2 id="troubleshooting">Troubleshooting</h2>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   808
<p>If your build fails, it can sometimes be difficult to pinpoint the problem or find a proper solution.</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   809
<h3 id="locating-the-source-of-the-error">Locating the Source of the Error</h3>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   810
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   811
<h4 id="build-failure-summary">Build Failure Summary</h4>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   812
<p>To help you, the build system will print a failure summary at the end. It looks like this:</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   813
<pre><code>ERROR: Build failed for target &#39;hotspot&#39; in configuration &#39;linux-x64&#39; (exit code 2)
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   814
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   815
=== Output from failing command(s) repeated here ===
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   816
* For target hotspot_variant-server_libjvm_objs_psMemoryPool.o:
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   817
/localhome/hg/jdk9-sandbox/hotspot/src/share/vm/services/psMemoryPool.cpp:1:1: error: &#39;failhere&#39; does not name a type
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   818
   ... (rest of output omitted)
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   819
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   820
* All command lines available in /localhome/hg/jdk9-sandbox/build/linux-x64/make-support/failure-logs.
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   821
=== End of repeated output ===
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   822
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   823
=== Make failed targets repeated here ===
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   824
lib/CompileJvm.gmk:207: recipe for target &#39;/localhome/hg/jdk9-sandbox/build/linux-x64/hotspot/variant-server/libjvm/objs/psMemoryPool.o&#39; failed
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   825
make/Main.gmk:263: recipe for target &#39;hotspot-server-libs&#39; failed
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   826
=== End of repeated output ===
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   827
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   828
Hint: Try searching the build log for the name of the first failed target.
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   829
Hint: If caused by a warning, try configure --disable-warnings-as-errors.</code></pre>
51237
ea900a7dc7d7 8208096: Update build documentation to reflect compiler upgrades at Oracle
erikj
parents: 50885
diff changeset
   830
<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>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   831
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   832
<p>The path to the <code>failure-logs</code> directory is printed. In this file you will find a <code>&lt;target&gt;.log</code> file that contains the output from this command in its entirety, and also a <code>&lt;target&gt;.cmd</code>, which contain the complete command line used for running this command. You can re-run the failing command by executing <code>. &lt;path to failure-logs&gt;/&lt;target&gt;.cmd</code> in your shell.</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   833
<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>
51237
ea900a7dc7d7 8208096: Update build documentation to reflect compiler upgrades at Oracle
erikj
parents: 50885
diff changeset
   834
<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 &quot;<code>psMemoryPool.o</code>&quot;. Another way to quickly locate make errors in the log is to search for &quot;<code>] Error</code>&quot; or &quot;<code>***</code>&quot;.</p>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   835
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   836
<h4 id="checking-the-build-log-file">Checking the Build Log File</h4>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   837
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   838
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   839
<h3 id="fixing-unexpected-build-failures">Fixing Unexpected Build Failures</h3>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   840
<p>Most of the time, the build will fail due to incorrect changes in the source code.</p>
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
   841
<p>Sometimes the build can fail with no apparent changes that have caused the failure. If this is the first time you are building the JDK on this particular computer, and the build fails, the problem is likely with your build environment. But even if you have previously built the JDK 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>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   842
<h4 id="problems-with-the-build-environment">Problems with the Build Environment</h4>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   843
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   844
<p>Verify that the summary at the end looks correct. Are you indeed using the Boot JDK and native toolchain that you expect?</p>
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
   845
<p>By default, the JDK 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>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   846
<h4 id="problems-with-incremental-rebuilds">Problems with Incremental Rebuilds</h4>
52610
7ac273f045e3 8214062: JDK-8167368 Leftover: get_source.sh in build documentation
erikj
parents: 52351
diff changeset
   847
<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.</p>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   848
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   849
<ol type="1">
52610
7ac273f045e3 8214062: JDK-8167368 Leftover: get_source.sh in build documentation
erikj
parents: 52351
diff changeset
   850
<li><p>Make sure your repository is up-to-date</p>
7ac273f045e3 8214062: JDK-8167368 Leftover: get_source.sh in build documentation
erikj
parents: 52351
diff changeset
   851
<p>Run <code>hg pull -u</code> to make sure you have the latest changes.</p></li>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   852
<li><p>Clean build results</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   853
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   854
<li><p>Completely clean the build directory.</p>
51237
ea900a7dc7d7 8208096: Update build documentation to reflect compiler upgrades at Oracle
erikj
parents: 50885
diff changeset
   855
<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>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   856
<pre><code>make print-configuration &gt; current-configuration
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   857
make dist-clean
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   858
bash configure $(cat current-configuration)
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   859
make</code></pre></li>
52610
7ac273f045e3 8214062: JDK-8167368 Leftover: get_source.sh in build documentation
erikj
parents: 52351
diff changeset
   860
<li><p>Re-clone the Mercurial repository</p>
7ac273f045e3 8214062: JDK-8167368 Leftover: get_source.sh in build documentation
erikj
parents: 52351
diff changeset
   861
<p>Sometimes the Mercurial repository gets in a state that causes the product to be un-buildable. In such a case, the simplest solution is often the &quot;sledgehammer approach&quot;: delete the entire repository, and re-clone it. If you have local changes, save them first to a different location using <code>hg export</code>.</p></li>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   862
</ol>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   863
<h3 id="specific-build-issues">Specific Build Issues</h3>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   864
<h4 id="clock-skew">Clock Skew</h4>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   865
<p>If you get an error message like this:</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   866
<pre><code>File &#39;xxx&#39; has modification time in the future.
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   867
Clock skew detected. Your build may be incomplete.</code></pre>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   868
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   869
<p>If you see these warnings, reset the clock on the build machine, run <code>make clean</code> and restart the build.</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   870
<h4 id="out-of-memory-errors">Out of Memory Errors</h4>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   871
<p>On Solaris, you might get an error message like this:</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   872
<pre><code>Trouble writing out table to disk</code></pre>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   873
<p>To solve this, increase the amount of swap space on your build machine.</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   874
<p>On Windows, you might get error messages like this:</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   875
<pre><code>fatal error - couldn&#39;t allocate heap
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   876
cannot create ... Permission denied
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   877
spawn failed</code></pre>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   878
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   879
<h3 id="getting-help">Getting Help</h3>
52941
a430555c3d4e 8215131: Pandoc 2.3/build documentation fixes
ihse
parents: 52921
diff changeset
   880
<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>
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
   881
<p>If you need general help or advice about developing for the JDK, you can also contact the Adoption Group. See the section on <a href="#contributing-to-openjdk">Contributing to OpenJDK</a> for more information.</p>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   882
<h2 id="hints-and-suggestions-for-advanced-users">Hints and Suggestions for Advanced Users</h2>
52610
7ac273f045e3 8214062: JDK-8167368 Leftover: get_source.sh in build documentation
erikj
parents: 52351
diff changeset
   883
<h3 id="setting-up-a-repository-for-pushing-changes-defpath">Setting Up a Repository for Pushing Changes (defpath)</h3>
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
   884
<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 the JDK.</p>
51237
ea900a7dc7d7 8208096: Update build documentation to reflect compiler upgrades at Oracle
erikj
parents: 50885
diff changeset
   885
<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>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   886
<pre><code>cd ~
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   887
mkdir hg-ext
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   888
cd hg-ext
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   889
hg clone http://hg.openjdk.java.net/code-tools/defpath
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   890
cat &lt;&lt; EOT &gt;&gt; ~/.hgrc
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   891
[extensions]
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   892
defpath=~/hg-ext/defpath/defpath.py
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   893
EOT</code></pre>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   894
<p>You can now setup a proper push path using:</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   895
<pre><code>hg defpath -d -u &lt;your OpenJDK username&gt;</code></pre>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   896
<h3 id="bash-completion">Bash Completion</h3>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   897
<p>The <code>configure</code> and <code>make</code> commands tries to play nice with bash command-line completion (using <code>&lt;tab&gt;</code> or <code>&lt;tab&gt;&lt;tab&gt;</code>). To use this functionality, make sure you enable completion in your <code>~/.bashrc</code> (see instructions for bash in your operating system).</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   898
<p>Make completion will work out of the box, and will complete valid make targets. For instance, typing <code>make jdk-i&lt;tab&gt;</code> will complete to <code>make jdk-image</code>.</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   899
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   900
<pre><code>cat &lt;&lt; EOT &gt; /tmp/configure
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   901
#!/bin/bash
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   902
if [ \$(pwd) = \$(cd \$(dirname \$0); pwd) ] ; then
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   903
  echo &gt;&amp;2 &quot;Abort: Trying to call configure helper recursively&quot;
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   904
  exit 1
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   905
fi
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   906
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   907
bash \$PWD/configure &quot;\$@&quot;
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   908
EOT
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   909
chmod +x /tmp/configure
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   910
sudo mv /tmp/configure /usr/local/bin</code></pre>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   911
<p>Now <code>configure --en&lt;tab&gt;-dt&lt;tab&gt;</code> will result in <code>configure --enable-dtrace</code>.</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   912
<h3 id="using-multiple-configurations">Using Multiple Configurations</h3>
52610
7ac273f045e3 8214062: JDK-8167368 Leftover: get_source.sh in build documentation
erikj
parents: 52351
diff changeset
   913
<p>You can have multiple configurations for a single source repository. When you create a new configuration, run <code>configure --with-conf-name=&lt;name&gt;</code> to create a configuration with the name <code>&lt;name&gt;</code>. Alternatively, you can create a directory under <code>build</code> and run <code>configure</code> from there, e.g. <code>mkdir build/&lt;name&gt; &amp;&amp; cd build/&lt;name&gt; &amp;&amp; bash ../../configure</code>.</p>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   914
<p>Then you can build that configuration using <code>make CONF_NAME=&lt;name&gt;</code> or <code>make CONF=&lt;pattern&gt;</code>, where <code>&lt;pattern&gt;</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/&lt;name&gt; &amp;&amp; make</code>.</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   915
<h3 id="handling-reconfigurations">Handling Reconfigurations</h3>
52610
7ac273f045e3 8214062: JDK-8167368 Leftover: get_source.sh in build documentation
erikj
parents: 52351
diff changeset
   916
<p>If you update the repository and part of the configure script has changed, the build system will force you to re-run <code>configure</code>.</p>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   917
<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>
51237
ea900a7dc7d7 8208096: Update build documentation to reflect compiler upgrades at Oracle
erikj
parents: 50885
diff changeset
   918
<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>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   919
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   920
<h3 id="using-fine-grained-make-targets">Using Fine-Grained Make Targets</h3>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   921
<p>The default behavior for make is to create consistent and correct output, at the expense of build speed, if necessary.</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   922
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   923
<h4 id="building-individual-modules">Building Individual Modules</h4>
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
   924
<p>The safe way to use fine-grained make targets is to use the module specific make targets. All source code in the JDK 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>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   925
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   926
<h4 id="building-individual-module-phases">Building Individual Module Phases</h4>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   927
<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>
33030
de12d9a875ed 8139668: Generate README-build.html from markdown
ihse
parents: 29865
diff changeset
   928
<ul>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   929
<li><code>gensrc</code> (Generate source code to compile)</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   930
<li><code>gendata</code> (Generate non-source code artifacts)</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   931
<li><code>copy</code> (Copy resource artifacts)</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   932
<li><code>java</code> (Compile Java code)</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   933
<li><code>launchers</code> (Compile native executables)</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   934
<li><code>libs</code> (Compile native libraries)</li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   935
<li><code>rmic</code> (Run the <code>rmic</code> tool)</li>
33030
de12d9a875ed 8139668: Generate README-build.html from markdown
ihse
parents: 29865
diff changeset
   936
</ul>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   937
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   938
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   939
<h4 id="skipping-the-dependency-check">Skipping the Dependency Check</h4>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   940
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   941
<blockquote>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   942
<p><strong>Note that if used incorrectly, this can lead to a broken build!</strong></p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   943
</blockquote>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   944
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   945
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   946
<h4 id="rebuilding-part-of-java.base-jdk_filter">Rebuilding Part of java.base (JDK_FILTER)</h4>
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
   947
<p>If you are modifying files in <code>java.base</code>, which is the by far largest module in the JDK, then you need to rebuild all those files whenever a single file has changed. (This inefficiency will hopefully be addressed in JDK 10.)</p>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   948
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   949
<h3 id="learn-about-mercurial">Learn About Mercurial</h3>
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
   950
<p>To become an efficient JDK developer, it is recommended that you invest in learning Mercurial properly. Here are some links that can get you started:</p>
33030
de12d9a875ed 8139668: Generate README-build.html from markdown
ihse
parents: 29865
diff changeset
   951
<ul>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   952
<li><a href="http://www.mercurial-scm.org/wiki/GitConcepts">Mercurial for git users</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   953
<li><a href="http://www.mercurial-scm.org/wiki/Tutorial">The official Mercurial tutorial</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   954
<li><a href="http://hginit.com/">hg init</a></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   955
<li><a href="http://hgbook.red-bean.com/read/">Mercurial: The Definitive Guide</a></li>
33030
de12d9a875ed 8139668: Generate README-build.html from markdown
ihse
parents: 29865
diff changeset
   956
</ul>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   957
<h2 id="understanding-the-build-system">Understanding the Build System</h2>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   958
<p>This section will give you a more technical description on the details of the build system.</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   959
<h3 id="configurations">Configurations</h3>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   960
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   961
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   962
<h3 id="build-output-structure">Build Output Structure</h3>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   963
<p>The build output for a configuration will end up in <code>build/&lt;configuration name&gt;</code>, which we refer to as <code>$BUILD</code> in this document. The <code>$BUILD</code> directory contains the following important directories:</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   964
<pre><code>buildtools/
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   965
configure-support/
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   966
hotspot/
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   967
images/
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   968
jdk/
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   969
make-support/
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   970
support/
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   971
test-results/
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   972
test-support/</code></pre>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   973
<p>This is what they are used for:</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   974
<ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   975
<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>
51237
ea900a7dc7d7 8208096: Update build documentation to reflect compiler upgrades at Oracle
erikj
parents: 50885
diff changeset
   976
<li><p><code>jdk</code>: This is the &quot;exploded image&quot;. 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>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   977
<li><p><code>test-results</code>: This directory contains the results from running tests.</p></li>
51237
ea900a7dc7d7 8208096: Update build documentation to reflect compiler upgrades at Oracle
erikj
parents: 50885
diff changeset
   978
<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>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   979
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   980
<li><p><code>hotspot</code>: This is an area for intermediate files needed when building hotspot.</p></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   981
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   982
</ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   983
<h3 id="fixpath">Fixpath</h3>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   984
<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>
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
   985
<p>In the JDK 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>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   986
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   987
<h3 id="native-debug-symbols">Native Debug Symbols</h3>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   988
<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>
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
   989
<p>The JDK 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>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   990
<ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   991
<li><p><code>none</code> means that no debug symbols will be generated during the build.</p></li>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   992
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   993
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   994
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   995
</ul>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   996
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   997
<h3 id="autoconf-details">Autoconf Details</h3>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
   998
<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>
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
   999
<p>The <code>configure</code> script in the top level directory of the JDK is just a thin wrapper that calls <code>make/autoconf/configure</code>. This in turn will run <code>autoconf</code> to create the runnable (generated) configure script, as <code>.build/generated-configure.sh</code>. Apart from being responsible for the generation of the runnable script, the <code>configure</code> script also provides functionality that is not easily expressed in the normal Autoconf framework. As part of this functionality, the generated script is called.</p>
48743
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents: 47928
diff changeset
  1000
<p>The build system will detect if the Autoconf source files have changed, and will trigger a regeneration of the generated script if needed. You can also manually request such an update by <code>bash configure autogen</code>.</p>
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
  1001
<p>In previous versions of the JDK, the generated script was checked in at <code>make/autoconf/generated-configure.sh</code>. This is no longer the case.</p>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
  1002
<h3 id="developing-the-build-system-itself">Developing the Build System Itself</h3>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
  1003
<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>
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
  1004
<p>While technically using <code>make</code>, the make source files of the JDK 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>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
  1005
<pre><code>$(eval $(call SetupJavaCompilation, BUILD_FOO_CLASSES, \
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
  1006
    SETUP := GENERATE_OLDBYTECODE, \
47219
fd36993f7bf5 8187542: Remove superfluous *_TOPDIR variables
ihse
parents: 47217
diff changeset
  1007
    SRC := $(TOPDIR)/src/jkd.foo/share/classes, \
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
  1008
    INCLUDES := jdk/internal/foo, \
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
  1009
    BIN := $(SUPPORT_OUTPUTDIR)/foo_classes, \
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
  1010
))</code></pre>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
  1011
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
  1012
<p>Correct dependency tracking is paramount. Sloppy dependency tracking will lead to improper parallelization, or worse, race conditions.</p>
51237
ea900a7dc7d7 8208096: Update build documentation to reflect compiler upgrades at Oracle
erikj
parents: 50885
diff changeset
  1013
<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>
45763
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
  1014
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
  1015
<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>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
  1016
<pre><code>make COMPARE_BUILD=CONF=--enable-new-hotspot-feature:MAKE=hotspot</code></pre>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
  1017
<p>See <code>make/InitSupport.gmk</code> for details on how to use <code>COMPARE_BUILD</code>.</p>
2a2e56f4c03b 8179892: Update build documentation for JDK 9
ihse
parents: 45227
diff changeset
  1018
<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>
48743
ba52fa7bbf14 8195689: Remove generated-configure.sh and instead use autoconf
ihse
parents: 47928
diff changeset
  1019
<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.</p>
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
  1020
<h2 id="contributing-to-the-jdk">Contributing to the JDK</h2>
51237
ea900a7dc7d7 8208096: Update build documentation to reflect compiler upgrades at Oracle
erikj
parents: 50885
diff changeset
  1021
<p>So, now you've built your JDK, and made your first patch, and want to contribute it back to the OpenJDK Community.</p>
50885
7c728fa9d1af 8205956: Fix usage of "OpenJDK" in build and test instructions
mr
parents: 50586
diff changeset
  1022
<p>First of all: Thank you! We gladly welcome your contribution. However, please bear in mind that the JDK is a massive project, and we must ask you to follow our rules and guidelines to be able to accept your contribution.</p>
51237
ea900a7dc7d7 8208096: Update build documentation to reflect compiler upgrades at Oracle
erikj
parents: 50885
diff changeset
  1023
<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>
ea900a7dc7d7 8208096: Update build documentation to reflect compiler upgrades at Oracle
erikj
parents: 50885
diff changeset
  1024
<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>
44078
673240c54c2e 8176509: Use pandoc for converting build readme to html
ihse
parents: 41040
diff changeset
  1025
</body>
333
d4540117530e 6563616: Clarify instructions for unpacking openjdk binary "plug"
ohair
parents: 15
diff changeset
  1026
</html>