8282532: Allow explicitly setting build platform alongside --openjdk-target
Reviewed-by: ihse
This commit is contained in:
parent
b3837808bf
commit
d5e8e52f02
@ -163,6 +163,8 @@
|
||||
<h3 id="building-on-aarch64">Building on aarch64</h3>
|
||||
<p>At a minimum, a machine with 8 cores is advisable, as well as 8 GB of RAM. (The more cores to use, the more memory you need.) At least 6 GB of free disk space is required.</p>
|
||||
<p>If you do not have access to sufficiently powerful hardware, it is also possible to use <a href="#cross-compiling">cross-compiling</a>.</p>
|
||||
<h4 id="branch-protection">Branch Protection</h4>
|
||||
<p>In order to use Branch Protection features in the VM, <code>--enable-branch-protection</code> must be used. This option requires C++ compiler support (GCC 9.1.0+ or Clang 10+). The resulting build can be run on both machines with and without support for branch protection in hardware. Branch Protection is only supported for Linux targets.</p>
|
||||
<h3 id="building-on-32-bit-arm">Building on 32-bit arm</h3>
|
||||
<p>This is not recommended. Instead, see the section on <a href="#cross-compiling">Cross-compiling</a>.</p>
|
||||
<h2 id="operating-system-requirements">Operating System Requirements</h2>
|
||||
@ -214,7 +216,7 @@
|
||||
<p>Unfortunately, Cygwin can be unreliable in certain circumstances. If you experience build tool crashes or strange issues when building on Windows, please check the Cygwin FAQ on the <a href="https://cygwin.com/faq/faq.html#faq.using.bloda">"BLODA" list</a> and the section on <a href="https://cygwin.com/faq/faq.html#faq.using.fixing-fork-failures">fork() failures</a>.</p>
|
||||
<h4 id="windows-subsystem-for-linux-wsl">Windows Subsystem for Linux (WSL)</h4>
|
||||
<p>Windows 10 1809 or newer is supported due to a dependency on the wslpath utility and support for environment variable sharing through WSLENV. Version 1803 can work but intermittent build failures have been observed.</p>
|
||||
<p>It's possible to build both Windows and Linux binaries from WSL. To build Windows binaries, you must use a Windows boot JDK (located in a Windows-accessible directory). To build Linux binaries, you must use a Linux boot JDK. The default behavior is to build for Windows. To build for Linux, pass <code>--build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu</code> to <code>configure</code>.</p>
|
||||
<p>It's possible to build both Windows and Linux binaries from WSL. To build Windows binaries, you must use a Windows boot JDK (located in a Windows-accessible directory). To build Linux binaries, you must use a Linux boot JDK. The default behavior is to build for Windows. To build for Linux, pass <code>--build=x86_64-unknown-linux-gnu --openjdk-target=x86_64-unknown-linux-gnu</code> to <code>configure</code>.</p>
|
||||
<p>If building Windows binaries, the source code must be located in a Windows- accessible directory. This is because Windows executables (such as Visual Studio and the boot JDK) must be able to access the source code. Also, the drive where the source is stored must be mounted as case-insensitive by changing either /etc/fstab or /etc/wsl.conf in WSL. Individual directories may be corrected using the fsutil tool in case the source was cloned before changing the mount options.</p>
|
||||
<p>Note that while it's possible to build on WSL, testing is still not fully supported.</p>
|
||||
<h3 id="macos">macOS</h3>
|
||||
@ -568,7 +570,8 @@ x86_64-linux-gnu-to-ppc64le-linux-gnu</code></pre>
|
||||
<p>To be able to build, we need a "Build JDK", which is a JDK built from the current sources (that is, the same as the end result of the entire build process), but able to run on the <em>build</em> system, and not the <em>target</em> system. (In contrast, the Boot JDK should be from an older release, e.g. JDK 8 when building JDK 9.)</p>
|
||||
<p>The build process will create a minimal Build JDK for you, as part of building. To speed up the build, you can use <code>--with-build-jdk</code> to <code>configure</code> to point to a pre-built Build JDK. Please note that the build result is unpredictable, and can possibly break in subtle ways, if the Build JDK does not <strong>exactly</strong> match the current sources.</p>
|
||||
<h3 id="specifying-the-target-platform">Specifying the Target Platform</h3>
|
||||
<p>You <em>must</em> specify the target platform when cross-compiling. Doing so will also automatically turn the build into a cross-compiling mode. The simplest way to do this is to use the <code>--openjdk-target</code> argument, e.g. <code>--openjdk-target=arm-linux-gnueabihf</code>. or <code>--openjdk-target=aarch64-oe-linux</code>. This will automatically set the <code>--build</code>, <code>--host</code> and <code>--target</code> options for autoconf, which can otherwise be confusing. (In autoconf terminology, the "target" is known as "host", and "target" is used for building a Canadian cross-compiler.)</p>
|
||||
<p>You <em>must</em> specify the target platform when cross-compiling. Doing so will also automatically turn the build into a cross-compiling mode. The simplest way to do this is to use the <code>--openjdk-target</code> argument, e.g. <code>--openjdk-target=arm-linux-gnueabihf</code>. or <code>--openjdk-target=aarch64-oe-linux</code>. This will automatically set the <code>--host</code> and <code>--target</code> options for autoconf, which can otherwise be confusing. (In autoconf terminology, the "target" is known as "host", and "target" is used for building a Canadian cross-compiler.)</p>
|
||||
<p>If <code>--build</code> has not been explicitly passed to configure, <code>--openjdk-target</code> will autodetect the build platform and internally set the flag automatically, otherwise the platform that was explicitly passed to <code>--build</code> will be used instead.</p>
|
||||
<h3 id="toolchain-considerations">Toolchain Considerations</h3>
|
||||
<p>You will need two copies of your toolchain, one which generates output that can run on the target system (the normal, or <em>target</em>, toolchain), and one that generates output that can run on the build system (the <em>build</em> toolchain). Note that cross-compiling is only supported for gcc at the time being. The gcc standard is to prefix cross-compiling toolchains with the target denominator. If you follow this standard, <code>configure</code> is likely to pick up the toolchain correctly.</p>
|
||||
<p>The <em>build</em> toolchain will be autodetected just the same way the normal <em>build</em>/<em>target</em> toolchain will be autodetected when not cross-compiling. If this is not what you want, or if the autodetection fails, you can specify a devkit containing the <em>build</em> toolchain using <code>--with-build-devkit</code> to <code>configure</code>, or by giving <code>BUILD_CC</code> and <code>BUILD_CXX</code> arguments.</p>
|
||||
|
@ -244,8 +244,8 @@ It's possible to build both Windows and Linux binaries from WSL. To build
|
||||
Windows binaries, you must use a Windows boot JDK (located in a
|
||||
Windows-accessible directory). To build Linux binaries, you must use a Linux
|
||||
boot JDK. The default behavior is to build for Windows. To build for Linux, pass
|
||||
`--build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu` to
|
||||
`configure`.
|
||||
`--build=x86_64-unknown-linux-gnu --openjdk-target=x86_64-unknown-linux-gnu`
|
||||
to `configure`.
|
||||
|
||||
If building Windows binaries, the source code must be located in a Windows-
|
||||
accessible directory. This is because Windows executables (such as Visual Studio
|
||||
@ -382,9 +382,9 @@ 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
|
||||
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.
|
||||
|
||||
If you have multiple versions of Visual Studio installed, `configure` will by
|
||||
@ -986,11 +986,16 @@ You *must* specify the target platform when cross-compiling. Doing so will also
|
||||
automatically turn the build into a cross-compiling mode. The simplest way to
|
||||
do this is to use the `--openjdk-target` argument, e.g.
|
||||
`--openjdk-target=arm-linux-gnueabihf`. or `--openjdk-target=aarch64-oe-linux`.
|
||||
This will automatically set the `--build`, `--host` and `--target` options for
|
||||
This will automatically set the `--host` and `--target` options for
|
||||
autoconf, which can otherwise be confusing. (In autoconf terminology, the
|
||||
"target" is known as "host", and "target" is used for building a Canadian
|
||||
cross-compiler.)
|
||||
|
||||
If `--build` has not been explicitly passed to configure, `--openjdk-target`
|
||||
will autodetect the build platform and internally set the flag automatically,
|
||||
otherwise the platform that was explicitly passed to `--build` will be used
|
||||
instead.
|
||||
|
||||
### Toolchain Considerations
|
||||
|
||||
You will need two copies of your toolchain, one which generates output that can
|
||||
|
35
make/autoconf/configure
vendored
35
make/autoconf/configure
vendored
@ -274,11 +274,11 @@ do
|
||||
# Check for certain autoconf options that require extra action
|
||||
case $conf_option in
|
||||
-build | --build | --buil | --bui | --bu |-build=* | --build=* | --buil=* | --bui=* | --bu=*)
|
||||
conf_legacy_crosscompile="$conf_legacy_crosscompile $conf_option" ;;
|
||||
conf_build_set=true ;;
|
||||
-target | --target | --targe | --targ | --tar | --ta | --t | -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
|
||||
conf_legacy_crosscompile="$conf_legacy_crosscompile $conf_option" ;;
|
||||
conf_incompatible_crosscompile="$conf_incompatible_crosscompile $conf_option" ;;
|
||||
-host | --host | --hos | --ho | -host=* | --host=* | --hos=* | --ho=*)
|
||||
conf_legacy_crosscompile="$conf_legacy_crosscompile $conf_option" ;;
|
||||
conf_incompatible_crosscompile="$conf_incompatible_crosscompile $conf_option" ;;
|
||||
-help | --help | --hel | --he | -h)
|
||||
conf_print_help=true ;;
|
||||
esac
|
||||
@ -287,23 +287,30 @@ done
|
||||
# Save the quoted command line
|
||||
CONFIGURE_COMMAND_LINE="${conf_quoted_arguments[@]}"
|
||||
|
||||
if test "x$conf_legacy_crosscompile" != "x"; then
|
||||
if test "x$conf_incompatible_crosscompile" != "x"; then
|
||||
if test "x$conf_openjdk_target" != "x"; then
|
||||
echo "Error: Specifying --openjdk-target together with autoconf"
|
||||
echo "legacy cross-compilation flags is not supported."
|
||||
echo "You specified: --openjdk-target=$conf_openjdk_target and $conf_legacy_crosscompile."
|
||||
echo "The recommended use is just --openjdk-target."
|
||||
echo "Error: --openjdk-target was specified together with"
|
||||
echo "incompatible autoconf cross-compilation flags."
|
||||
echo "You specified: --openjdk-target=$conf_openjdk_target and $conf_incompatible_crosscompile."
|
||||
echo "It is recommended that you only use --openjdk-target."
|
||||
exit 1
|
||||
else
|
||||
echo "Warning: You are using legacy autoconf cross-compilation flags."
|
||||
echo "It is recommended that you use --openjdk-target instead."
|
||||
echo "Warning: You are using misleading autoconf cross-compilation flag(s)."
|
||||
echo "This is not encouraged as use of such flags during building can"
|
||||
echo "quickly become confusing."
|
||||
echo "It is highly recommended that you use --openjdk-target instead."
|
||||
echo ""
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$conf_openjdk_target" != "x"; then
|
||||
conf_build_platform=`sh $conf_script_dir/build-aux/config.guess`
|
||||
conf_processed_arguments=("--build=$conf_build_platform" "--host=$conf_openjdk_target" "--target=$conf_openjdk_target" "${conf_processed_arguments[@]}")
|
||||
conf_processed_arguments=("--host=$conf_openjdk_target" "--target=$conf_openjdk_target" "${conf_processed_arguments[@]}")
|
||||
|
||||
# If --build has been explicitly set don't override that flag with our own
|
||||
if test "x$conf_build_set" != xtrue; then
|
||||
conf_build_platform=`sh $conf_script_dir/build-aux/config.guess`
|
||||
conf_processed_arguments=("--build=$conf_build_platform" "${conf_processed_arguments[@]}")
|
||||
fi
|
||||
fi
|
||||
|
||||
# Make configure exit with error on invalid options as default.
|
||||
@ -341,7 +348,9 @@ Additional (non-autoconf) OpenJDK Options:
|
||||
--openjdk-target=TARGET cross-compile with TARGET as target platform
|
||||
(i.e. the one you will run the resulting binary on).
|
||||
Equivalent to --host=TARGET --target=TARGET
|
||||
--build=<current platform>
|
||||
--build=<current platform>, or the platform you
|
||||
have provided if you have explicitly passed
|
||||
--build to configure
|
||||
--debug-configure Run the configure script with additional debug
|
||||
logging enabled.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user