Tue, 17 Sep 2013 08:08:01 -0700
Merge
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <title>OpenJDK Build README</title>
5 </head>
6 <body style="background-color:aquamarine">
8 <!-- ====================================================== -->
9 <table width="100%">
10 <tr>
11 <td align="center">
12 <img alt="OpenJDK"
13 src="http://openjdk.java.net/images/openjdk.png"
14 width=256>
15 </td>
16 </tr>
17 <tr>
18 <td align=center>
19 <h1>OpenJDK Build README</h1>
20 </td>
21 </tr>
22 </table>
24 <!-- ====================================================== -->
25 <hr>
26 <h2><a name="introduction">Introduction</a></h2>
27 <blockquote>
28 This README file contains build instructions for the
29 <a href="http://openjdk.java.net" target="_blank">OpenJDK</a>.
30 Building the source code for the
31 OpenJDK
32 requires
33 a certain degree of technical expertise.
35 <!-- ====================================================== -->
36 <h3>!!!!!!!!!!!!!!! THIS IS A MAJOR RE-WRITE of this document. !!!!!!!!!!!!!</h3>
37 <blockquote>
38 Some Headlines:
39 <ul>
40 <li>
41 The build is now a "<code>configure && make</code>" style build
42 </li>
43 <li>
44 Any GNU make 3.81 or newer should work
45 </li>
46 <li>
47 The build should scale, i.e. more processors should
48 cause the build to be done in less wall-clock time
49 </li>
50 <li>
51 Nested or recursive make invocations have been significantly
52 reduced, as has the total fork/exec or spawning
53 of sub processes during the build
54 </li>
55 <li>
56 Windows MKS usage is no longer supported
57 </li>
58 <li>
59 Windows Visual Studio <code>vsvars*.bat</code> and
60 <code>vcvars*.bat</code> files are run automatically
61 </li>
62 <li>
63 Ant is no longer used when building the OpenJDK
64 </li>
65 <li>
66 Use of ALT_* environment variables for configuring the
67 build is no longer supported
68 </li>
69 </ul>
70 </blockquote>
71 </blockquote>
73 <!-- ====================================================== -->
74 <hr>
75 <h2><a name="contents">Contents</a></h2>
76 <blockquote>
77 <ul>
78 <li><a href="#introduction">Introduction</a></li>
80 <li><a href="#hg">Use of Mercurial</a>
81 <ul>
82 <li><a href="#get_source">Getting the Source</a></li>
83 <li><a href="#repositories">Repositories</a></li>
84 </ul>
85 </li>
87 <li><a href="#building">Building</a>
88 <ul>
89 <li><a href="#setup">System Setup</a>
90 <ul>
91 <li><a href="#linux">Linux</a></li>
92 <li><a href="#solaris">Solaris</a></li>
93 <li><a href="#macosx">Mac OS X</a></li>
94 <li><a href="#windows">Windows</a></li>
95 </ul>
96 </li>
97 <li><a href="#configure">Configure</a></li>
98 <li><a href="#make">Make</a></li>
99 </ul>
100 </li>
101 <li><a href="#testing">Testing</a></li>
102 </ul>
103 <hr>
104 <ul>
105 <li><a href="#hints">Appendix A: Hints and Tips</a>
106 <ul>
107 <li><a href="#faq">FAQ</a></li>
108 <li><a href="#performance">Build Performance Tips</a></li>
109 <li><a href="#troubleshooting">Troubleshooting</a></li>
110 </ul>
111 </li>
112 <li><a href="#gmake">Appendix B: GNU Make Information</a></li>
113 <li><a href="#buildenvironments">Appendix C: Build Environments</a></li>
115 <!-- Leave out
116 <li><a href="#mapping">Appendix D: Mapping Old Builds to the New Builds</a></li>
117 -->
119 </ul>
120 </blockquote>
122 <!-- ====================================================== -->
123 <hr>
124 <h2><a name="hg">Use of Mercurial</a></h2>
125 <blockquote>
126 The OpenJDK sources are maintained with the revision control system
127 <a href="http://mercurial.selenic.com/wiki/Mercurial">Mercurial</a>.
128 If you are new to Mercurial, please see the
129 <a href="http://mercurial.selenic.com/wiki/BeginnersGuides">
130 Beginner Guides</a>
131 or refer to the <a href="http://hgbook.red-bean.com/">
132 Mercurial Book</a>.
133 The first few chapters of the book provide an excellent overview of
134 Mercurial, what it is and how it works.
135 <br>
136 For using Mercurial with the OpenJDK refer to the
137 <a href="http://openjdk.java.net/guide/repositories.html#installConfig">
138 Developer Guide: Installing and Configuring Mercurial</a>
139 section for more information.
141 <h3><a name="get_source">Getting the Source</a></h3>
142 <blockquote>
143 To get the entire set of OpenJDK Mercurial repositories
144 use the script <code>get_source.sh</code> located in the
145 root repository:
146 <blockquote>
147 <code>
148 hg clone http://hg.openjdk.java.net/jdk8/jdk8
149 <i>YourOpenJDK</i>
150 <br>
151 cd <i>YourOpenJDK</i>
152 <br>
153 bash ./get_source.sh
154 </code>
155 </blockquote>
156 Once you have all the repositories, keep in mind that each
157 repository is its own independent repository.
158 You can also re-run <code>./get_source.sh</code> anytime to
159 pull over all the latest changesets in all the repositories.
160 This set of nested repositories has been given the term
161 "forest" and there are various ways to apply the same
162 <code>hg</code> command to each of the repositories.
163 For example, the script <code>make/scripts/hgforest.sh</code>
164 can be used to repeat the same <code>hg</code>
165 command on every repository, e.g.
166 <blockquote>
167 <code>
168 cd <i>YourOpenJDK</i>
169 <br>
170 bash ./make/scripts/hgforest.sh status
171 </code>
172 </blockquote>
173 </blockquote>
175 <h3><a name="repositories">Repositories</a></h3>
176 <blockquote>
177 <p>The set of repositories and what they contain:</p>
178 <table border="1">
179 <thead>
180 <tr>
181 <th>Repository</th>
182 <th>Contains</th>
183 </tr>
184 </thead>
185 <tbody>
186 <tr>
187 <td>
188 . (root)
189 </td>
190 <td>
191 common configure and makefile logic
192 </td>
193 </tr>
194 <tr>
195 <td>
196 hotspot
197 </td>
198 <td>
199 source code and make files for building
200 the OpenJDK Hotspot Virtual Machine
201 </td>
202 </tr>
203 <tr>
204 <td>
205 langtools
206 </td>
207 <td>
208 source code for the OpenJDK javac and language tools
209 </td>
210 </tr>
211 <tr>
212 <td>
213 jdk
214 </td>
215 <td>
216 source code and make files for building
217 the OpenJDK runtime libraries and misc files
218 </td>
219 </tr>
220 <tr>
221 <td>
222 jaxp
223 </td>
224 <td>
225 source code for the OpenJDK JAXP functionality
226 </td>
227 </tr>
228 <tr>
229 <td>
230 jaxws
231 </td>
232 <td>
233 source code for the OpenJDK JAX-WS functionality
234 </td>
235 </tr>
236 <tr>
237 <td>
238 corba
239 </td>
240 <td>
241 source code for the OpenJDK Corba functionality
242 </td>
243 </tr>
244 <tr>
245 <td>
246 nashorn
247 </td>
248 <td>
249 source code for the OpenJDK JavaScript implementation
250 </td>
251 </tr>
252 </tbody>
253 </table>
254 </blockquote>
256 <h3><a name="guidelines">Repository Source Guidelines</a></h3>
257 <blockquote>
258 There are some very basic guidelines:
259 <ul>
260 <li>
261 Use of whitespace in source files
262 (.java, .c, .h, .cpp, and .hpp files)
263 is restricted.
264 No TABs, no trailing whitespace on lines, and files
265 should not terminate in more than one blank line.
266 </li>
267 <li>
268 Files with execute permissions should not be added
269 to the source repositories.
270 </li>
271 <li>
272 All generated files need to be kept isolated from
273 the files
274 maintained or managed by the source control system.
275 The standard area for generated files is the top level
276 <code>build/</code> directory.
277 </li>
278 <li>
279 The default build process should be to build the product
280 and nothing else, in one form, e.g. a product (optimized),
281 debug (non-optimized, -g plus assert logic), or
282 fastdebug (optimized, -g plus assert logic).
283 </li>
284 <li>
285 The <tt>.hgignore</tt> file in each repository
286 must exist and should
287 include <tt>^build/</tt>, <tt>^dist/</tt> and
288 optionally any
289 <tt>nbproject/private</tt> directories.
290 <strong>It should NEVER</strong> include
291 anything in the
292 <tt>src/</tt> or <tt>test/</tt>
293 or any managed directory area of a repository.
294 </li>
295 <li>
296 Directory names and file names should never contain
297 blanks or
298 non-printing characters.
299 </li>
300 <li>
301 Generated source or binary files should NEVER be added to
302 the repository (that includes <tt>javah</tt> output).
303 There are some exceptions to this rule, in particular
304 with some of the generated configure scripts.
305 </li>
306 <li>
307 Files not needed for typical building
308 or testing of the repository
309 should not be added to the repository.
310 </li>
311 </ul>
312 </blockquote>
314 </blockquote>
316 <!-- ====================================================== -->
317 <hr>
318 <h2><a name="building">Building</a></h2>
319 <blockquote>
320 The very first step in building the OpenJDK is making sure the
321 system itself has everything it needs to do OpenJDK builds.
322 Once a system is setup, it generally doesn't need to be done again.
323 <br>
324 Building the OpenJDK is now done with running a
325 <a href="#configure"><code>configure</code></a>
326 script which will try and find and verify you have everything
327 you need, followed by running
328 <a href="#gmake"><code>make</code></a>, e.g.
329 <blockquote>
330 <b>
331 <code>
332 bash ./configure<br>
333 make all
334 </code>
335 </b>
336 </blockquote>
337 Where possible the <code>configure</code> script will attempt to located the
338 various components in the default locations or via component
339 specific variable settings.
340 When the normal defaults fail or components cannot be found,
341 additional <code>configure</code> options may be necessary to help <code>configure</code>
342 find the necessary tools for the build, or you may need to
343 re-visit the setup of your system due to missing software
344 packages.
345 <br>
346 <strong>NOTE:</strong> The <code>configure</code> script
347 file does not have
348 execute permissions and will need to be explicitly run with
349 <code>bash</code>,
350 see the <a href="#guidelines">source guidelines</a>.
352 <!-- ====================================================== -->
353 <hr>
354 <h3><a name="setup">System Setup</a></h3>
355 <blockquote>
356 Before even attempting to use a system to build the OpenJDK
357 there are some very basic system setups needed.
358 For all systems:
359 <ul>
360 <li>
361 Be sure the GNU make utility is version 3.81 or newer,
362 e.g. run "<code>make -version</code>"
363 </li>
364 <li>
365 Install a
366 <a name="bootjdk">Bootstrap JDK</a>.
367 All OpenJDK builds require access to a previously released
368 JDK called the <i>bootstrap JDK</i> or <i>boot JDK.</i>
369 The general rule is that the bootstrap JDK
370 must be an instance of the previous major
371 release of the JDK. In addition, there may be
372 a requirement to use a release at or beyond a
373 particular update level.
374 <br> <br>
376 <b><i>Building JDK 8 requires use of a version
377 of JDK 7 that is at Update 7 or newer. JDK 8
378 developers should not use JDK 8 as the boot
379 JDK, to ensure that JDK 8 dependencies are
380 not introduced into the parts of the system
381 that are built with JDK 7.</i></b>
383 <br> <br>
384 The JDK 7 binaries can be downloaded from Oracle's
385 <a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html"
386 target="_blank">JDK 7 download site</a>.
387 For build performance reasons
388 is very important that this bootstrap JDK be made available
389 on the local disk of the machine doing the build.
390 You should add its <code>bin</code> directory
391 to the <code>PATH</code> environment variable.
392 If <code>configure</code> has any issues finding this JDK, you may
393 need to use the <code>configure</code> option
394 <code>--with-boot-jdk</code>.
395 </li>
396 <li>
397 Ensure that GNU make, the Bootstrap JDK,
398 and the compilers are all
399 in your PATH environment variable
400 </li>
401 </ul>
402 And for specific systems:
403 <table border="1">
404 <thead>
405 <tr>
406 <th>Linux</th>
407 <th>Solaris</th>
408 <th>Windows</th>
409 <th>Mac OS X</th>
410 </tr>
411 </thead>
412 <tbody>
413 <tr>
414 <td>
415 Install all the software development
416 packages needed including
417 <a href="#alsa">alsa</a>,
418 <a href="#freetype">freetype</a>,
419 <a href="#cups">cups</a>, and
420 <a href="#xrender">xrender</a>.
421 <br>
422 See
423 <a href="#SDBE">specific system packages</a>.
424 </td>
425 <td>
426 Install all the software development
427 packages needed including
428 <a href="#studio">Studio Compilers</a>,
429 <a href="#freetype">freetype</a>,
430 <a href="#cups">cups</a>, and
431 <a href="#xrender">xrender</a>.
432 <br>
433 See
434 <a href="#SDBE">specific system packages</a>.
435 </td>
436 <td>
437 <ul>
438 <li>
439 Install one of
440 <a href="#cygwin">CYGWIN</a> or
441 <a href="#msys">MinGW/MSYS</a>
442 </li>
443 <li>
444 Install
445 <a href="#vs2010">Visual Studio 2010</a>
446 </li>
447 <li>
448 Install the
449 <a href="#dxsdk">Microsoft DirectX SDK</a>
450 </li>
451 </ul>
452 </td>
453 <td>
454 Install
455 <a href="https://developer.apple.com/xcode/">XCode 4.5.2</a>
456 and also install the "Command line tools" found under the
457 preferences pane "Downloads"
458 </td>
459 </tr>
460 </tbody>
461 </table>
463 <h4><a name="linux">Linux</a></h4>
464 <blockquote>
465 With Linux, try and favor the system packages over
466 building your own
467 or getting packages from other areas.
468 Most Linux builds should be possible with the system's
469 available packages.
470 <br>
471 Note that some Linux systems have a habit of pre-populating
472 your environment variables for you, for example <code>JAVA_HOME</code>
473 might get pre-defined for you to refer to the JDK installed on
474 your Linux system.
475 You will need to unset <code>JAVA_HOME</code>.
476 It's a good idea to run <code>env</code> and verify the
477 environment variables you are getting from the default system
478 settings make sense for building the OpenJDK.
480 </blockquote>
482 <h4><a name="solaris">Solaris</a></h4>
483 <blockquote>
484 <h5><a name="studio">Studio Compilers</a></h5>
485 <blockquote>
486 At a minimum, the
487 <a href="http://www.oracle.com/technetwork/server-storage/solarisstudio/downloads/index.htm" target="_blank">
488 Studio 12 Update 1 Compilers</a>
489 (containing version 5.10 of the C and C++ compilers) is required,
490 including specific patches.
491 <p>
492 The Solaris SPARC patch list is:
493 <ul>
494 <li>
495 118683-05: SunOS 5.10: Patch for profiling libraries and assembler
496 </li>
497 <li>
498 119963-21: SunOS 5.10: Shared library patch for C++
499 </li>
500 <li>
501 120753-08: SunOS 5.10: Microtasking libraries (libmtsk) patch
502 </li>
503 <li>
504 128228-09: Sun Studio 12 Update 1: Patch for Sun C++ Compiler
505 </li>
506 <li>
507 141860-03: Sun Studio 12 Update 1: Patch for Compiler Common patch for Sun C C++ F77 F95
508 </li>
509 <li>
510 141861-05: Sun Studio 12 Update 1: Patch for Sun C Compiler
511 </li>
512 <li>
513 142371-01: Sun Studio 12.1 Update 1: Patch for dbx
514 </li>
515 <li>
516 143384-02: Sun Studio 12 Update 1: Patch for debuginfo handling
517 </li>
518 <li>
519 143385-02: Sun Studio 12 Update 1: Patch for Compiler Common patch for Sun C C++ F77 F95
520 </li>
521 <li>
522 142369-01: Sun Studio 12.1: Patch for Performance Analyzer Tools
523 </li>
524 </ul>
525 <p>
526 The Solaris X86 patch list is:
527 <ul>
528 <li>
529 119961-07: SunOS 5.10_x86, x64, Patch for profiling libraries and assembler
530 </li>
531 <li>
532 119964-21: SunOS 5.10_x86: Shared library patch for C++_x86
533 </li>
534 <li>
535 120754-08: SunOS 5.10_x86: Microtasking libraries (libmtsk) patch
536 </li>
537 <li>
538 141858-06: Sun Studio 12 Update 1_x86: Sun Compiler Common patch for x86 backend
539 </li>
540 <li>
541 128229-09: Sun Studio 12 Update 1_x86: Patch for C++ Compiler
542 </li>
543 <li>
544 142363-05: Sun Studio 12 Update 1_x86: Patch for C Compiler
545 </li>
546 <li>
547 142368-01: Sun Studio 12.1_x86: Patch for Performance Analyzer Tools
548 </li>
549 </ul>
550 <p>
551 Place the <code>bin</code> directory in <code>PATH</code>.
552 <p>
553 The Oracle Solaris Studio Express compilers at:
554 <a href="http://www.oracle.com/technetwork/server-storage/solarisstudio/downloads/index-jsp-142582.html" target="_blank">
555 Oracle Solaris Studio Express Download site</a>
556 are also an option, although these compilers have not
557 been extensively used yet.
558 </blockquote>
560 </blockquote> <!-- Solaris -->
562 <h4><a name="windows">Windows</a></h4>
563 <blockquote>
565 <h5><a name="toolkit">Windows Unix Toolkit</a></h5>
566 <blockquote>
567 Building on Windows requires a Unix-like environment, notably a
568 Unix-like shell.
569 There are several such environments available of which
570 <a href="http://www.cygwin.com/">Cygwin</a> and
571 <a href="http://www.mingw.org/wiki/MSYS">MinGW/MSYS</a> are
572 currently supported for
573 the OpenJDK build. One of the differences of these
574 systems from standard Windows tools is the way
575 they handle Windows path names, particularly path names which contain
576 spaces, backslashes as path separators and possibly drive letters.
577 Depending
578 on the use case and the specifics of each environment these path
579 problems can
580 be solved by a combination of quoting whole paths, translating
581 backslashes to
582 forward slashes, escaping backslashes with additional backslashes and
583 translating the path names to their
584 <a href="http://en.wikipedia.org/wiki/8.3_filename">
585 "8.3" version</a>.
587 <h6><a name="cygwin">CYGWIN</a></h6>
588 <blockquote>
589 CYGWIN is an open source, Linux-like environment which tries to emulate
590 a complete POSIX layer on Windows. It tries to be smart about path names
591 and can usually handle all kinds of paths if they are correctly quoted
592 or escaped although internally it maps drive letters <code><drive>:</code>
593 to a virtual directory <code>/cygdrive/<drive></code>.
594 <p>
595 You can always use the <code>cygpath</code> utility to map pathnames with spaces
596 or the backslash character into the <code>C:/</code> style of pathname
597 (called 'mixed'), e.g. <code>cygpath -s -m "<i>path</i>"</code>.
598 </p>
599 <p>
600 Note that the use of CYGWIN creates a unique problem with regards to
601 setting <a href="#path"><code>PATH</code></a>. Normally on Windows
602 the <code>PATH</code> variable contains directories
603 separated with the ";" character (Solaris and Linux use ":").
604 With CYGWIN, it uses ":", but that means that paths like "C:/path"
605 cannot be placed in the CYGWIN version of <code>PATH</code> and
606 instead CYGWIN uses something like <code>/cygdrive/c/path</code>
607 which CYGWIN understands, but only CYGWIN understands.
608 </p>
609 <p>
610 The OpenJDK build requires CYGWIN version 1.7.16 or newer.
611 Information about CYGWIN can
612 be obtained from the CYGWIN website at
613 <a href="http://www.cygwin.com" target="_blank">www.cygwin.com</a>.
614 </p>
615 <p>
616 By default CYGWIN doesn't install all the tools required for building
617 the OpenJDK.
618 Along with the default installation, you need to install
619 the following tools.
620 <blockquote>
621 <table border="1">
622 <thead>
623 <tr>
624 <td>Binary Name</td>
625 <td>Category</td>
626 <td>Package</td>
627 <td>Description</td>
628 </tr>
629 </thead>
630 <tbody>
631 <tr>
632 <td>ar.exe</td>
633 <td>Devel</td>
634 <td>binutils</td>
635 <td>
636 The GNU assembler, linker and binary utilities
637 </td>
638 </tr>
639 <tr>
640 <td>make.exe</td>
641 <td>Devel</td>
642 <td>make</td>
643 <td>
644 The GNU version of the 'make' utility built for CYGWIN
645 </td>
646 </tr>
647 <tr>
648 <td>m4.exe</td>
649 <td>Interpreters</td>
650 <td>m4</td>
651 <td>
652 GNU implementation of the traditional Unix macro
653 processor
654 </td>
655 </tr>
656 <tr>
657 <td>cpio.exe</td>
658 <td>Utils</td>
659 <td>cpio</td>
660 <td>
661 A program to manage archives of files
662 </td>
663 </tr>
664 <tr>
665 <td>gawk.exe</td>
666 <td>Utils</td>
667 <td>awk</td>
668 <td>
669 Pattern-directed scanning and processing language
670 </td>
671 </tr>
672 <tr>
673 <td>file.exe</td>
674 <td>Utils</td>
675 <td>file</td>
676 <td>
677 Determines file type using 'magic' numbers
678 </td>
679 </tr>
680 <tr>
681 <td>zip.exe</td>
682 <td>Archive</td>
683 <td>zip</td>
684 <td>
685 Package and compress (archive) files
686 </td>
687 </tr>
688 <tr>
689 <td>unzip.exe</td>
690 <td>Archive</td>
691 <td>unzip</td>
692 <td>
693 Extract compressed files in a ZIP archive
694 </td>
695 </tr>
696 <tr>
697 <td>free.exe</td>
698 <td>System</td>
699 <td>procps</td>
700 <td>
701 Display amount of free and used memory in the system
702 </td>
703 </tr>
704 </tbody>
705 </table>
706 </blockquote>
707 Note that the CYGWIN software can conflict with other non-CYGWIN
708 software on your Windows system.
709 CYGWIN provides a
710 <a href="http://cygwin.com/faq/faq.using.html" target="_blank">FAQ</a> for
711 known issues and problems, of particular interest is the
712 section on
713 <a href="http://cygwin.com/faq/faq.using.html#faq.using.bloda" target="_blank">
714 BLODA (applications that interfere with CYGWIN)</a>.
715 </blockquote>
717 <h6><a name="msys">MinGW/MSYS</a></h6>
718 <blockquote>
719 MinGW ("Minimalist GNU for Windows") is a collection of free Windows
720 specific header files and import libraries combined with GNU toolsets that
721 allow one to produce native Windows programs that do not rely on any
722 3rd-party C runtime DLLs. MSYS is a supplement to MinGW which allows building
723 applications and programs which rely on traditional UNIX tools to
724 be present. Among others this includes tools like <code>bash</code>
725 and <code>make</code>.
726 See <a href="http://www.mingw.org/wiki/MSYS" target="_blank">MinGW/MSYS</a>
727 for more information.
728 <p>
729 Like Cygwin, MinGW/MSYS can handle different types of path formats. They
730 are internally converted to paths with forward slashes and drive letters
731 <code><drive>:</code> replaced by a virtual
732 directory <code>/<drive></code>. Additionally, MSYS automatically
733 detects binaries compiled for the MSYS environment and feeds them with the
734 internal, Unix-style path names. If native Windows applications are called
735 from within MSYS programs their path arguments are automatically converted
736 back to Windows style path names with drive letters and backslashes as
737 path separators. This may cause problems for Windows applications which
738 use forward slashes as parameter separator (e.g. <code>cl /nologo /I</code>)
739 because MSYS may wrongly <a href="http://mingw.org/wiki/Posix_path_conversion">
740 replace such parameters by drive letters</a>.
741 </p>
742 <p>
743 In addition to the tools which will be installed
744 by default, you have
745 to manually install the
746 <code>msys-zip</code> and
747 <code>msys-unzip</code> packages.
748 This can be easily done with the MinGW command line installer:
749 <blockquote>
750 <code>mingw-get.exe install msys-zip</code>
751 <br>
752 <code>mingw-get.exe install msys-unzip</code>
753 </blockquote>
754 </blockquote>
756 </blockquote>
758 <h5><a name="vs2010">Visual Studio 2010 Compilers</a></h5>
759 <blockquote>
760 <p>
761 The 32-bit and 64-bit OpenJDK Windows build requires
762 Microsoft Visual Studio C++ 2010 (VS2010) Professional
763 Edition or Express compiler.
764 The compiler and other tools are expected to reside
765 in the location defined by the variable
766 <code>VS100COMNTOOLS</code> which
767 is set by the Microsoft Visual Studio installer.
768 </p>
769 <p>
770 Only the C++ part of VS2010 is needed.
771 Try to let the installation go to the default
772 install directory.
773 Always reboot your system after installing VS2010.
774 The system environment variable VS100COMNTOOLS
775 should be
776 set in your environment.
777 </p>
778 <p>
779 Make sure that TMP and TEMP are also set
780 in the environment
781 and refer to Windows paths that exist,
782 like <code>C:\temp</code>,
783 not <code>/tmp</code>, not <code>/cygdrive/c/temp</code>,
784 and not <code>C:/temp</code>.
785 <code>C:\temp</code> is just an example,
786 it is assumed that this area is
787 private to the user, so by default
788 after installs you should
789 see a unique user path in these variables.
790 </p>
791 </blockquote>
794 </blockquote> <!-- Windows -->
796 <h4><a name="macosx">Mac OS X</a></h4>
797 <blockquote>
798 Make sure you get the right XCode version.
799 </blockquote> <!-- Mac OS X -->
801 </blockquote>
803 <!-- ====================================================== -->
804 <hr>
805 <h3><a name="configure">Configure</a></h3>
806 <blockquote>
807 The basic invocation of the <code>configure</code> script
808 looks like:
809 <blockquote>
810 <b><code>bash ./configure [<i>options</i>]</code></b>
811 </blockquote>
812 This will create an output directory containing the
813 "configuration" and setup an area for the build result.
814 This directory typically looks like:
815 <blockquote>
816 <b><code>build/linux-x64-normal-server-release</code></b>
817 </blockquote>
818 <code>configure</code> will try to figure out what system you are running on
819 and where all necessary build components are.
820 If you have all prerequisites for building installed,
821 it should find everything.
822 If it fails to detect any component automatically,
823 it will exit and inform you about the problem.
824 When this happens, read more below in
825 <a href="#configureoptions">the <code>configure</code> options</a>.
826 <p>
827 Some examples:
828 </p>
829 <table border="1">
830 <thead>
831 <tr>
832 <th>Description</th>
833 <th>Configure Command Line</th>
834 </tr>
835 </thead>
836 <tbody>
837 <tr>
838 <td>Windows 32bit build with freetype specified</td>
839 <td>
840 <code>bash ./configure --with-freetype=/cygdrive/c/freetype-i586 --with-target-bits=32</code>
841 </td>
842 </tr>
843 <tr>
844 <td>Debug 64bit Build</td>
845 <td>
846 <code>bash ./configure --enable-debug --with-target-bits=64</code>
847 </td>
848 </tr>
849 </tbody>
850 </table>
852 <!-- ====================================================== -->
853 <h4><a name="configureoptions">Configure Options</a></h4>
854 <blockquote>
855 Complete details on all the OpenJDK <code>configure</code> options can
856 be seen with:
857 <blockquote>
858 <b><code>bash ./configure --help=short</code></b>
859 </blockquote>
860 Use <code>-help</code> to see all the <code>configure</code> options
861 available.
863 You can generate any number of different configurations,
864 e.g. debug, release, 32, 64, etc.
866 Some of the more commonly used <code>configure</code> options are:
868 <table border="1">
869 <thead>
870 <tr>
871 <th width="300">OpenJDK Configure Option</th>
872 <th>Description</th>
873 </tr>
874 </thead>
875 <tbody>
876 <tr>
877 <td><b><code>--enable-debug</code></b></td>
878 <td>
879 set the debug level to fastdebug (this is a shorthand for
880 <code>--with-debug-level=fastdebug</code>)
881 </td>
882 </tr>
883 <tr>
884 <td><b><code>--with-alsa=</code></b><i>path</i></td>
885 <td>
886 select the location of the
887 <a name="alsa">Advanced Linux Sound Architecture (ALSA)</a>
888 <br>
889 Version 0.9.1 or newer of the ALSA files are
890 required for building the OpenJDK on Linux.
891 These Linux files are usually available from an "alsa"
892 of "libasound"
893 development package,
894 and it's highly recommended that you try and use
895 the package provided by the particular version of Linux that
896 you are using.
897 </td>
898 </tr>
899 <tr>
900 <td><b><code>--with-boot-jdk=</code></b><i>path</i></td>
901 <td>
902 select the <a href="#bootjdk">Bootstrap JDK</a>
903 </td>
904 </tr>
905 <tr>
906 <td><b><code>--with-boot-jdk-jvmargs=</code></b>"<i>args</i>"</td>
907 <td>
908 provide the JVM options to be used to run the
909 <a href="#bootjdk">Bootstrap JDK</a>
910 </td>
911 </tr>
912 <tr>
913 <td><b><code>--with-cacerts=</code></b><i>path</i></td>
914 <td>
915 select the path to the cacerts file.
916 <br>
917 See <a href="http://en.wikipedia.org/wiki/Certificate_Authority" target="_blank">
918 http://en.wikipedia.org/wiki/Certificate_Authority</a>
919 for a better understanding of the Certificate Authority (CA).
920 A certificates file named "cacerts"
921 represents a system-wide keystore with CA certificates.
922 In JDK and JRE
923 binary bundles, the "cacerts" file contains root CA certificates from
924 several public CAs (e.g., VeriSign, Thawte, and Baltimore).
925 The source contain a cacerts file
926 without CA root certificates.
927 Formal JDK builders will need to secure
928 permission from each public CA and include the certificates into their
929 own custom cacerts file.
930 Failure to provide a populated cacerts file
931 will result in verification errors of a certificate chain during runtime.
932 By default an empty cacerts file is provided and that should be
933 fine for most JDK developers.
934 </td>
935 </tr>
936 <tr>
937 <td><b><code>--with-cups=</code></b><i>path</i></td>
938 <td>
939 select the CUPS install location
940 <br>
941 The
942 <a name="cups">Common UNIX Printing System (CUPS) Headers</a>
943 are required for building the
944 OpenJDK on Solaris and Linux.
945 The Solaris header files can be obtained by installing
946 the package <strong>SFWcups</strong> from the Solaris Software
947 Companion CD/DVD, these often will be installed into the
948 directory <code>/opt/sfw/cups</code>.
949 <br>
950 The CUPS header files can always be downloaded from
951 <a href="http://www.cups.org" target="_blank">www.cups.org</a>.
952 </td>
953 </tr>
954 <tr>
955 <td><b><code>--with-cups-include=</code></b><i>path</i></td>
956 <td>
957 select the CUPS include directory location
958 </td>
959 </tr>
960 <tr>
961 <td><b><code>--with-debug-level=</code></b><i>level</i></td>
962 <td>
963 select the debug information level of release,
964 fastdebug, or slowdebug
965 </td>
966 </tr>
967 <tr>
968 <td><b><code>--with-dev-kit=</code></b><i>path</i></td>
969 <td>
970 select location of the compiler install or
971 developer install location
972 </td>
973 </tr>
974 <tr>
975 <td><b><code>--with-dxsdk=</code></b><i>path</i></td>
976 <td>
977 select location of the Windows Direct X SDK install
978 <br>
979 The <a name="dxsdk">Microsoft DirectX 9.0 SDK</a>
980 header files and libraries
981 from the Summer 2004 edition
982 are required for building OpenJDK.
983 This SDK can be downloaded from
984 <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=FD044A42-9912-42A3-9A9E-D857199F888E&displaylang=en" target="_blank">
985 Microsoft DirectX 9.0 SDK (Summer 2004)</a>.
986 If the link above becomes obsolete, the SDK can be found from
987 <a href="http://download.microsoft.com" target="_blank">the Microsoft Download Site</a>
988 (search with "DirectX 9.0 SDK Update Summer 2004").
989 Installation usually will set the environment variable
990 <code>DXSDK_DIR</code> to it's install location.
991 </td>
992 </tr>
993 <tr>
994 <td><b><code>--with-freetype=</code></b><i>path</i></td>
995 <td>
996 select the freetype files to use.
997 <br>
998 Expecting the
999 <a name="freetype">freetype</a> libraries under
1000 <code>lib/</code> and the
1001 headers under <code>include/</code>.
1002 <br>
1003 Version 2.3 or newer of FreeType is required.
1004 On Unix systems required files can be available as part of your
1005 distribution (while you still may need to upgrade them).
1006 Note that you need development version of package that
1007 includes both the FreeType library and header files.
1008 <br>
1009 You can always download latest FreeType version from the
1010 <a href="http://www.freetype.org" target="_blank">FreeType website</a>.
1011 <br>
1012 Building the freetype 2 libraries from scratch is also possible,
1013 however on Windows refer to the
1014 <a href="http://freetype.freedesktop.org/wiki/FreeType_DLL">
1015 Windows FreeType DLL build instructions</a>.
1016 <br>
1017 Note that by default FreeType is built with byte code hinting
1018 support disabled due to licensing restrictions.
1019 In this case, text appearance and metrics are expected to
1020 differ from Sun's official JDK build.
1021 See
1022 <a href="http://freetype.sourceforge.net/freetype2/index.html">
1023 the SourceForge FreeType2 Home Page
1024 </a>
1025 for more information.
1026 </td>
1027 </tr>
1028 <tr>
1029 <td><b><code>--with-import-hotspot=</code></b><i>path</i></td>
1030 <td>
1031 select the location to find hotspot
1032 binaries from a previous build to avoid building
1033 hotspot
1034 </td>
1035 </tr>
1036 <tr>
1037 <td><b><code>--with-target-bits=</code></b><i>arg</i></td>
1038 <td>
1039 select 32 or 64 bit build
1040 </td>
1041 </tr>
1042 <tr>
1043 <td><b><code>--with-jvm-variants=</code></b><i>variants</i></td>
1044 <td>
1045 select the JVM variants to build from, comma
1046 separated list that can include:
1047 server, client, kernel, zero and zeroshark
1048 </td>
1049 </tr>
1050 <tr>
1051 <td><b><code>--with-memory-size=</code></b><i>size</i></td>
1052 <td>
1053 select the RAM size that GNU make will think
1054 this system has
1055 </td>
1056 </tr>
1057 <tr>
1058 <td><a name="msvcrNN"><b><code>--with-msvcr-dll=</code></b><i>path</i></a></td>
1059 <td>
1060 select the <code>msvcr100.dll</code>
1061 file to include in the
1062 Windows builds (C/C++ runtime library for
1063 Visual Studio).
1064 <br>
1065 This is usually picked up automatically
1066 from the redist
1067 directories of Visual Studio 2010.
1068 </td>
1069 </tr>
1070 <tr>
1071 <td><b><code>--with-num-cores=</code></b><i>cores</i></td>
1072 <td>
1073 select the number of cores to use (processor
1074 count or CPU count)
1075 </td>
1076 </tr>
1077 <tr>
1078 <td><b><code>--with-x=</code></b><i>path</i></td>
1079 <td>
1080 select the location of the X11 and xrender files.
1081 <br>
1082 The
1083 <a name="xrender">XRender Extension Headers</a>
1084 are required for building the
1085 OpenJDK on Solaris and Linux.
1086 <br>
1087 The Linux header files are usually available from a "Xrender"
1088 development package, it's recommended that you try and use
1089 the package provided by the particular distribution of Linux that
1090 you are using.
1091 <br>
1092 The Solaris XRender header files is
1093 included with the other X11 header files
1094 in the package <strong>SFWxwinc</strong>
1095 on new enough versions of
1096 Solaris and will be installed in
1097 <code>/usr/X11/include/X11/extensions/Xrender.h</code> or
1098 <code>/usr/openwin/share/include/X11/extensions/Xrender.h</code>
1099 </td>
1100 </tr>
1101 </tbody>
1102 </table>
1103 </blockquote>
1105 </blockquote>
1107 <!-- ====================================================== -->
1108 <hr>
1109 <h3><a name="make">Make</a></h3>
1110 <blockquote>
1111 The basic invocation of the <code>make</code> utility
1112 looks like:
1113 <blockquote>
1114 <b><code>make all</code></b>
1115 </blockquote>
1116 This will start the build to the output directory containing the
1117 "configuration" that was created by the <code>configure</code>
1118 script. Run <code>make help</code> for more information on
1119 the available targets.
1120 <br>
1121 There are some of the make targets that
1122 are of general interest:
1123 <table border="1">
1124 <thead>
1125 <tr>
1126 <th>Make Target</th>
1127 <th>Description</th>
1128 </tr>
1129 </thead>
1130 <tbody>
1131 <tr>
1132 <td><i>empty</i></td>
1133 <td>build everything but no images</td>
1134 </tr>
1135 <tr>
1136 <td><b><code>all</code></b></td>
1137 <td>build everything including images</td>
1138 </tr>
1139 <tr>
1140 <td><b><code>all-conf</code></b></td>
1141 <td>build all configurations</td>
1142 </tr>
1143 <tr>
1144 <td><b><code>images</code></b></td>
1145 <td>create complete j2sdk and j2re images</td>
1146 </tr>
1147 <tr>
1148 <td><b><code>install</code></b></td>
1149 <td>install the generated images locally,
1150 typically in <code>/usr/local</code></td>
1151 </tr>
1152 <tr>
1153 <td><b><code>clean</code></b></td>
1154 <td>remove all files generated by make,
1155 but not those generated by <code>configure</code></td>
1156 </tr>
1157 <tr>
1158 <td><b><code>dist-clean</code></b></td>
1159 <td>remove all files generated by both
1160 and <code>configure</code> (basically killing the configuration)</td>
1161 </tr>
1162 <tr>
1163 <td><b><code>help</code></b></td>
1164 <td>give some help on using <code>make</code>,
1165 including some interesting make targets</td>
1166 </tr>
1167 </tbody>
1168 </table>
1169 </blockquote>
1170 </blockquote>
1172 <!-- ====================================================== -->
1173 <hr>
1174 <h2><a name="testing">Testing</a></h2>
1175 <blockquote>
1176 When the build is completed, you should see the generated
1177 binaries and associated files in the <code>j2sdk-image</code>
1178 directory in the output directory.
1179 In particular, the
1180 <code>build/<i>*</i>/images/j2sdk-image/bin</code>
1181 directory should contain executables for the
1182 OpenJDK tools and utilities for that configuration.
1183 The testing tool <code>jtreg</code> will be needed
1184 and can be found at:
1185 <a href="http://openjdk.java.net/jtreg/" target="_blank">
1186 the jtreg site</a>.
1187 The provided regression tests in the repositories
1188 can be run with the command:
1189 <blockquote>
1190 <code><b>cd test && make PRODUCT_HOME=`pwd`/../build/*/images/j2sdk-image all</b></code>
1191 </blockquote>
1192 </blockquote>
1194 <!-- ====================================================== -->
1195 <!-- ====================================================== -->
1196 <!-- ====================================================== -->
1197 <!-- ====================================================== -->
1198 <!-- ====================================================== -->
1199 <!-- ====================================================== -->
1200 <!-- ====================================================== -->
1201 <!-- ====================================================== -->
1202 <!-- ====================================================== -->
1204 <!-- ====================================================== -->
1205 <hr>
1206 <h2><a name="hints">Appendix A: Hints and Tips</a></h2>
1207 <blockquote>
1209 <h3><a name="faq">FAQ</a></h3>
1210 <blockquote>
1212 <p>
1213 <b>Q:</b> The <code>generated-configure.sh</code> file looks horrible!
1214 How are you going to edit it?
1215 <br>
1216 <b>A:</b> The <code>generated-configure.sh</code> file is generated (think
1217 "compiled") by the autoconf tools. The source code is
1218 in <code>configure.ac</code> and various .m4 files in common/autoconf,
1219 which are much more readable.
1220 </p>
1222 <p>
1223 <b>Q:</b>
1224 Why is the <code>generated-configure.sh</code> file checked in,
1225 if it is generated?
1226 <br>
1227 <b>A:</b>
1228 If it was not generated, every user would need to have the autoconf
1229 tools installed, and re-generate the <code>configure</code> file
1230 as the first step.
1231 Our goal is to minimize the work needed to be done by the user
1232 to start building OpenJDK, and to minimize
1233 the number of external dependencies required.
1234 </p>
1236 <p>
1237 <b>Q:</b>
1238 Do you require a specific version of autoconf for regenerating
1239 <code>generated-configure.sh</code>?
1240 <br>
1241 <b>A:</b>
1242 Yes, version 2.69 is required and should be easy
1243 enough to aquire on all supported operating
1244 systems. The reason for this is to avoid
1245 large spurious changes in <code>generated-configure.sh</code>.
1246 </p>
1248 <p>
1249 <b>Q:</b>
1250 How do you regenerate <code>generated-configure.sh</code>
1251 after making changes to the input files?
1252 <br>
1253 <b>A:</b>
1254 Regnerating <code>generated-configure.sh</code>
1255 should always be done using the
1256 script <code>common/autoconf/autogen.sh</code> to
1257 ensure that the correct files get updated. This
1258 script should also be run after mercurial tries to
1259 merge <code>generated-configure.sh</code> as a
1260 merge of the generated file is not guaranteed to
1261 be correct.
1262 </p>
1264 <p>
1265 <b>Q:</b>
1266 What are the files in <code>common/makefiles/support/*</code> for?
1267 They look like gibberish.
1268 <br>
1269 <b>A:</b>
1270 They are a somewhat ugly hack to compensate for command line length
1271 limitations on certain platforms (Windows, Solaris).
1272 Due to a combination of limitations in make and the shell,
1273 command lines containing too many files will not work properly.
1274 These
1275 helper files are part of an elaborate hack that will compress the
1276 command line in the makefile and then uncompress it safely.
1277 We're
1278 not proud of it, but it does fix the problem.
1279 If you have any better suggestions, we're all ears! :-)
1280 </p>
1282 <p>
1283 <b>Q:</b>
1284 I want to see the output of the commands that make runs,
1285 like in the old build. How do I do that?
1286 <br>
1287 <b>A:</b>
1288 You specify the <code>LOG</code> variable to make. There are
1289 several log levels:
1290 </p>
1291 <blockquote>
1292 <ul>
1293 <li>
1294 <b><code>warn</code></b> — Default and very quiet.
1295 </li>
1296 <li>
1297 <b><code>info</code></b> — Shows more progress information
1298 than warn.
1299 </li>
1300 <li>
1301 <b><code>debug</code></b> — Echos all command lines and
1302 prints all macro calls for compilation definitions.
1303 </li>
1304 <li>
1305 <b><code>trace</code></b> — Echos all $(shell) command
1306 lines as well.
1307 </li>
1308 </ul>
1309 </blockquote>
1311 <p>
1312 <b>Q:</b>
1313 When do I have to re-run <code>configure</code>?
1314 <br>
1315 <b>A:</b>
1316 Normally you will run <code>configure</code> only once for creating a
1317 configuration.
1318 You need to re-run configuration only if you want to change any
1319 configuration options,
1320 or if you pull down changes to the <code>configure</code> script.
1321 </p>
1323 <p>
1324 <b>Q:</b>
1325 I have added a new source file. Do I need to modify the makefiles?
1326 <br>
1327 <b>A:</b>
1328 Normally, no. If you want to create e.g. a new native
1329 library,
1330 you will need to modify the makefiles. But for normal file
1331 additions or removals, no changes are needed. There are certan
1332 exceptions for some native libraries where the source files are spread
1333 over many directories which also contain sources for other
1334 libraries. In these cases it was simply easier to create include lists
1335 rather than excludes.
1336 </p>
1338 <p>
1339 <b>Q:</b>
1340 When I run <code>configure --help</code>, I see many strange options,
1341 like <code>--dvidir</code>. What is this?
1342 <br>
1343 <b>A:</b>
1344 Configure provides a slew of options by default, to all projects
1345 that use autoconf. Most of them are not used in OpenJDK,
1346 so you can safely ignore them. To list only OpenJDK specific features,
1347 use <code>configure --help=short</code> instead.
1348 </p>
1350 <p>
1351 <b>Q:</b>
1352 <code>configure</code> provides OpenJDK-specific features such as
1353 <code>--with-builddeps-server</code> that are not
1354 described in this document. What about those?
1355 <br>
1356 <b>A:</b>
1357 Try them out if you like! But be aware that most of these are
1358 experimental features.
1359 Many of them don't do anything at all at the moment; the option
1360 is just a placeholder. Others depend on
1361 pieces of code or infrastructure that is currently
1362 not ready for prime time.
1363 </p>
1365 <p>
1366 <b>Q:</b>
1367 How will you make sure you don't break anything?
1368 <br>
1369 <b>A:</b>
1370 We have a script that compares the result of the new build system
1371 with the result of the old. For most part, we aim for (and achieve)
1372 byte-by-byte identical output. There are however technical issues
1373 with e.g. native binaries, which might differ in a byte-by-byte
1374 comparison, even
1375 when building twice with the old build system.
1376 For these, we compare relevant aspects
1377 (e.g. the symbol table and file size).
1378 Note that we still don't have 100%
1379 equivalence, but we're close.
1380 </p>
1382 <p>
1383 <b>Q:</b>
1384 I noticed this thing X in the build that looks very broken by design.
1385 Why don't you fix it?
1386 <br>
1387 <b>A:</b>
1388 Our goal is to produce a build output that is as close as
1389 technically possible to the old build output.
1390 If things were weird in the old build,
1391 they will be weird in the new build.
1392 Often, things were weird before due to obscurity,
1393 but in the new build system the weird stuff comes up to the surface.
1394 The plan is to attack these things at a later stage,
1395 after the new build system is established.
1396 </p>
1398 <p>
1399 <b>Q:</b>
1400 The code in the new build system is not that well-structured.
1401 Will you fix this?
1402 <br>
1403 <b>A:</b>
1404 Yes! The new build system has grown bit by bit as we converted
1405 the old system. When all of the old build system is converted,
1406 we can take a step back and clean up the structure of the new build
1407 system. Some of this we plan to do before replacing the old build
1408 system and some will need to wait until after.
1409 </p>
1411 <p>
1412 <b>Q:</b>
1413 Is anything able to use the results of the new build's default make target?
1414 <br>
1415 <b>A:</b>
1416 Yes, this is the minimal (or roughly minimal)
1417 set of compiled output needed for a developer to actually
1418 execute the newly built JDK. The idea is that in an incremental
1419 development fashion, when doing a normal make,
1420 you should only spend time recompiling what's changed
1421 (making it purely incremental) and only do the work that's
1422 needed to actually run and test your code.
1423 The packaging stuff that is part of the <code>images</code>
1424 target is not needed for a normal developer who wants to
1425 test his new code. Even if it's quite fast, it's still unnecessary.
1426 We're targeting sub-second incremental rebuilds! ;-)
1427 (Or, well, at least single-digit seconds...)
1428 </p>
1430 <p>
1431 <b>Q:</b>
1432 I usually set a specific environment variable when building,
1433 but I can't find the equivalent in the new build.
1434 What should I do?
1435 <br>
1436 <b>A:</b>
1437 It might very well be that we have neglected to add support for
1438 an option that was actually used from outside the build system.
1439 Email us and we will add support for it!
1440 </p>
1442 </blockquote>
1444 <h3><a name="performance">Build Performance Tips</a></h3>
1445 <blockquote>
1447 <p>Building OpenJDK requires a lot of horsepower.
1448 Some of the build tools can be adjusted to utilize more or less
1449 of resources such as
1450 parallel threads and memory.
1451 The <code>configure</code> script analyzes your system and selects reasonable
1452 values for such options based on your hardware.
1453 If you encounter resource problems, such as out of memory conditions,
1454 you can modify the detected values with:</p>
1456 <ul>
1457 <li>
1458 <b><code>--with-num-cores</code></b>
1459 —
1460 number of cores in the build system,
1461 e.g. <code>--with-num-cores=8</code>
1462 </li>
1463 <li>
1464 <b><code>--with-memory-size</code></b>
1465 — memory (in MB) available in the build system,
1466 e.g. <code>--with-memory-size=1024</code>
1467 </li>
1468 </ul>
1470 <p>It might also be necessary to specify the JVM arguments passed
1471 to the Bootstrap JDK, using e.g.
1472 <code>--with-boot-jdk-jvmargs="-Xmx8G -enableassertions"</code>.
1473 Doing this will override the default JVM arguments
1474 passed to the Bootstrap JDK.</p>
1477 <p>One of the top goals of the new build system is to improve the
1478 build performance and decrease the time needed to build. This will
1479 soon also apply to the java compilation when the Smart Javac wrapper
1480 is making its way into jdk8. It can be tried in the build-infra
1481 repository already. You are likely to find that the new build system
1482 is faster than the old one even without this feature.</p>
1484 <p>At the end of a successful execution of <code>configure</code>,
1485 you will get a performance summary,
1486 indicating how well the build will perform. Here you will
1487 also get performance hints.
1488 If you want to build fast, pay attention to those!</p>
1490 <h4>Building with ccache</h4>
1492 <p>A simple way to radically speed up compilation of native code
1493 (typically hotspot and native libraries in JDK) is to install
1494 ccache. This will cache and reuse prior compilation results, if the
1495 source code is unchanged. However, ccache versions prior to 3.1.4
1496 does not work correctly with the precompiled headers used in
1497 OpenJDK. So if your platform supports ccache at 3.1.4 or later, we
1498 highly recommend installing it. This is currently only supported on
1499 linux.</p>
1501 <h4>Building on local disk</h4>
1503 <p>If you are using network shares, e.g. via NFS, for your source code,
1504 make sure the build directory is situated on local disk.
1505 The performance
1506 penalty is extremely high for building on a network share,
1507 close to unusable.</p>
1509 <h4>Building only one JVM</h4>
1511 <p>The old build builds multiple JVMs on 32-bit systems (client and
1512 server; and on Windows kernel as well). In the new build we have
1513 changed this default to only build server when it's available. This
1514 improves build times for those not interested in multiple JVMs. To
1515 mimic the old behavior on platforms that support it,
1516 use <code>--with-jvm-variants=client,server</code>.</p>
1518 <h4>Selecting the number of cores to build on</h4>
1520 <p>By default, <code>configure</code> will analyze your machine and run the make
1521 process in parallel with as many threads as you have cores. This
1522 behavior can be overridden, either "permanently" (on a <code>configure</code>
1523 basis) using <code>--with-num-cores=N</code> or for a single build
1524 only (on a make basis), using <code>make JOBS=N</code>.</p>
1526 <p>If you want to make a slower build just this time, to save some CPU
1527 power for other processes, you can run
1528 e.g. <code>make JOBS=2</code>. This will force the makefiles
1529 to only run 2 parallel processes, or even <code>make JOBS=1</code>
1530 which will disable parallelism.</p>
1532 <p>If you want to have it the other way round, namely having slow
1533 builds default and override with fast if you're
1534 impatient, you should call <code>configure</code> with
1535 <code>--with-num-cores=2</code>, making 2 the default.
1536 If you want to run with more
1537 cores, run <code>make JOBS=8</code></p>
1539 </blockquote>
1541 <h3><a name="troubleshooting">Troubleshooting</a></h3>
1542 <blockquote>
1544 <h4>Solving build problems</h4>
1546 <blockquote>
1547 If the build fails (and it's not due to a compilation error in
1548 a source file you've changed), the first thing you should do
1549 is to re-run the build with more verbosity.
1550 Do this by adding <code>LOG=debug</code> to your make command line.
1551 <br>
1552 The build log (with both stdout and stderr intermingled,
1553 basically the same as you see on your console) can be found as
1554 <code>build.log</code> in your build directory.
1555 <br>
1556 You can ask for help on build problems with the new build system
1557 on either the
1558 <a href="http://mail.openjdk.java.net/mailman/listinfo/build-dev">
1559 build-dev</a>
1560 or the
1561 <a href="http://mail.openjdk.java.net/mailman/listinfo/build-infra-dev">
1562 build-infra-dev</a>
1563 mailing lists. Please include the relevant parts
1564 of the build log.
1565 <br>
1566 A build can fail for any number of reasons.
1567 Most failures
1568 are a result of trying to build in an environment in which all the
1569 pre-build requirements have not been met.
1570 The first step in
1571 troubleshooting a build failure is to recheck that you have satisfied
1572 all the pre-build requirements for your platform.
1573 Scanning the <code>configure</code> log is a good first step, making
1574 sure that what it found makes sense for your system.
1575 Look for strange error messages or any difficulties that
1576 <code>configure</code> had in finding things.
1577 <br>
1578 Some of the more common problems with builds are briefly
1579 described
1580 below, with suggestions for remedies.
1581 <ul>
1582 <li>
1583 <b>Corrupted Bundles on Windows:</b>
1584 <blockquote>
1585 Some virus scanning software has been known to
1586 corrupt the
1587 downloading of zip bundles.
1588 It may be necessary to disable the 'on access' or
1589 'real time'
1590 virus scanning features to prevent this corruption.
1591 This type of "real time" virus scanning can also
1592 slow down the
1593 build process significantly.
1594 Temporarily disabling the feature, or excluding the build
1595 output directory may be necessary to get correct and
1596 faster builds.
1597 </blockquote>
1598 </li>
1599 <li>
1600 <b>Slow Builds:</b>
1601 <blockquote>
1602 If your build machine seems to be overloaded from too many
1603 simultaneous C++ compiles, try setting the
1604 <code>JOBS=1</code> on the <code>make</code> command line.
1605 Then try increasing the count slowly to an acceptable
1606 level for your system. Also:
1607 <blockquote>
1608 Creating the javadocs can be very slow,
1609 if you are running
1610 javadoc, consider skipping that step.
1611 <br>
1612 Faster CPUs, more RAM, and a faster DISK usually helps.
1613 The VM build tends to be CPU intensive
1614 (many C++ compiles),
1615 and the rest of the JDK will often be disk intensive.
1616 <br>
1617 Faster compiles are possible using a tool called
1618 <a href="http://ccache.samba.org/" target="_blank">ccache</a>.
1619 </blockquote>
1620 </blockquote>
1621 </li>
1622 <li>
1623 <b>File time issues:</b>
1624 <blockquote>
1625 If you see warnings that refer to file time stamps, e.g.
1626 <blockquote>
1627 <i>Warning message:</i><code>
1628 File `xxx' has modification time in
1629 the future.</code>
1630 <br>
1631 <i>Warning message:</i> <code> Clock skew detected.
1632 Your build may
1633 be incomplete.</code>
1634 </blockquote>
1635 These warnings can occur when the clock on the build
1636 machine is out of
1637 sync with the timestamps on the source files.
1638 Other errors, apparently
1639 unrelated but in fact caused by the clock skew,
1640 can occur along with
1641 the clock skew warnings.
1642 These secondary errors may tend to obscure the
1643 fact that the true root cause of the problem
1644 is an out-of-sync clock.
1645 <p>
1646 If you see these warnings, reset the clock on the
1647 build
1648 machine, run "<code><i>gmake</i> clobber</code>"
1649 or delete the directory
1650 containing the build output, and restart the
1651 build from the beginning.
1652 </blockquote>
1653 </li>
1654 <li>
1655 <b>Error message:
1656 <code>Trouble writing out table to disk</code></b>
1657 <blockquote>
1658 Increase the amount of swap space on your build machine.
1659 This could be caused by overloading the system and
1660 it may be necessary to use:
1661 <blockquote>
1662 <code>make JOBS=1</code>
1663 </blockquote>
1664 to reduce the load on the system.
1665 </blockquote>
1666 </li>
1667 <li>
1668 <b>Error Message:
1669 <code>libstdc++ not found:</code></b>
1670 <blockquote>
1671 This is caused by a missing libstdc++.a library.
1672 This is installed as part of a specific package
1673 (e.g. libstdc++.so.devel.386).
1674 By default some 64-bit Linux versions (e.g. Fedora)
1675 only install the 64-bit version of the libstdc++ package.
1676 Various parts of the JDK build require a static
1677 link of the C++ runtime libraries to allow for maximum
1678 portability of the built images.
1679 </blockquote>
1680 </li>
1681 <li>
1682 <b>Linux Error Message:
1683 <code>cannot restore segment prot after reloc</code></b>
1684 <blockquote>
1685 This is probably an issue with SELinux (See
1686 <a href="http://en.wikipedia.org/wiki/SELinux" target="_blank">
1687 http://en.wikipedia.org/wiki/SELinux</a>).
1688 Parts of the VM is built without the <code>-fPIC</code> for
1689 performance reasons.
1690 <p>
1691 To completely disable SELinux:
1692 <ol>
1693 <li><code>$ su root</code></li>
1694 <li><code># system-config-securitylevel</code></li>
1695 <li><code>In the window that appears, select the SELinux tab</code></li>
1696 <li><code>Disable SELinux</code></li>
1697 </ol>
1698 <p>
1699 Alternatively, instead of completely disabling it you could
1700 disable just this one check.
1701 <ol>
1702 <li>Select System->Administration->SELinux Management</li>
1703 <li>In the SELinux Management Tool which appears,
1704 select "Boolean" from the menu on the left</li>
1705 <li>Expand the "Memory Protection" group</li>
1706 <li>Check the first item, labeled
1707 "Allow all unconfined executables to use
1708 libraries requiring text relocation ..."</li>
1709 </ol>
1710 </blockquote>
1711 </li>
1712 <li>
1713 <b>Windows Error Messages:</b>
1714 <br>
1715 <code>*** fatal error - couldn't allocate heap, ... </code>
1716 <br>
1717 <code>rm fails with "Directory not empty"</code>
1718 <br>
1719 <code>unzip fails with "cannot create ... Permission denied"</code>
1720 <br>
1721 <code>unzip fails with "cannot create ... Error 50"</code>
1722 <br>
1723 <blockquote>
1724 The CYGWIN software can conflict with other non-CYGWIN
1725 software. See the CYGWIN FAQ section on
1726 <a href="http://cygwin.com/faq/faq.using.html#faq.using.bloda" target="_blank">
1727 BLODA (applications that interfere with CYGWIN)</a>.
1728 </blockquote>
1729 </li>
1730 <li>
1731 <b>Windows Error Message: <code>spawn failed</code></b>
1732 <blockquote>
1733 Try rebooting the system, or there could be some kind of
1734 issue with the disk or disk partition being used.
1735 Sometimes it comes with a "Permission Denied" message.
1736 </blockquote>
1737 </li>
1738 </ul>
1739 </blockquote>
1741 </blockquote> <!-- Troubleshooting -->
1743 </blockquote> <!-- Appendix A -->
1745 <!-- ====================================================== -->
1746 <hr>
1747 <h2><a name="gmake">Appendix B: GNU make</a></h2>
1748 <blockquote>
1750 The Makefiles in the OpenJDK are only valid when used with the
1751 GNU version of the utility command <code>make</code>
1752 (usually called <code>gmake</code> on Solaris).
1753 A few notes about using GNU make:
1754 <ul>
1755 <li>
1756 You need GNU make version 3.81 or newer.
1757 If the GNU make utility on your systems is not
1758 3.81 or newer,
1759 see <a href="#buildgmake">"Building GNU make"</a>.
1760 </li>
1761 <li>
1762 Place the location of the GNU make binary in the
1763 <code>PATH</code>.
1764 </li>
1765 <li>
1766 <strong>Solaris:</strong>
1767 Do NOT use <code>/usr/bin/make</code> on Solaris.
1768 If your Solaris system has the software
1769 from the Solaris Developer Companion CD installed,
1770 you should try and use <code>gmake</code>
1771 which will be located in either the
1772 <code>/usr/bin</code>, <code>/opt/sfw/bin</code> or
1773 <code>/usr/sfw/bin</code> directory.
1774 </li>
1775 <li>
1776 <strong>Windows:</strong>
1777 Make sure you start your build inside a bash shell.
1778 </li>
1779 <li>
1780 <strong>Mac OS X:</strong>
1781 The XCode "command line tools" must be installed on your Mac.
1782 </li>
1783 </ul>
1784 <p>
1785 Information on GNU make, and access to ftp download sites, are
1786 available on the
1787 <a href="http://www.gnu.org/software/make/make.html" target="_blank">
1788 GNU make web site
1789 </a>.
1790 The latest source to GNU make is available at
1791 <a href="http://ftp.gnu.org/pub/gnu/make/" target="_blank">
1792 ftp.gnu.org/pub/gnu/make/</a>.
1793 </p>
1795 <h3><a name="buildgmake">Building GNU make</a></h3>
1796 <blockquote>
1797 First step is to get the GNU make 3.81 or newer source from
1798 <a href="http://ftp.gnu.org/pub/gnu/make/" target="_blank">
1799 ftp.gnu.org/pub/gnu/make/</a>.
1800 Building is a little different depending on the OS but is
1801 basically done with:
1802 <blockquote>
1803 <code>bash ./configure</code>
1804 <br>
1805 <code>make</code>
1806 </blockquote>
1807 </blockquote>
1809 </blockquote> <!-- Appendix B -->
1811 <!-- ====================================================== -->
1812 <hr>
1813 <h2><a name="buildenvironments">Appendix C: Build Environments</a></h2>
1814 <blockquote>
1816 <h3><a name="MBE">Minimum Build Environments</a></h3>
1817 <blockquote>
1818 This file often describes specific requirements for what we
1819 call the
1820 "minimum build environments" (MBE) for this
1821 specific release of the JDK.
1822 What is listed below is what the Oracle Release
1823 Engineering Team will use to build the Oracle JDK product.
1824 Building with the MBE will hopefully generate the most compatible
1825 bits that install on, and run correctly on, the most variations
1826 of the same base OS and hardware architecture.
1827 In some cases, these represent what is often called the
1828 least common denominator, but each Operating System has different
1829 aspects to it.
1830 <p>
1831 In all cases, the Bootstrap JDK version minimum is critical,
1832 we cannot guarantee builds will work with older Bootstrap JDK's.
1833 Also in all cases, more RAM and more processors is better,
1834 the minimums listed below are simply recommendations.
1835 <p>
1836 With Solaris and Mac OS X, the version listed below is the
1837 oldest release we can guarantee builds and works, and the
1838 specific version of the compilers used could be critical.
1839 <p>
1840 With Windows the critical aspect is the Visual Studio compiler
1841 used, which due to it's runtime, generally dictates what Windows
1842 systems can do the builds and where the resulting bits can
1843 be used.<br>
1844 <b>NOTE: We expect a change here off these older Windows OS releases
1845 and to a 'less older' one, probably Windows 2008R2 X64.</b>
1846 <p>
1847 With Linux, it was just a matter of picking a
1848 stable distribution that is a good representative for Linux
1849 in general.<br>
1850 <b>NOTE: We expect a change here from Fedora 9 to something else,
1851 but it has not been completely determined yet, possibly
1852 Ubuntu 12.04 X64, unbiased community feedback would be welcome on
1853 what a good choice would be here.</b>
1854 <p>
1855 It is understood that most developers will NOT be using these
1856 specific versions, and in fact creating these specific versions
1857 may be difficult due to the age of some of this software.
1858 It is expected that developers are more often using the more
1859 recent releases and distributions of these operating systems.
1860 <p>
1861 Compilation problems with newer or different C/C++ compilers is a
1862 common problem.
1863 Similarly, compilation problems related to changes to the
1864 <code>/usr/include</code> or system header files is also a
1865 common problem with older, newer, or unreleased OS versions.
1866 Please report these types of problems as bugs so that they
1867 can be dealt with accordingly.
1868 </p>
1869 <table border="1">
1870 <thead>
1871 <tr>
1872 <th>Base OS and Architecture</th>
1873 <th>OS</th>
1874 <th>C/C++ Compiler</th>
1875 <th>Bootstrap JDK</th>
1876 <th>Processors</th>
1877 <th>RAM Minimum</th>
1878 <th>DISK Needs</th>
1879 </tr>
1880 </thead>
1881 <tbody>
1882 <tr>
1883 <td>Linux X86 (32-bit) and X64 (64-bit)</td>
1884 <td>Fedora 9</td>
1885 <td>gcc 4.3 </td>
1886 <td>JDK 7u7</td>
1887 <td>2 or more</td>
1888 <td>1 GB</td>
1889 <td>6 GB</td>
1890 </tr>
1891 <tr>
1892 <td>Solaris SPARC (32-bit) and SPARCV9 (64-bit)</td>
1893 <td>Solaris 10 Update 6</td>
1894 <td>Studio 12 Update 1 + patches</td>
1895 <td>JDK 7u7</td>
1896 <td>4 or more</td>
1897 <td>4 GB</td>
1898 <td>8 GB</td>
1899 </tr>
1900 <tr>
1901 <td>Solaris X86 (32-bit) and X64 (64-bit)</td>
1902 <td>Solaris 10 Update 6</td>
1903 <td>Studio 12 Update 1 + patches</td>
1904 <td>JDK 7u7</td>
1905 <td>4 or more</td>
1906 <td>4 GB</td>
1907 <td>8 GB</td>
1908 </tr>
1909 <tr>
1910 <td>Windows X86 (32-bit)</td>
1911 <td>Windows XP</td>
1912 <td>Microsoft Visual Studio C++ 2010 Professional Edition</td>
1913 <td>JDK 7u7</td>
1914 <td>2 or more</td>
1915 <td>2 GB</td>
1916 <td>6 GB</td>
1917 </tr>
1918 <tr>
1919 <td>Windows X64 (64-bit)</td>
1920 <td>Windows Server 2003 - Enterprise x64 Edition</td>
1921 <td>Microsoft Visual Studio C++ 2010 Professional Edition</td>
1922 <td>JDK 7u7</td>
1923 <td>2 or more</td>
1924 <td>2 GB</td>
1925 <td>6 GB</td>
1926 </tr>
1927 <tr>
1928 <td>Mac OS X X64 (64-bit)</td>
1929 <td>Mac OS X 10.7 "Lion"</td>
1930 <td>XCode 4.5.2 or newer</td>
1931 <td>JDK 7u7</td>
1932 <td>2 or more</td>
1933 <td>4 GB</td>
1934 <td>6 GB</td>
1935 </tr>
1936 </tbody>
1937 </table>
1938 </blockquote>
1940 <!-- ====================================================== -->
1941 <hr>
1942 <h3><a name="SDBE">Specific Developer Build Environments</a></h3>
1943 <blockquote>
1944 We won't be listing all the possible environments, but
1945 we will try to provide what information we have available to us.
1946 <p>
1947 <strong>NOTE: The community can help out by updating
1948 this part of the document.
1949 </strong>
1951 <h4><a name="fedora">Fedora</a></h4>
1952 <blockquote>
1953 After installing the latest
1954 <a href="http://fedoraproject.org">Fedora</a>
1955 you need to install several build dependencies.
1956 The simplest way to do it is to execute the
1957 following commands as user <code>root</code>:
1958 <blockquote>
1959 <code>yum-builddep java-1.7.0-openjdk</code>
1960 <br>
1961 <code>yum install gcc gcc-c++</code>
1962 </blockquote>
1963 <p>
1964 In addition, it's necessary to set a few environment
1965 variables for the build:
1966 <blockquote>
1967 <code>export LANG=C</code>
1968 <br>
1969 <code>export PATH="/usr/lib/jvm/java-openjdk/bin:${PATH}"</code>
1970 </blockquote>
1971 </blockquote>
1974 <h4><a name="centos">CentOS 5.5</a></h4>
1975 <blockquote>
1976 After installing
1977 <a href="http://www.centos.org/">CentOS 5.5</a>
1978 you need to make sure you have
1979 the following Development bundles installed:
1980 <blockquote>
1981 <ul>
1982 <li>Development Libraries</li>
1983 <li>Development Tools</li>
1984 <li>Java Development</li>
1985 <li>X Software Development (Including XFree86-devel)</li>
1986 </ul>
1987 </blockquote>
1988 <p>
1989 Plus the following packages:
1990 <blockquote>
1991 <ul>
1992 <li>cups devel: Cups Development Package</li>
1993 <li>alsa devel: Alsa Development Package</li>
1994 <li>Xi devel: libXi.so Development Package</li>
1995 </ul>
1996 </blockquote>
1997 <p>
1998 The freetype 2.3 packages don't seem to be available,
1999 but the freetype 2.3 sources can be downloaded, built,
2000 and installed easily enough from
2001 <a href="http://downloads.sourceforge.net/freetype">
2002 the freetype site</a>.
2003 Build and install with something like:
2004 <blockquote>
2005 <code>bash ./configure</code>
2006 <br>
2007 <code>make</code>
2008 <br>
2009 <code>sudo -u root make install</code>
2010 </blockquote>
2011 <p>
2012 Mercurial packages could not be found easily, but a Google
2013 search should find ones, and they usually include Python if
2014 it's needed.
2015 </blockquote>
2017 <h4><a name="debian">Debian 5.0 (Lenny)</a></h4>
2018 <blockquote>
2019 After installing <a href="http://debian.org">Debian</a> 5
2020 you need to install several build dependencies.
2021 The simplest way to install the build dependencies is to
2022 execute the following commands as user <code>root</code>:
2023 <blockquote>
2024 <code>aptitude build-dep openjdk-7</code>
2025 <br>
2026 <code>aptitude install openjdk-7-jdk libmotif-dev</code>
2027 </blockquote>
2028 <p>
2029 In addition, it's necessary to set a few environment
2030 variables for the build:
2031 <blockquote>
2032 <code>export LANG=C</code>
2033 <br>
2034 <code>export PATH="/usr/lib/jvm/java-7-openjdk/bin:${PATH}"</code>
2035 </blockquote>
2036 </blockquote>
2038 <h4><a name="ubuntu">Ubuntu 12.04</a></h4>
2039 <blockquote>
2040 After installing <a href="http://ubuntu.org">Ubuntu</a> 12.04
2041 you need to install several build dependencies. The simplest
2042 way to do it is to execute the following commands:
2043 <blockquote>
2044 <code>sudo aptitude build-dep openjdk-7</code>
2045 <br>
2046 <code>sudo aptitude install openjdk-7-jdk</code>
2047 </blockquote>
2048 <p>
2049 In addition, it's necessary to set a few environment
2050 variables for the build:
2051 <blockquote>
2052 <code>export LANG=C</code>
2053 <br>
2054 <code>export PATH="/usr/lib/jvm/java-7-openjdk/bin:${PATH}"</code>
2055 </blockquote>
2056 </blockquote>
2058 <h4><a name="opensuse">OpenSUSE 11.1</a></h4>
2059 <blockquote>
2060 After installing <a href="http://opensuse.org">OpenSUSE</a> 11.1
2061 you need to install several build dependencies.
2062 The simplest way to install the build dependencies is to
2063 execute the following commands:
2064 <blockquote>
2065 <code>sudo zypper source-install -d java-1_7_0-openjdk</code>
2066 <br>
2067 <code>sudo zypper install make</code>
2068 </blockquote>
2069 <p>
2070 In addition, it is necessary to set a few environment
2071 variables for the build:
2072 <blockquote>
2073 <code>export LANG=C</code>
2074 <br>
2075 <code>export PATH="/usr/lib/jvm/java-1.7.0-openjdk/bin:$[PATH}"</code>
2076 </blockquote>
2077 <p>
2078 Finally, you need to unset the <code>JAVA_HOME</code>
2079 environment variable:
2080 <blockquote>
2081 <code>export -n JAVA_HOME</code>
2082 </blockquote>
2083 </blockquote>
2085 <h4><a name="mandriva">Mandriva Linux One 2009 Spring</a></h4>
2086 <blockquote>
2087 After installing <a href="http://mandriva.org">Mandriva</a>
2088 Linux One 2009 Spring
2089 you need to install several build dependencies.
2090 The simplest way to install the build dependencies is to
2091 execute the following commands as user <code>root</code>:
2092 <blockquote>
2093 <code>urpmi java-1.7.0-openjdk-devel make gcc gcc-c++
2094 freetype-devel zip unzip libcups2-devel libxrender1-devel
2095 libalsa2-devel libstc++-static-devel libxtst6-devel
2096 libxi-devel</code>
2097 </blockquote>
2098 <p>
2099 In addition, it is necessary to set a few environment
2100 variables for the build:
2101 <blockquote>
2102 <code>export LANG=C</code>
2103 <br>
2104 <code>export PATH="/usr/lib/jvm/java-1.7.0-openjdk/bin:${PATH}"</code>
2105 </blockquote>
2106 </blockquote>
2108 <h4><a name="opensolaris">OpenSolaris 2009.06</a></h4>
2109 <blockquote>
2110 After installing <a href="http://opensolaris.org">OpenSolaris</a> 2009.06
2111 you need to install several build dependencies.
2112 The simplest way to install the build dependencies is to
2113 execute the following commands:
2114 <blockquote>
2115 <code>pfexec pkg install SUNWgmake SUNWj7dev
2116 sunstudioexpress SUNWcups SUNWzip SUNWunzip SUNWxwhl
2117 SUNWxorg-headers SUNWaudh SUNWfreetype2</code>
2118 </blockquote>
2119 <p>
2120 In addition, it is necessary to set a few environment
2121 variables for the build:
2122 <blockquote>
2123 <code>export LANG=C</code>
2124 <br>
2125 <code>export PATH="/opt/SunStudioExpress/bin:${PATH}"</code>
2126 </blockquote>
2127 </blockquote>
2129 </blockquote>
2131 </blockquote> <!-- Appendix C -->
2133 <!-- ====================================================== -->
2135 <!-- Leave out Appendix D --
2137 <hr>
2138 <h2><a name="mapping">Appendix D: Mapping Old to New</a></h2>
2139 <blockquote>
2140 <p>This table will help you convert some idioms of the old build
2141 system to the new build system.</p>
2142 <table summary="Cheat sheet for converting from old to new build system">
2143 <tr valign="top">
2144 <th>In the old build system, you used to...</th>
2145 <th>In the new build system, you should ...</th>
2146 </tr>
2147 <tr valign="top">
2148 <td>run <code>make sanity</code></td>
2149 <td>run <code>bash ./configure</code></td>
2150 </tr>
2151 <tr valign="top">
2152 <td>set <code>ALT_OUTPUTDIR=build/my-special-output</code></td>
2153 <td>before building the first time:
2154 <br>
2155 <code>cd build/my-special-output</code>
2156 <br>
2157 <code>bash ../../configure</code>
2158 <br>
2159 to build:
2160 <br>
2161 <code>cd build/my-special-output</code>
2162 <br>
2163 <code>make</code>
2164 </td>
2165 </tr>
2166 <tr valign="top">
2167 <td>set <code>ALT_BOOTDIR=/opt/java/jdk7</code></td>
2168 <td>run <code>configure --with-boot-jdk=/opt/java/jdk7</code></td>
2169 </tr>
2170 <tr valign="top">
2171 <td>run <code>make ARCH_DATA_MODEL=32</code></td>
2172 <td>run <code>configure --with-target-bits=32</code></td>
2173 </tr>
2174 <tr valign="top">
2175 <td>set <code>BUILD_CLIENT_ONLY=true</code></td>
2176 <td>run <code>configure --with-jvm-variants=client</code></td>
2177 </tr>
2178 <tr valign="top">
2179 <td>set <code>ALT_FREETYPE_LIB_PATH=/opt/freetype/lib</code>
2180 and <code>ALT_FREETYPE_HEADERS_PATH=/opt/freetype/include</code></td>
2181 <td>run <code>configure --with-freetype=/opt/freetype</code></td>
2182 </tr>
2183 <tr valign="top">
2184 <td>set <code>ALT_CUPS_HEADERS_PATH=/opt/cups/include</code></td>
2185 <td>run <code>configure --with-cups=/opt/cups</code></td>
2186 </tr>
2187 <tr valign="top">
2188 <td>set <code>ALT_OPENWIN_HOME=/opt/X11R6</code></td>
2189 <td>run <code>configure --with-x=/opt/X11R6</code></td>
2190 </tr>
2191 <tr valign="top">
2192 <td>set <code>ALT_MSVCRNN_DLL_PATH=c:/vc_redist</code></td>
2193 <td>run <code>configure --with-msvcr100dll=/cygdrive/c/vc_redist</code></td>
2194 </tr>
2195 <tr valign="top">
2196 <td>set <code>ALT_COMPILER_PATH=/opt/my-gcc/bin/gcc</code></td>
2197 <td>run <code>CC=/opt/my-gcc/bin/gcc configure</code>
2198 or <code>CXX=/opt/my-gcc/bin/g++ configure</code>
2199 </td>
2200 </tr>
2201 <tr valign="top">
2202 <td>set <code>BUILD_HEADLESS_ONLY=true</code></td>
2203 <td>run <code>configure --disable-headful</code></td>
2204 </tr>
2205 <tr valign="top">
2206 <td>set <code>ALT_DEVTOOLS_PATH=/opt/mytools</code></td>
2207 <td>just run <code>configure</code>,
2208 your tools should be detected automatically.
2209 If you have an unusual configuration,
2210 add the tools directory to your <code>PATH</code>.
2211 </td>
2212 </tr>
2213 <tr valign="top">
2214 <td>set <code>ALT_DROPS_DIR=/home/user/dropdir</code></td>
2215 <td>source drops are not used anymore</td>
2216 </tr>
2217 <tr valign="top">
2218 <td>set <code>USE_ONLY_BOOTDIR_TOOLS=true</code></td>
2219 <td>not needed, <code>configure</code> should always do the Right Thing automatically</td>
2220 </tr>
2221 <tr valign="top">
2222 <td>set <code>ALT_JDK_IMPORT_PATH=/opt/java/import-jdk</code>
2223 or <code>ALT_BUILD_JDK_IMPORT_PATH=/opt/java/import-jdk</code>
2224 </td>
2225 <td>Importing JDKs is no longer possible,
2226 but hotspot can be imported using
2227 <code>--with-import-hotspot</code>.
2228 Documentation on how to achieve a
2229 similar solution will come soon!
2230 </td>
2231 </tr>
2232 <tr valign="top">
2233 <td>set <code>EXTRA_CFLAGS=-Xfoo</code></td>
2234 <td>run <code>CFLAGS=-Xfoo configure</code></td>
2235 </tr>
2236 <tr valign="top">
2237 <td>set <code>CROSS_COMPILE_ARCH=i586</code></td>
2238 <td>see <a href="#sec7.3"> section 7.3, Cross-compilation</a></td>
2239 </tr>
2240 <tr valign="top">
2241 <td>set <code>SKIP_BOOT_CYCLE=false</code></td>
2242 <td>Run <code>make bootcycle-images</code>.</td>
2243 </tr>
2244 </table>
2246 <h3><a name="variables">Environment/Make Variables</a></h3>
2247 <p>
2248 Some of the
2249 environment or make variables (just called <b>variables</b> in this
2250 document) that can impact the build are:
2251 <blockquote>
2252 <dl>
2253 <dt><a name="path"><code>PATH</code></a> </dt>
2254 <dd>Typically you want to set the <code>PATH</code> to include:
2255 <ul>
2256 <li>The location of the GNU make binary</li>
2257 <li>The location of the Bootstrap JDK <code>java</code>
2258 (see <a href="#bootjdk">Bootstrap JDK</a>)</li>
2259 <li>The location of the C/C++ compilers
2260 (see <a href="#compilers"><code>compilers</code></a>)</li>
2261 <li>The location or locations for the Unix command utilities
2262 (e.g. <code>/usr/bin</code>)</li>
2263 </ul>
2264 </dd>
2265 <dt><code>MILESTONE</code> </dt>
2266 <dd>
2267 The milestone name for the build (<i>e.g.</i>"beta").
2268 The default value is "internal".
2269 </dd>
2270 <dt><code>BUILD_NUMBER</code> </dt>
2271 <dd>
2272 The build number for the build (<i>e.g.</i> "b27").
2273 The default value is "b00".
2274 </dd>
2275 <dt><a name="arch_data_model"><code>ARCH_DATA_MODEL</code></a></dt>
2276 <dd>The <code>ARCH_DATA_MODEL</code> variable
2277 is used to specify whether the build is to generate 32-bit or 64-bit
2278 binaries.
2279 The Solaris build supports either 32-bit or 64-bit builds, but
2280 Windows and Linux will support only one, depending on the specific
2281 OS being used.
2282 Normally, setting this variable is only necessary on Solaris.
2283 Set <code>ARCH_DATA_MODEL</code> to <code>32</code> for generating 32-bit binaries,
2284 or to <code>64</code> for generating 64-bit binaries.
2285 </dd>
2286 <dt><a name="ALT_BOOTDIR"><code>ALT_BOOTDIR</code></a></dt>
2287 <dd>
2288 The location of the bootstrap JDK installation.
2289 See <a href="#bootjdk">Bootstrap JDK</a> for more information.
2290 You should always install your own local Bootstrap JDK and
2291 always set <code>ALT_BOOTDIR</code> explicitly.
2292 </dd>
2293 <dt><a name="ALT_OUTPUTDIR"><code>ALT_OUTPUTDIR</code></a> </dt>
2294 <dd>
2295 An override for specifying the (absolute) path of where the
2296 build output is to go.
2297 The default output directory will be build/<i>platform</i>.
2298 </dd>
2299 <dt><a name="ALT_COMPILER_PATH"><code>ALT_COMPILER_PATH</code></a> </dt>
2300 <dd>
2301 The location of the C/C++ compiler.
2302 The default varies depending on the platform.
2303 </dd>
2304 <dt><code><a name="ALT_CACERTS_FILE">ALT_CACERTS_FILE</a></code></dt>
2305 <dd>
2306 The location of the <a href="#cacerts">cacerts</a> file.
2307 The default will refer to
2308 <code>jdk/src/share/lib/security/cacerts</code>.
2309 </dd>
2310 <dt><a name="ALT_CUPS_HEADERS_PATH"><code>ALT_CUPS_HEADERS_PATH</code></a> </dt>
2311 <dd>
2312 The location of the CUPS header files.
2313 See <a href="#cups">CUPS information</a> for more information.
2314 If this path does not exist the fallback path is
2315 <code>/usr/include</code>.
2316 </dd>
2317 <dt><a name="ALT_FREETYPE_LIB_PATH"><code>ALT_FREETYPE_LIB_PATH</code></a></dt>
2318 <dd>
2319 The location of the FreeType shared library.
2320 See <a href="#freetype">FreeType information</a> for details.
2321 </dd>
2322 <dt><a name="ALT_FREETYPE_HEADERS_PATH"><code>ALT_FREETYPE_HEADERS_PATH</code></a></dt>
2323 <dd>
2324 The location of the FreeType header files.
2325 See <a href="#freetype">FreeType information</a> for details.
2326 </dd>
2327 <dt><a name="ALT_JDK_DEVTOOLS_PATH"><code>ALT_JDK_DEVTOOLS_PATH</code></a></dt>
2328 <dd>
2329 The default root location of the devtools.
2330 The default value is
2331 <code>$(ALT_SLASH_JAVA)/devtools</code>.
2332 </dd>
2333 <dt><code><a name="ALT_DEVTOOLS_PATH">ALT_DEVTOOLS_PATH</a></code> </dt>
2334 <dd>
2335 The location of tools like the
2336 <a href="#zip"><code>zip</code> and <code>unzip</code></a>
2337 binaries, but might also contain the GNU make utility
2338 (<code><i>gmake</i></code>).
2339 So this area is a bit of a grab bag, especially on Windows.
2340 The default value depends on the platform and
2341 Unix Commands being used.
2342 On Linux the default will be
2343 <code>$(ALT_JDK_DEVTOOLS_PATH)/linux/bin</code>,
2344 on Solaris
2345 <code>$(ALT_JDK_DEVTOOLS_PATH)/<i>{sparc,i386}</i>/bin</code>,
2346 and on Windows with CYGWIN
2347 <code>/usr/bin</code>.
2348 </dd>
2349 <dt><a name="ALT_UNIXCCS_PATH"><code>ALT_UNIXCCS_PATH</code></a></dt>
2350 <dd>
2351 <strong>Solaris only:</strong>
2352 An override for specifying where the Unix CCS
2353 command set are located.
2354 The default location is <code>/usr/ccs/bin</code>
2355 </dd>
2356 <dt><a name="ALT_SLASH_JAVA"><code>ALT_SLASH_JAVA</code></a></dt>
2357 <dd>
2358 The default root location for many of the ALT path locations
2359 of the following ALT variables.
2360 The default value is
2361 <code>"/java"</code> on Solaris and Linux,
2362 <code>"J:"</code> on Windows.
2363 </dd>
2365 <dt><a name="ALT_OPENWIN_HOME"><code>ALT_OPENWIN_HOME</code></a></dt>
2366 <dd>
2367 The top-level directory of the libraries and include files
2368 for the platform's
2369 graphical programming environment.
2370 The default location is platform specific.
2371 For example, on Linux it defaults to <code>/usr/X11R6/</code>.
2372 </dd>
2373 <dt><strong>Windows specific:</strong></dt>
2374 <dd>
2375 <dl>
2376 <dt><a name="ALT_WINDOWSSDKDIR"><code>ALT_WINDOWSSDKDIR</code></a> </dt>
2377 <dd>
2378 The location of the
2379 Microsoft Windows SDK where some tools will be
2380 located.
2381 The default is whatever WINDOWSSDKDIR is set to
2382 (or WindowsSdkDir) or the path
2383 <br>
2384 <code>c:\Program Files\Microsoft SDKs\Windows\v7.0a</code>
2385 </dd>
2386 <dt><code><a name="ALT_DXSDK_PATH">ALT_DXSDK_PATH</a></code> </dt>
2387 <dd>
2388 The location of the
2389 <a href="#dxsdk">Microsoft DirectX 9 SDK</a>.
2390 The default will be to try and use the DirectX environment
2391 variable <code>DXSDK_DIR</code>,
2392 failing that, look in <code>C:/DXSDK</code>.
2393 </dd>
2394 <dt><code><a name="ALT_MSVCRNN_DLL_PATH">ALT_MSVCRNN_DLL_PATH</a></code> </dt>
2395 <dd>
2396 The location of the
2397 <a href="#msvcrNN"><code>MSVCR100.DLL</code></a>.
2398 </dd>
2399 </dl>
2400 </dd>
2401 <dt><strong>Cross-Compilation Support:</strong></dt>
2402 <dd>
2403 <dl>
2404 <dt><a name="CROSS_COMPILE_ARCH"><code>CROSS_COMPILE_ARCH</code></a> </dt>
2405 <dd>
2406 Set to the target architecture of a
2407 cross-compilation build. If set, this
2408 variable is used to signify that we are
2409 cross-compiling. The expectation
2410 is that
2411 <a href="#ALT_COMPILER_PATH"><code>ALT_COMPILER_PATH</code></a>
2412 is set
2413 to point to the cross-compiler and that any
2414 cross-compilation specific flags
2415 are passed using
2416 <a href="#EXTRA_CFLAGS"><code>EXTRA_CFLAGS</code></a>.
2417 The <a href="#ALT_OPENWIN_HOME"><code>ALT_OPENWIN_HOME</code></a>
2418 variable should
2419 also be set to point to the graphical header files
2420 (e.g. X11) provided with
2421 the cross-compiler.
2422 When cross-compiling we skip execution of any demos
2423 etc that may be built, and
2424 also skip binary-file verification.
2425 </dd>
2426 <dt><code><a name="EXTRA_CFLAGS">EXTRA_CFLAGS</a></code> </dt>
2427 <dd>
2428 Used to pass cross-compilation options to the
2429 cross-compiler.
2430 These are added to the <code>CFLAGS</code>
2431 and <code>CXXFLAGS</code> variables.
2432 </dd>
2433 <dt><code><a name="USE_ONLY_BOOTDIR_TOOLS">USE_ONLY_BOOTDIR_TOOLS</a></code> </dt>
2434 <dd>
2435 Used primarily for cross-compilation builds
2436 (and always set in that case)
2437 this variable indicates that tools from the
2438 boot JDK should be used during
2439 the build process, not the tools
2440 (<code>javac</code>, <code>javah</code>, <code>jar</code>)
2441 just built (which can't execute on the build host).
2442 </dd>
2443 <dt><code><a name="HOST_CC">HOST_CC</a></code> </dt>
2444 <dd>
2445 The location of the C compiler to generate programs
2446 to run on the build host.
2447 Some parts of the build generate programs that are
2448 then compiled and executed
2449 to produce other parts of the build. Normally the
2450 primary C compiler is used
2451 to do this, but when cross-compiling that would be
2452 the cross-compiler and the
2453 resulting program could not be executed.
2454 On Linux this defaults to <code>/usr/bin/gcc</code>;
2455 on other platforms it must be
2456 set explicitly.
2457 </dd>
2458 </dl>
2459 <dt><strong>Specialized Build Options:</strong></dt>
2460 <dd>
2461 Some build variables exist to support specialized build
2462 environments and/or specialized
2463 build products. Their use is only supported in those contexts:
2464 <dl>
2465 <dt><code><a name="BUILD_CLIENT_ONLY">BUILD_CLIENT_ONLY</a></code> </dt>
2466 <dd>
2467 Indicates this build will only contain the
2468 Hotspot client VM. In addition to
2469 controlling the Hotspot build target,
2470 it ensures that we don't try to copy
2471 any server VM files/directories,
2472 and defines a default <code>jvm.cfg</code> file
2473 suitable for a client-only environment.
2474 Using this in a 64-bit build will
2475 generate a sanity warning as 64-bit client
2476 builds are not directly supported.
2477 </dd>
2478 <dt><code><a name="BUILD_HEADLESS_ONLY"></a>BUILD_HEADLESS_ONLY</code> </dt>
2479 <dd>
2480 Used when the build environment has no graphical
2481 capabilities at all. This
2482 excludes building anything that requires graphical
2483 libraries to be available.
2484 </dd>
2485 <dt><code><a name="JAVASE_EMBEDDED"></a>JAVASE_EMBEDDED</code> </dt>
2486 <dd>
2487 Used to indicate this is a build of the Oracle
2488 Java SE Embedded product.
2489 This will enable the directives included in the
2490 SE-Embedded specific build
2491 files.
2492 </dd>
2493 <dt><code><a name="LIBZIP_CAN_USE_MMAP">LIBZIP_CAN_USE_MMAP</a></code> </dt>
2494 <dd>
2495 If set to false, disables the use of mmap by the
2496 zip utility. Otherwise,
2497 mmap will be used.
2498 </dd>
2499 <dt><code><a name="COMPRESS_JARS"></a>COMPRESS_JARS</code> </dt>
2500 <dd>
2501 If set to true, causes certain jar files that
2502 would otherwise be built without
2503 compression, to use compression.
2504 </dd>
2505 </dl>
2506 </dd>
2507 </dl>
2508 </blockquote>
2510 </blockquote> <!-- Appendix D -->
2512 <!-- ====================================================== -->
2513 <hr>
2514 <p>End of OpenJDK README-builds.html document.<br>Please come again!
2515 <hr>
2517 </body>
2518 </html>