< prev index next >

doc/building.md

Print this page




 133 
 134 This is not recommended. Instead, see the section on [Cross-compiling](
 135 #cross-compiling).
 136 
 137 ## Operating System Requirements
 138 
 139 The mainline JDK project supports Linux, Solaris, macOS, AIX and Windows.
 140 Support for other operating system, e.g. BSD, exists in separate "port"
 141 projects.
 142 
 143 In general, the JDK can be built on a wide range of versions of these operating
 144 systems, but the further you deviate from what is tested on a daily basis, the
 145 more likely you are to run into problems.
 146 
 147 This table lists the OS versions used by Oracle when building the JDK. Such
 148 information is always subject to change, but this table is up to date at the
 149 time of writing.
 150 
 151  Operating system   Vendor/version used
 152  -----------------  -------------------------------------------------------
 153  Linux              Oracle Enterprise Linux 6.4 / 7.6
 154  Solaris            Solaris 11.3 SRU 20
 155  macOS              Mac OS X 10.13 (High Sierra)
 156  Windows            Windows Server 2012 R2
 157 
 158 The double version numbers for Linux and Solaris are due to the hybrid model
 159 used at Oracle, where header files and external libraries from an older version
 160 are used when building on a more modern version of the OS.
 161 
 162 The Build Group has a wiki page with [Supported Build Platforms](
 163 https://wiki.openjdk.java.net/display/Build/Supported+Build+Platforms). From
 164 time to time, this is updated by contributors to list successes or failures of
 165 building on different platforms.
 166 
 167 ### Windows
 168 
 169 Windows XP is not a supported platform, but all newer Windows should be able to
 170 build the JDK.
 171 
 172 On Windows, it is important that you pay attention to the instructions in the
 173 [Special Considerations](#special-considerations).
 174 
 175 Windows is the only non-POSIX OS supported by the JDK, and as such, requires
 176 some extra care. A POSIX support layer is required to build on Windows.
 177 Currently, the only supported such layers are Cygwin and Windows Subsystem for
 178 Linux (WSL). (Msys is no longer supported due to a too old bash; msys2 would
 179 likely be possible to support in a future version but that would require effort
 180 to implement.)


 306 system should be independent factors, but in practice there's more or less a
 307 one-to-one correlation between target operating system and toolchain.
 308 
 309  Operating system   Supported toolchain
 310  ------------------ -------------------------
 311  Linux              gcc, clang
 312  macOS              Apple Xcode (using clang)
 313  Solaris            Oracle Solaris Studio
 314  AIX                IBM XL C/C++
 315  Windows            Microsoft Visual Studio
 316 
 317 Please see the individual sections on the toolchains for version
 318 recommendations. As a reference, these versions of the toolchains are used, at
 319 the time of writing, by Oracle for the daily builds of the JDK. It should be
 320 possible to compile the JDK with both older and newer versions, but the closer
 321 you stay to this list, the more likely you are to compile successfully without
 322 issues.
 323 
 324  Operating system   Toolchain version
 325  ------------------ -------------------------------------------------------
 326  Linux              gcc 8.2.0
 327  macOS              Apple Xcode 10.1 (using clang 10.0.0)
 328  Solaris            Oracle Solaris Studio 12.6 (with compiler version 5.15)
 329  Windows            Microsoft Visual Studio 2017 update 15.9.6
 330 
 331 All compilers are expected to be able to compile to the C99 language standard,
 332 as some C99 features are used in the source code. Microsoft Visual Studio
 333 doesn't fully support C99 so in practice shared code is limited to using C99
 334 features that it does support.
 335 
 336 ### gcc
 337 
 338 The minimum accepted version of gcc is 4.8. Older versions will generate a warning
 339 by `configure` and are unlikely to work.
 340 
 341 The JDK is currently known to be able to compile with at least version 7.4 of
 342 gcc.
 343 
 344 In general, any version between these two should be usable.
 345 
 346 ### clang
 347 
 348 The minimum accepted version of clang is 3.2. Older versions will not be
 349 accepted by `configure`.
 350 
 351 To use clang instead of gcc on Linux, use `--with-toolchain-type=clang`.
 352 
 353 ### Apple Xcode
 354 


 392  developer/solarisstudio-124/library/math-libs      12.4-1.0.0.1
 393  developer/solarisstudio-124/library/studio-gccrt   12.4-1.0.0.1
 394  developer/solarisstudio-124/studio-common          12.4-1.0.0.1
 395  developer/solarisstudio-124/studio-ja              12.4-1.0.0.1
 396  developer/solarisstudio-124/studio-legal           12.4-1.0.0.1
 397  developer/solarisstudio-124/studio-zhCN            12.4-1.0.0.1
 398 
 399 Compiling with Solaris Studio can sometimes be finicky. This is the exact
 400 version used by Oracle, which worked correctly at the time of writing:
 401 ```
 402 $ cc -V
 403 cc: Sun C 5.13 SunOS_i386 2014/10/20
 404 $ CC -V
 405 CC: Sun C++ 5.13 SunOS_i386 151846-10 2015/10/30
 406 ```
 407 
 408 ### Microsoft Visual Studio
 409 
 410 The minimum accepted version of Visual Studio is 2010. Older versions will not
 411 be accepted by `configure`. The maximum accepted version of Visual Studio is
 412 2019. Versions older than 2017 are unlikely to continue working for long.
 413 
 414 If you have multiple versions of Visual Studio installed, `configure` will by
 415 default pick the latest. You can request a specific version to be used by
 416 setting `--with-toolchain-version`, e.g. `--with-toolchain-version=2015`.
 417 
 418 If you get `LINK: fatal error LNK1123: failure during conversion to COFF: file
 419 invalid` when building using Visual Studio 2010, you have encountered
 420 [KB2757355](http://support.microsoft.com/kb/2757355), a bug triggered by a
 421 specific installation order. However, the solution suggested by the KB article
 422 does not always resolve the problem. See [this stackoverflow discussion](
 423 https://stackoverflow.com/questions/10888391) for other suggestions.
 424 
 425 ### IBM XL C/C++
 426 
 427 Please consult the AIX section of the [Supported Build Platforms](
 428 https://wiki.openjdk.java.net/display/Build/Supported+Build+Platforms) OpenJDK
 429 Build Wiki page for details about which versions of XLC are supported.
 430 
 431 
 432 ## Boot JDK Requirements


 710     files
 711   * `--with-extra-cxxflags=<flags>` - Append these flags when compiling JDK C++
 712     files
 713   * `--with-extra-ldflags=<flags>` - Append these flags when linking JDK
 714     libraries
 715 
 716 #### Configure Arguments for External Dependencies
 717 
 718   * `--with-boot-jdk=<path>` - Set the path to the [Boot JDK](
 719     #boot-jdk-requirements)
 720   * `--with-freetype=<path>` - Set the path to [FreeType](#freetype)
 721   * `--with-cups=<path>` - Set the path to [CUPS](#cups)
 722   * `--with-x=<path>` - Set the path to [X11](#x11)
 723   * `--with-alsa=<path>` - Set the path to [ALSA](#alsa)
 724   * `--with-libffi=<path>` - Set the path to [libffi](#libffi)
 725   * `--with-jtreg=<path>` - Set the path to JTReg. See [Running Tests](
 726     #running-tests)
 727 
 728 Certain third-party libraries used by the JDK (libjpeg, giflib, libpng, lcms
 729 and zlib) are included in the JDK repository. The default behavior of the
 730 JDK build is to use the included ("bundled") versions of libjpeg, giflib,
 731 libpng and lcms.
 732 For zlib, the system lib (if present) is used except on Windows and AIX.
 733 However the bundled libraries may be replaced by an external version.
 734 To do so, specify `system` as the `<source>` option in these arguments.
 735 (The default is `bundled`).
 736 
 737   * `--with-libjpeg=<source>` - Use the specified source for libjpeg
 738   * `--with-giflib=<source>` - Use the specified source for giflib
 739   * `--with-libpng=<source>` - Use the specified source for libpng
 740   * `--with-lcms=<source>` - Use the specified source for lcms
 741   * `--with-zlib=<source>` - Use the specified source for zlib
 742 
 743 On Linux, it is possible to select either static or dynamic linking of the C++
 744 runtime. The default is static linking, with dynamic linking as fallback if the
 745 static library is not found.
 746 
 747   * `--with-stdc++lib=<method>` - Use the specified method (`static`, `dynamic`
 748     or `default`) for linking the C++ runtime.
 749 
 750 ### Configure Control Variables
 751 
 752 It is possible to control certain aspects of `configure` by overriding the
 753 value of `configure` variables, either on the command line or in the
 754 environment.
 755 




 133 
 134 This is not recommended. Instead, see the section on [Cross-compiling](
 135 #cross-compiling).
 136 
 137 ## Operating System Requirements
 138 
 139 The mainline JDK project supports Linux, Solaris, macOS, AIX and Windows.
 140 Support for other operating system, e.g. BSD, exists in separate "port"
 141 projects.
 142 
 143 In general, the JDK can be built on a wide range of versions of these operating
 144 systems, but the further you deviate from what is tested on a daily basis, the
 145 more likely you are to run into problems.
 146 
 147 This table lists the OS versions used by Oracle when building the JDK. Such
 148 information is always subject to change, but this table is up to date at the
 149 time of writing.
 150 
 151  Operating system   Vendor/version used
 152  -----------------  -------------------------------------------------------
 153  Linux              Oracle Enterprise Linux 6.4 / 7.1 (using kernel 3.8.13)
 154  Solaris            Solaris 11.1 SRU 21.4.1 / 11.2 SRU 5.5
 155  macOS              Mac OS X 10.9 (Mavericks) / 10.10 (Yosemite)
 156  Windows            Windows Server 2012 R2
 157 
 158 The double version numbers for Linux, Solaris and macOS is due to the hybrid
 159 model used at Oracle, where header files and external libraries from an older
 160 version are used when building on a more modern version of the OS.
 161 
 162 The Build Group has a wiki page with [Supported Build Platforms](
 163 https://wiki.openjdk.java.net/display/Build/Supported+Build+Platforms). From
 164 time to time, this is updated by contributors to list successes or failures of
 165 building on different platforms.
 166 
 167 ### Windows
 168 
 169 Windows XP is not a supported platform, but all newer Windows should be able to
 170 build the JDK.
 171 
 172 On Windows, it is important that you pay attention to the instructions in the
 173 [Special Considerations](#special-considerations).
 174 
 175 Windows is the only non-POSIX OS supported by the JDK, and as such, requires
 176 some extra care. A POSIX support layer is required to build on Windows.
 177 Currently, the only supported such layers are Cygwin and Windows Subsystem for
 178 Linux (WSL). (Msys is no longer supported due to a too old bash; msys2 would
 179 likely be possible to support in a future version but that would require effort
 180 to implement.)


 306 system should be independent factors, but in practice there's more or less a
 307 one-to-one correlation between target operating system and toolchain.
 308 
 309  Operating system   Supported toolchain
 310  ------------------ -------------------------
 311  Linux              gcc, clang
 312  macOS              Apple Xcode (using clang)
 313  Solaris            Oracle Solaris Studio
 314  AIX                IBM XL C/C++
 315  Windows            Microsoft Visual Studio
 316 
 317 Please see the individual sections on the toolchains for version
 318 recommendations. As a reference, these versions of the toolchains are used, at
 319 the time of writing, by Oracle for the daily builds of the JDK. It should be
 320 possible to compile the JDK with both older and newer versions, but the closer
 321 you stay to this list, the more likely you are to compile successfully without
 322 issues.
 323 
 324  Operating system   Toolchain version
 325  ------------------ -------------------------------------------------------
 326  Linux              gcc 7.3.0
 327  macOS              Apple Xcode 9.4 (using clang 9.1.0)
 328  Solaris            Oracle Solaris Studio 12.4 (with compiler version 5.13)
 329  Windows            Microsoft Visual Studio 2017 update 15.5.5





 330 
 331 ### gcc
 332 
 333 The minimum accepted version of gcc is 4.8. Older versions will generate a warning
 334 by `configure` and are unlikely to work.
 335 
 336 The JDK is currently known to be able to compile with at least version 7.4 of
 337 gcc.
 338 
 339 In general, any version between these two should be usable.
 340 
 341 ### clang
 342 
 343 The minimum accepted version of clang is 3.2. Older versions will not be
 344 accepted by `configure`.
 345 
 346 To use clang instead of gcc on Linux, use `--with-toolchain-type=clang`.
 347 
 348 ### Apple Xcode
 349 


 387  developer/solarisstudio-124/library/math-libs      12.4-1.0.0.1
 388  developer/solarisstudio-124/library/studio-gccrt   12.4-1.0.0.1
 389  developer/solarisstudio-124/studio-common          12.4-1.0.0.1
 390  developer/solarisstudio-124/studio-ja              12.4-1.0.0.1
 391  developer/solarisstudio-124/studio-legal           12.4-1.0.0.1
 392  developer/solarisstudio-124/studio-zhCN            12.4-1.0.0.1
 393 
 394 Compiling with Solaris Studio can sometimes be finicky. This is the exact
 395 version used by Oracle, which worked correctly at the time of writing:
 396 ```
 397 $ cc -V
 398 cc: Sun C 5.13 SunOS_i386 2014/10/20
 399 $ CC -V
 400 CC: Sun C++ 5.13 SunOS_i386 151846-10 2015/10/30
 401 ```
 402 
 403 ### Microsoft Visual Studio
 404 
 405 The minimum accepted version of Visual Studio is 2010. Older versions will not
 406 be accepted by `configure`. The maximum accepted version of Visual Studio is
 407 2017. Versions older than 2017 are unlikely to continue working for long.
 408 
 409 If you have multiple versions of Visual Studio installed, `configure` will by
 410 default pick the latest. You can request a specific version to be used by
 411 setting `--with-toolchain-version`, e.g. `--with-toolchain-version=2015`.
 412 
 413 If you get `LINK: fatal error LNK1123: failure during conversion to COFF: file
 414 invalid` when building using Visual Studio 2010, you have encountered
 415 [KB2757355](http://support.microsoft.com/kb/2757355), a bug triggered by a
 416 specific installation order. However, the solution suggested by the KB article
 417 does not always resolve the problem. See [this stackoverflow discussion](
 418 https://stackoverflow.com/questions/10888391) for other suggestions.
 419 
 420 ### IBM XL C/C++
 421 
 422 Please consult the AIX section of the [Supported Build Platforms](
 423 https://wiki.openjdk.java.net/display/Build/Supported+Build+Platforms) OpenJDK
 424 Build Wiki page for details about which versions of XLC are supported.
 425 
 426 
 427 ## Boot JDK Requirements


 705     files
 706   * `--with-extra-cxxflags=<flags>` - Append these flags when compiling JDK C++
 707     files
 708   * `--with-extra-ldflags=<flags>` - Append these flags when linking JDK
 709     libraries
 710 
 711 #### Configure Arguments for External Dependencies
 712 
 713   * `--with-boot-jdk=<path>` - Set the path to the [Boot JDK](
 714     #boot-jdk-requirements)
 715   * `--with-freetype=<path>` - Set the path to [FreeType](#freetype)
 716   * `--with-cups=<path>` - Set the path to [CUPS](#cups)
 717   * `--with-x=<path>` - Set the path to [X11](#x11)
 718   * `--with-alsa=<path>` - Set the path to [ALSA](#alsa)
 719   * `--with-libffi=<path>` - Set the path to [libffi](#libffi)
 720   * `--with-jtreg=<path>` - Set the path to JTReg. See [Running Tests](
 721     #running-tests)
 722 
 723 Certain third-party libraries used by the JDK (libjpeg, giflib, libpng, lcms
 724 and zlib) are included in the JDK repository. The default behavior of the
 725 JDK build is to use this version of these libraries, but they might be
 726 replaced by an external version. To do so, specify `system` as the `<source>`
 727 option in these arguments. (The default is `bundled`).



 728 
 729   * `--with-libjpeg=<source>` - Use the specified source for libjpeg
 730   * `--with-giflib=<source>` - Use the specified source for giflib
 731   * `--with-libpng=<source>` - Use the specified source for libpng
 732   * `--with-lcms=<source>` - Use the specified source for lcms
 733   * `--with-zlib=<source>` - Use the specified source for zlib
 734 
 735 On Linux, it is possible to select either static or dynamic linking of the C++
 736 runtime. The default is static linking, with dynamic linking as fallback if the
 737 static library is not found.
 738 
 739   * `--with-stdc++lib=<method>` - Use the specified method (`static`, `dynamic`
 740     or `default`) for linking the C++ runtime.
 741 
 742 ### Configure Control Variables
 743 
 744 It is possible to control certain aspects of `configure` by overriding the
 745 value of `configure` variables, either on the command line or in the
 746 environment.
 747 


< prev index next >