diff --git a/doc/building.html b/doc/building.html index 4745af2a1d7..ba032dba27e 100644 --- a/doc/building.html +++ b/doc/building.html @@ -239,26 +239,26 @@

Native Compiler (Toolchain) Requ - - + + - - + + - - + + - - + + - - + +
Operating systemSupported toolchainOperating systemSupported toolchain
Linuxgcc, clangLinuxgcc, clang
macOSApple Xcode (using clang)macOSApple Xcode (using clang)
AIXIBM XL C/C++AIXIBM XL C/C++
WindowsMicrosoft Visual StudioWindowsMicrosoft Visual Studio
@@ -266,22 +266,22 @@

Native Compiler (Toolchain) Requ - - + + - - + + - - + + - - + +
Operating systemToolchain versionOperating systemToolchain version
Linuxgcc 11.2.0Linuxgcc 11.2.0
macOSApple Xcode 10.1 (using clang 10.0.0)macOSApple Xcode 10.1 (using clang 10.0.0)
WindowsMicrosoft Visual Studio 2022 update 17.1.0WindowsMicrosoft Visual Studio 2022 update 17.1.0
@@ -295,9 +295,13 @@

clang

To use clang instead of gcc on Linux, use --with-toolchain-type=clang.

Apple Xcode

The oldest supported version of Xcode is 8.

-

You will need the Xcode command lines developers tools to be able to build the JDK. (Actually, only the command lines tools are needed, not the IDE.) The simplest way to install these is to run:

+

You will need the Xcode command line developer tools to be able to build the JDK. (Actually, only the command line tools are needed, not the IDE.) The simplest way to install these is to run:

xcode-select --install
-

It is advisable to keep an older version of Xcode for building the JDK when updating Xcode. This blog page has good suggestions on managing multiple Xcode versions. To use a specific version of Xcode, use xcode-select -s before running configure, or use --with-toolchain-path to point to the version of Xcode to use, e.g. configure --with-toolchain-path=/Applications/Xcode8.app/Contents/Developer/usr/bin

+

When updating Xcode, it is advisable to keep an older version for building the JDK. To use a specific version of Xcode you have multiple options:

+

If you have recently (inadvertently) updated your OS and/or Xcode version, and the JDK can no longer be built, please see the section on Problems with the Build Environment, and Getting Help to find out if there are any recent, non-merged patches available for this update.

Microsoft Visual Studio

For aarch64 machines running Windows the minimum accepted version is Visual Studio 2019 (16.8 or higher). For all other platforms the minimum accepted version of Visual Studio is 2017. Older versions will not be accepted by configure and will not work. For all platforms the maximum accepted version of Visual Studio is 2022.

