8296904: Improve handling of macos xcode toolchain
Reviewed-by: erikj, ihse
This commit is contained in:
parent
b4bd287f73
commit
470f3424fc
@ -495,26 +495,26 @@ it will likely be a very long time before this goal can be realized.</p>
|
|||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr class="header">
|
<tr class="header">
|
||||||
<th style="text-align: left;">Operating system</th>
|
<th>Operating system</th>
|
||||||
<th style="text-align: left;">Supported toolchain</th>
|
<th>Supported toolchain</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr class="odd">
|
<tr class="odd">
|
||||||
<td style="text-align: left;">Linux</td>
|
<td>Linux</td>
|
||||||
<td style="text-align: left;">gcc, clang</td>
|
<td>gcc, clang</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="even">
|
<tr class="even">
|
||||||
<td style="text-align: left;">macOS</td>
|
<td>macOS</td>
|
||||||
<td style="text-align: left;">Apple Xcode (using clang)</td>
|
<td>Apple Xcode (using clang)</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="odd">
|
<tr class="odd">
|
||||||
<td style="text-align: left;">AIX</td>
|
<td>AIX</td>
|
||||||
<td style="text-align: left;">IBM XL C/C++</td>
|
<td>IBM XL C/C++</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="even">
|
<tr class="even">
|
||||||
<td style="text-align: left;">Windows</td>
|
<td>Windows</td>
|
||||||
<td style="text-align: left;">Microsoft Visual Studio</td>
|
<td>Microsoft Visual Studio</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -527,23 +527,22 @@ to compile successfully without issues.</p>
|
|||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr class="header">
|
<tr class="header">
|
||||||
<th style="text-align: left;">Operating system</th>
|
<th>Operating system</th>
|
||||||
<th style="text-align: left;">Toolchain version</th>
|
<th>Toolchain version</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr class="odd">
|
<tr class="odd">
|
||||||
<td style="text-align: left;">Linux</td>
|
<td>Linux</td>
|
||||||
<td style="text-align: left;">gcc 11.2.0</td>
|
<td>gcc 11.2.0</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="even">
|
<tr class="even">
|
||||||
<td style="text-align: left;">macOS</td>
|
<td>macOS</td>
|
||||||
<td style="text-align: left;">Apple Xcode 10.1 (using clang 10.0.0)</td>
|
<td>Apple Xcode 10.1 (using clang 10.0.0)</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="odd">
|
<tr class="odd">
|
||||||
<td style="text-align: left;">Windows</td>
|
<td>Windows</td>
|
||||||
<td style="text-align: left;">Microsoft Visual Studio 2022 update
|
<td>Microsoft Visual Studio 2022 update 17.1.0</td>
|
||||||
17.1.0</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@ -565,19 +564,25 @@ be accepted by <code>configure</code>.</p>
|
|||||||
<code>--with-toolchain-type=clang</code>.</p>
|
<code>--with-toolchain-type=clang</code>.</p>
|
||||||
<h3 id="apple-xcode">Apple Xcode</h3>
|
<h3 id="apple-xcode">Apple Xcode</h3>
|
||||||
<p>The oldest supported version of Xcode is 8.</p>
|
<p>The oldest supported version of Xcode is 8.</p>
|
||||||
<p>You will need the Xcode command lines developers tools to be able to
|
<p>You will need the Xcode command line developer tools to be able to
|
||||||
build the JDK. (Actually, <em>only</em> the command lines tools are
|
build the JDK. (Actually, <em>only</em> the command line tools are
|
||||||
needed, not the IDE.) The simplest way to install these is to run:</p>
|
needed, not the IDE.) The simplest way to install these is to run:</p>
|
||||||
<pre><code>xcode-select --install</code></pre>
|
<pre><code>xcode-select --install</code></pre>
|
||||||
<p>It is advisable to keep an older version of Xcode for building the
|
<p>When updating Xcode, it is advisable to keep an older version for
|
||||||
JDK when updating Xcode. This <a
|
building the JDK. To use a specific version of Xcode you have multiple
|
||||||
href="http://iosdevelopertips.com/xcode/install-multiple-versions-of-xcode.html">blog
|
options:</p>
|
||||||
page</a> has good suggestions on managing multiple Xcode versions. To
|
<ul>
|
||||||
use a specific version of Xcode, use <code>xcode-select -s</code> before
|
<li>Use <code>xcode-select -s</code> before running
|
||||||
running <code>configure</code>, or use
|
<code>configure</code>, e.g.
|
||||||
<code>--with-toolchain-path</code> to point to the version of Xcode to
|
<code>xcode-select -s /Applications/Xcode13.1.app</code>. The drawback
|
||||||
use, e.g.
|
is that the setting is system wide and you may have to revert it after
|
||||||
<code>configure --with-toolchain-path=/Applications/Xcode8.app/Contents/Developer/usr/bin</code></p>
|
an OpenJDK build.</li>
|
||||||
|
<li>Use configure option <code>--with-xcode-path</code>, e.g.
|
||||||
|
<code>configure --with-xcode-path=/Applications/Xcode13.1.app</code>
|
||||||
|
This allows using a specific Xcode version for an OpenJDK build,
|
||||||
|
independently of the active Xcode version by
|
||||||
|
<code>xcode-select</code>.</li>
|
||||||
|
</ul>
|
||||||
<p>If you have recently (inadvertently) updated your OS and/or Xcode
|
<p>If you have recently (inadvertently) updated your OS and/or Xcode
|
||||||
version, and the JDK can no longer be built, please see the section on
|
version, and the JDK can no longer be built, please see the section on
|
||||||
<a href="#problems-with-the-build-environment">Problems with the Build
|
<a href="#problems-with-the-build-environment">Problems with the Build
|
||||||
|
@ -316,12 +316,12 @@ ongoing efforts to loosen this strict coupling between compiler and operating
|
|||||||
system (see [JDK-8288293](https://bugs.openjdk.org/browse/JDK-8288293)) but it
|
system (see [JDK-8288293](https://bugs.openjdk.org/browse/JDK-8288293)) but it
|
||||||
will likely be a very long time before this goal can be realized.
|
will likely be a very long time before this goal can be realized.
|
||||||
|
|
||||||
Operating system Supported toolchain
|
| Operating system | Supported toolchain |
|
||||||
------------------ -------------------------
|
| ------------------ | ------------------------- |
|
||||||
Linux gcc, clang
|
| Linux | gcc, clang |
|
||||||
macOS Apple Xcode (using clang)
|
| macOS | Apple Xcode (using clang) |
|
||||||
AIX IBM XL C/C++
|
| AIX | IBM XL C/C++ |
|
||||||
Windows Microsoft Visual Studio
|
| Windows | Microsoft Visual Studio |
|
||||||
|
|
||||||
Please see the individual sections on the toolchains for version
|
Please see the individual sections on the toolchains for version
|
||||||
recommendations. As a reference, these versions of the toolchains are used, at
|
recommendations. As a reference, these versions of the toolchains are used, at
|
||||||
@ -330,11 +330,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
|
you stay to this list, the more likely you are to compile successfully without
|
||||||
issues.
|
issues.
|
||||||
|
|
||||||
Operating system Toolchain version
|
| Operating system | Toolchain version |
|
||||||
------------------ -------------------------------------------------------
|
| ------------------ | ------------------------------------------ |
|
||||||
Linux gcc 11.2.0
|
| Linux | gcc 11.2.0 |
|
||||||
macOS Apple Xcode 10.1 (using clang 10.0.0)
|
| macOS | Apple Xcode 10.1 (using clang 10.0.0) |
|
||||||
Windows Microsoft Visual Studio 2022 update 17.1.0
|
| Windows | Microsoft Visual Studio 2022 update 17.1.0 |
|
||||||
|
|
||||||
All compilers are expected to be able to compile to the C99 language standard,
|
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
|
as some C99 features are used in the source code. Microsoft Visual Studio
|
||||||
@ -362,20 +362,20 @@ To use clang instead of gcc on Linux, use `--with-toolchain-type=clang`.
|
|||||||
|
|
||||||
The oldest supported version of Xcode is 8.
|
The oldest supported version of Xcode is 8.
|
||||||
|
|
||||||
You will need the Xcode command lines developers tools to be able to build
|
You will need the Xcode command line developer tools to be able to build
|
||||||
the JDK. (Actually, *only* the command lines tools are needed, not the IDE.)
|
the JDK. (Actually, *only* the command line tools are needed, not the IDE.)
|
||||||
The simplest way to install these is to run:
|
The simplest way to install these is to run:
|
||||||
```
|
```
|
||||||
xcode-select --install
|
xcode-select --install
|
||||||
```
|
```
|
||||||
|
|
||||||
It is advisable to keep an older version of Xcode for building the JDK when
|
When updating Xcode, it is advisable to keep an older version for building the JDK.
|
||||||
updating Xcode. This [blog page](
|
To use a specific version of Xcode you have multiple options:
|
||||||
http://iosdevelopertips.com/xcode/install-multiple-versions-of-xcode.html) has
|
|
||||||
good suggestions on managing multiple Xcode versions. To use a specific version
|
* Use `xcode-select -s` before running `configure`, e.g. `xcode-select -s /Applications/Xcode13.1.app`. The drawback is that the setting
|
||||||
of Xcode, use `xcode-select -s` before running `configure`, or use
|
is system wide and you may have to revert it after an OpenJDK build.
|
||||||
`--with-toolchain-path` to point to the version of Xcode to use, e.g.
|
* Use configure option `--with-xcode-path`, e.g. `configure --with-xcode-path=/Applications/Xcode13.1.app`
|
||||||
`configure --with-toolchain-path=/Applications/Xcode8.app/Contents/Developer/usr/bin`
|
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
|
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
|
the JDK can no longer be built, please see the section on [Problems with the
|
||||||
|
@ -144,6 +144,15 @@ AC_DEFUN([BASIC_SETUP_XCODE_SYSROOT],
|
|||||||
if test $? -ne 0; then
|
if test $? -ne 0; then
|
||||||
AC_MSG_ERROR([The xcodebuild tool in the devkit reports an error: $XCODEBUILD_OUTPUT])
|
AC_MSG_ERROR([The xcodebuild tool in the devkit reports an error: $XCODEBUILD_OUTPUT])
|
||||||
fi
|
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
|
else
|
||||||
UTIL_LOOKUP_PROGS(XCODEBUILD, xcodebuild)
|
UTIL_LOOKUP_PROGS(XCODEBUILD, xcodebuild)
|
||||||
if test "x$XCODEBUILD" != x; then
|
if test "x$XCODEBUILD" != x; then
|
||||||
@ -293,6 +302,22 @@ AC_DEFUN_ONCE([BASIC_SETUP_DEVKIT],
|
|||||||
[UTIL_PREPEND_TO_PATH([TOOLCHAIN_PATH],$with_toolchain_path)]
|
[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],
|
AC_ARG_WITH([extra-path], [AS_HELP_STRING([--with-extra-path],
|
||||||
[prepend these directories to the default path])],
|
[prepend these directories to the default path])],
|
||||||
[UTIL_PREPEND_TO_PATH([EXTRA_PATH],$with_extra_path)]
|
[UTIL_PREPEND_TO_PATH([EXTRA_PATH],$with_extra_path)]
|
||||||
@ -311,10 +336,6 @@ AC_DEFUN_ONCE([BASIC_SETUP_DEVKIT],
|
|||||||
AC_MSG_RESULT([$SYSROOT])
|
AC_MSG_RESULT([$SYSROOT])
|
||||||
AC_SUBST(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_CHECKING([for extra path])
|
||||||
AC_MSG_RESULT([$EXTRA_PATH])
|
AC_MSG_RESULT([$EXTRA_PATH])
|
||||||
])
|
])
|
||||||
|
Loading…
Reference in New Issue
Block a user