diff --git a/doc/building.md b/doc/building.md index f3b0ee10522..72564a95b7b 100644 --- a/doc/building.md +++ b/doc/building.md @@ -313,12 +313,12 @@ be able to run on the target platform. In theory, toolchain and operating system should be independent factors, but in practice there's more or less a one-to-one correlation between target operating system and toolchain. - Operating system Supported toolchain - ------------------ ------------------------- - Linux gcc, clang - macOS Apple Xcode (using clang) - AIX IBM XL C/C++ - Windows Microsoft Visual Studio +| Operating system | Supported toolchain | +| ------------------ | ------------------------- | +| Linux | gcc, clang | +| macOS | Apple Xcode (using clang) | +| AIX | IBM XL C/C++ | +| Windows | Microsoft Visual Studio | Please see the individual sections on the toolchains for version recommendations. As a reference, these versions of the toolchains are used, at @@ -327,11 +327,11 @@ possible to compile the JDK with both older and newer versions, but the closer you stay to this list, the more likely you are to compile successfully without issues. - Operating system Toolchain version - ------------------ ------------------------------------------------------- - Linux gcc 11.2.0 - macOS Apple Xcode 10.1 (using clang 10.0.0) - Windows Microsoft Visual Studio 2022 update 17.1.0 +| Operating system | Toolchain version | +| ------------------ | ------------------------------------------ | +| Linux | gcc 11.2.0 | +| macOS | Apple Xcode 10.1 (using clang 10.0.0) | +| Windows | Microsoft Visual Studio 2022 update 17.1.0 | All compilers are expected to be able to compile to the C99 language standard, as some C99 features are used in the source code. Microsoft Visual Studio @@ -359,20 +359,20 @@ To use clang instead of gcc on Linux, use `--with-toolchain-type=clang`. The oldest supported version of Xcode is 8. -You will need the Xcode command lines developers tools to be able to build -the JDK. (Actually, *only* the command lines tools are needed, not the IDE.) +You will need the Xcode command line developer tools to be able to build +the JDK. (Actually, *only* the command line tools are needed, not the IDE.) The simplest way to install these is to run: ``` xcode-select --install ``` -It is advisable to keep an older version of Xcode for building the JDK when -updating Xcode. This [blog page]( -http://iosdevelopertips.com/xcode/install-multiple-versions-of-xcode.html) has -good suggestions on managing multiple Xcode versions. To use a specific version -of Xcode, use `xcode-select -s` before running `configure`, or use -`--with-toolchain-path` to point to the version of Xcode to use, e.g. -`configure --with-toolchain-path=/Applications/Xcode8.app/Contents/Developer/usr/bin` +When updating Xcode, it is advisable to keep an older version for building the JDK. +To use a specific version of Xcode you have multiple options: + + * Use `xcode-select -s` before running `configure`, e.g. `xcode-select -s /Applications/Xcode13.1.app`. The drawback is that the setting + is system wide and you may have to revert it after an OpenJDK build. + * Use configure option `--with-xcode-path`, e.g. `configure --with-xcode-path=/Applications/Xcode13.1.app` + This allows using a specific Xcode version for an OpenJDK build, independently of the active Xcode version by `xcode-select`. If you have recently (inadvertently) updated your OS and/or Xcode version, and the JDK can no longer be built, please see the section on [Problems with the diff --git a/make/autoconf/basic.m4 b/make/autoconf/basic.m4 index 497dd2b0c1b..cf68d072928 100644 --- a/make/autoconf/basic.m4 +++ b/make/autoconf/basic.m4 @@ -139,6 +139,15 @@ AC_DEFUN([BASIC_SETUP_XCODE_SYSROOT], if test $? -ne 0; then AC_MSG_ERROR([The xcodebuild tool in the devkit reports an error: $XCODEBUILD_OUTPUT]) fi + elif test "x$TOOLCHAIN_PATH" != x; then + UTIL_LOOKUP_PROGS(XCODEBUILD, xcodebuild, $TOOLCHAIN_PATH) + if test "x$XCODEBUILD" != x; then + XCODEBUILD_OUTPUT=`"$XCODEBUILD" -version 2>&1` + if test $? -ne 0; then + AC_MSG_WARN([Ignoring the located xcodebuild tool $XCODEBUILD due to an error: $XCODEBUILD_OUTPUT]) + XCODEBUILD= + fi + fi else UTIL_LOOKUP_PROGS(XCODEBUILD, xcodebuild) if test "x$XCODEBUILD" != x; then @@ -288,6 +297,22 @@ AC_DEFUN_ONCE([BASIC_SETUP_DEVKIT], [UTIL_PREPEND_TO_PATH([TOOLCHAIN_PATH],$with_toolchain_path)] ) + AC_ARG_WITH([xcode-path], [AS_HELP_STRING([--with-xcode-path], + [set up toolchain on Mac OS using a path to an Xcode installation])]) + + if test "x$with_xcode_path" != x; then + if test "x$OPENJDK_BUILD_OS" = "xmacosx"; then + UTIL_PREPEND_TO_PATH([TOOLCHAIN_PATH], + $with_xcode_path/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:$with_xcode_path/Contents/Developer/usr/bin) + else + AC_MSG_WARN([Option --with-xcode-path is only valid on Mac OS, ignoring.]) + fi + fi + + AC_MSG_CHECKING([for toolchain path]) + AC_MSG_RESULT([$TOOLCHAIN_PATH]) + AC_SUBST(TOOLCHAIN_PATH) + AC_ARG_WITH([extra-path], [AS_HELP_STRING([--with-extra-path], [prepend these directories to the default path])], [UTIL_PREPEND_TO_PATH([EXTRA_PATH],$with_extra_path)] @@ -304,10 +329,6 @@ AC_DEFUN_ONCE([BASIC_SETUP_DEVKIT], AC_MSG_RESULT([$SYSROOT]) AC_SUBST(SYSROOT) - AC_MSG_CHECKING([for toolchain path]) - AC_MSG_RESULT([$TOOLCHAIN_PATH]) - AC_SUBST(TOOLCHAIN_PATH) - AC_MSG_CHECKING([for extra path]) AC_MSG_RESULT([$EXTRA_PATH]) ])