8247591: Document Alpine Linux build steps in OpenJDK build guide

Co-authored-by: Aleksei Voitylov <avoitylov@openjdk.org>
Reviewed-by: erikj
This commit is contained in:
Aleksei Voitylov 2020-10-13 09:42:23 +00:00 committed by Alexander Scherbatiy
parent 63009f90ec
commit 508c8a9585
2 changed files with 51 additions and 0 deletions

View File

@ -78,6 +78,7 @@
<li><a href="#native-libraries">Native Libraries</a></li> <li><a href="#native-libraries">Native Libraries</a></li>
<li><a href="#creating-and-using-sysroots-with-qemu-deboostrap">Creating And Using Sysroots With qemu-deboostrap</a></li> <li><a href="#creating-and-using-sysroots-with-qemu-deboostrap">Creating And Using Sysroots With qemu-deboostrap</a></li>
<li><a href="#building-for-armaarch64">Building for ARM/aarch64</a></li> <li><a href="#building-for-armaarch64">Building for ARM/aarch64</a></li>
<li><a href="#building-for-musl">Building for musl</a></li>
<li><a href="#verifying-the-build">Verifying the Build</a></li> <li><a href="#verifying-the-build">Verifying the Build</a></li>
</ul></li> </ul></li>
<li><a href="#build-performance">Build Performance</a><ul> <li><a href="#build-performance">Build Performance</a><ul>
@ -224,6 +225,8 @@
<pre><code>sudo apt-get install build-essential</code></pre> <pre><code>sudo apt-get install build-essential</code></pre>
<p>For rpm-based distributions (Fedora, Red Hat, etc), try this:</p> <p>For rpm-based distributions (Fedora, Red Hat, etc), try this:</p>
<pre><code>sudo yum groupinstall &quot;Development Tools&quot;</code></pre> <pre><code>sudo yum groupinstall &quot;Development Tools&quot;</code></pre>
<p>For Alpine Linux, aside from basic tooling, install the GNU versions of some programs:</p>
<pre><code>sudo apk add build-base bash grep zip</code></pre>
<h3 id="aix">AIX</h3> <h3 id="aix">AIX</h3>
<p>Please consult the AIX section of the <a href="https://wiki.openjdk.java.net/display/Build/Supported+Build+Platforms">Supported Build Platforms</a> OpenJDK Build Wiki page for details about which versions of AIX are supported.</p> <p>Please consult the AIX section of the <a href="https://wiki.openjdk.java.net/display/Build/Supported+Build+Platforms">Supported Build Platforms</a> OpenJDK Build Wiki page for details about which versions of AIX are supported.</p>
<h2 id="native-compiler-toolchain-requirements">Native Compiler (Toolchain) Requirements</h2> <h2 id="native-compiler-toolchain-requirements">Native Compiler (Toolchain) Requirements</h2>
@ -313,6 +316,7 @@
<ul> <ul>
<li>To install on an apt-based Linux, try running <code>sudo apt-get install libfreetype6-dev</code>.</li> <li>To install on an apt-based Linux, try running <code>sudo apt-get install libfreetype6-dev</code>.</li>
<li>To install on an rpm-based Linux, try running <code>sudo yum install freetype-devel</code>.</li> <li>To install on an rpm-based Linux, try running <code>sudo yum install freetype-devel</code>.</li>
<li>To install on Alpine Linux, try running <code>sudo apk add freetype-dev</code>.</li>
</ul> </ul>
<p>Use <code>--with-freetype-include=&lt;path&gt;</code> and <code>--with-freetype-lib=&lt;path&gt;</code> if <code>configure</code> does not automatically locate the platform FreeType files.</p> <p>Use <code>--with-freetype-include=&lt;path&gt;</code> and <code>--with-freetype-lib=&lt;path&gt;</code> if <code>configure</code> does not automatically locate the platform FreeType files.</p>
<h3 id="cups">CUPS</h3> <h3 id="cups">CUPS</h3>
@ -320,6 +324,7 @@
<ul> <ul>
<li>To install on an apt-based Linux, try running <code>sudo apt-get install libcups2-dev</code>.</li> <li>To install on an apt-based Linux, try running <code>sudo apt-get install libcups2-dev</code>.</li>
<li>To install on an rpm-based Linux, try running <code>sudo yum install cups-devel</code>.</li> <li>To install on an rpm-based Linux, try running <code>sudo yum install cups-devel</code>.</li>
<li>To install on Alpine Linux, try running <code>sudo apk add cups-dev</code>.</li>
</ul> </ul>
<p>Use <code>--with-cups=&lt;path&gt;</code> if <code>configure</code> does not properly locate your CUPS files.</p> <p>Use <code>--with-cups=&lt;path&gt;</code> if <code>configure</code> does not properly locate your CUPS files.</p>
<h3 id="x11">X11</h3> <h3 id="x11">X11</h3>
@ -327,6 +332,7 @@
<ul> <ul>
<li>To install on an apt-based Linux, try running <code>sudo apt-get install libx11-dev libxext-dev libxrender-dev libxrandr-dev libxtst-dev libxt-dev</code>.</li> <li>To install on an apt-based Linux, try running <code>sudo apt-get install libx11-dev libxext-dev libxrender-dev libxrandr-dev libxtst-dev libxt-dev</code>.</li>
<li>To install on an rpm-based Linux, try running <code>sudo yum install libXtst-devel libXt-devel libXrender-devel libXrandr-devel libXi-devel</code>.</li> <li>To install on an rpm-based Linux, try running <code>sudo yum install libXtst-devel libXt-devel libXrender-devel libXrandr-devel libXi-devel</code>.</li>
<li>To install on Alpine Linux, try running <code>sudo apk add libx11-dev libxext-dev libxrender-dev libxrandr-dev libxtst-dev libxt-dev</code>.</li>
</ul> </ul>
<p>Use <code>--with-x=&lt;path&gt;</code> if <code>configure</code> does not properly locate your X11 files.</p> <p>Use <code>--with-x=&lt;path&gt;</code> if <code>configure</code> does not properly locate your X11 files.</p>
<h3 id="alsa">ALSA</h3> <h3 id="alsa">ALSA</h3>
@ -334,6 +340,7 @@
<ul> <ul>
<li>To install on an apt-based Linux, try running <code>sudo apt-get install libasound2-dev</code>.</li> <li>To install on an apt-based Linux, try running <code>sudo apt-get install libasound2-dev</code>.</li>
<li>To install on an rpm-based Linux, try running <code>sudo yum install alsa-lib-devel</code>.</li> <li>To install on an rpm-based Linux, try running <code>sudo yum install alsa-lib-devel</code>.</li>
<li>To install on Alpine Linux, try running <code>sudo apk add alsa-lib-dev</code>.</li>
</ul> </ul>
<p>Use <code>--with-alsa=&lt;path&gt;</code> if <code>configure</code> does not properly locate your ALSA files.</p> <p>Use <code>--with-alsa=&lt;path&gt;</code> if <code>configure</code> does not properly locate your ALSA files.</p>
<h3 id="libffi">libffi</h3> <h3 id="libffi">libffi</h3>
@ -341,6 +348,7 @@
<ul> <ul>
<li>To install on an apt-based Linux, try running <code>sudo apt-get install libffi-dev</code>.</li> <li>To install on an apt-based Linux, try running <code>sudo apt-get install libffi-dev</code>.</li>
<li>To install on an rpm-based Linux, try running <code>sudo yum install libffi-devel</code>.</li> <li>To install on an rpm-based Linux, try running <code>sudo yum install libffi-devel</code>.</li>
<li>To install on Alpine Linux, try running <code>sudo apk add libffi-dev</code>.</li>
</ul> </ul>
<p>Use <code>--with-libffi=&lt;path&gt;</code> if <code>configure</code> does not properly locate your libffi files.</p> <p>Use <code>--with-libffi=&lt;path&gt;</code> if <code>configure</code> does not properly locate your libffi files.</p>
<h2 id="build-tools-requirements">Build Tools Requirements</h2> <h2 id="build-tools-requirements">Build Tools Requirements</h2>
@ -349,6 +357,7 @@
<ul> <ul>
<li>To install on an apt-based Linux, try running <code>sudo apt-get install autoconf</code>.</li> <li>To install on an apt-based Linux, try running <code>sudo apt-get install autoconf</code>.</li>
<li>To install on an rpm-based Linux, try running <code>sudo yum install autoconf</code>.</li> <li>To install on an rpm-based Linux, try running <code>sudo yum install autoconf</code>.</li>
<li>To install on Alpine Linux, try running <code>sudo apk add autoconf</code>.</li>
<li>To install on macOS, try running <code>brew install autoconf</code>.</li> <li>To install on macOS, try running <code>brew install autoconf</code>.</li>
<li>To install on Windows, try running <code>&lt;path to Cygwin setup&gt;/setup-x86_64 -q -P autoconf</code>.</li> <li>To install on Windows, try running <code>&lt;path to Cygwin setup&gt;/setup-x86_64 -q -P autoconf</code>.</li>
</ul> </ul>
@ -688,6 +697,15 @@ ls build/linux-aarch64-normal-server-release/</code></pre>
<p>Additional architectures might be supported by Debian/Ubuntu Ports.</p> <p>Additional architectures might be supported by Debian/Ubuntu Ports.</p>
<h3 id="building-for-armaarch64">Building for ARM/aarch64</h3> <h3 id="building-for-armaarch64">Building for ARM/aarch64</h3>
<p>A common cross-compilation target is the ARM CPU. When building for ARM, it is useful to set the ABI profile. A number of pre-defined ABI profiles are available using <code>--with-abi-profile</code>: arm-vfp-sflt, arm-vfp-hflt, arm-sflt, armv5-vfp-sflt, armv6-vfp-hflt. Note that soft-float ABIs are no longer properly supported by the JDK.</p> <p>A common cross-compilation target is the ARM CPU. When building for ARM, it is useful to set the ABI profile. A number of pre-defined ABI profiles are available using <code>--with-abi-profile</code>: arm-vfp-sflt, arm-vfp-hflt, arm-sflt, armv5-vfp-sflt, armv6-vfp-hflt. Note that soft-float ABIs are no longer properly supported by the JDK.</p>
<h3 id="building-for-musl">Building for musl</h3>
<p>Just like it's possible to cross-compile for a different CPU, it's possible to cross-compile for musl libc on a glibc-based <em>build</em> system. A devkit suitable for most target CPU architectures can be obtained from <a href="https://musl.cc">musl.cc</a>. After installing the required packages in the sysroot, configure the build with <code>--openjdk-target</code>:</p>
<pre><code>sh ./configure --with-jvm-variants=server \
--with-boot-jdk=$BOOT_JDK \
--with-build-jdk=$BUILD_JDK \
--openjdk-target=x86_64-unknown-linux-musl \
--with-devkit=$DEVKIT \
--with-sysroot=$SYSROOT</code></pre>
<p>and run <code>make</code> normally.</p>
<h3 id="verifying-the-build">Verifying the Build</h3> <h3 id="verifying-the-build">Verifying the Build</h3>
<p>The build will end up in a directory named like <code>build/linux-arm-normal-server-release</code>.</p> <p>The build will end up in a directory named like <code>build/linux-arm-normal-server-release</code>.</p>
<p>Inside this build output directory, the <code>images/jdk</code> will contain the newly built JDK, for your <em>target</em> system.</p> <p>Inside this build output directory, the <code>images/jdk</code> will contain the newly built JDK, for your <em>target</em> system.</p>

View File

@ -273,6 +273,13 @@ For rpm-based distributions (Fedora, Red Hat, etc), try this:
sudo yum groupinstall "Development Tools" sudo yum groupinstall "Development Tools"
``` ```
For Alpine Linux, aside from basic tooling, install the GNU versions of some
programs:
```
sudo apk add build-base bash grep zip
```
### AIX ### AIX
Please consult the AIX section of the [Supported Build Platforms]( Please consult the AIX section of the [Supported Build Platforms](
@ -431,6 +438,7 @@ rather than bundling the JDK's own copy.
libfreetype6-dev`. libfreetype6-dev`.
* To install on an rpm-based Linux, try running `sudo yum install * To install on an rpm-based Linux, try running `sudo yum install
freetype-devel`. freetype-devel`.
* To install on Alpine Linux, try running `sudo apk add freetype-dev`.
Use `--with-freetype-include=<path>` and `--with-freetype-lib=<path>` Use `--with-freetype-include=<path>` and `--with-freetype-lib=<path>`
if `configure` does not automatically locate the platform FreeType files. if `configure` does not automatically locate the platform FreeType files.
@ -445,6 +453,7 @@ your operating system.
libcups2-dev`. libcups2-dev`.
* To install on an rpm-based Linux, try running `sudo yum install * To install on an rpm-based Linux, try running `sudo yum install
cups-devel`. cups-devel`.
* To install on Alpine Linux, try running `sudo apk add cups-dev`.
Use `--with-cups=<path>` if `configure` does not properly locate your CUPS Use `--with-cups=<path>` if `configure` does not properly locate your CUPS
files. files.
@ -458,6 +467,8 @@ Linux.
libx11-dev libxext-dev libxrender-dev libxrandr-dev libxtst-dev libxt-dev`. libx11-dev libxext-dev libxrender-dev libxrandr-dev libxtst-dev libxt-dev`.
* To install on an rpm-based Linux, try running `sudo yum install * To install on an rpm-based Linux, try running `sudo yum install
libXtst-devel libXt-devel libXrender-devel libXrandr-devel libXi-devel`. libXtst-devel libXt-devel libXrender-devel libXrandr-devel libXi-devel`.
* To install on Alpine Linux, try running `sudo apk add libx11-dev
libxext-dev libxrender-dev libxrandr-dev libxtst-dev libxt-dev`.
Use `--with-x=<path>` if `configure` does not properly locate your X11 files. Use `--with-x=<path>` if `configure` does not properly locate your X11 files.
@ -470,6 +481,7 @@ required on Linux. At least version 0.9.1 of ALSA is required.
libasound2-dev`. libasound2-dev`.
* To install on an rpm-based Linux, try running `sudo yum install * To install on an rpm-based Linux, try running `sudo yum install
alsa-lib-devel`. alsa-lib-devel`.
* To install on Alpine Linux, try running `sudo apk add alsa-lib-dev`.
Use `--with-alsa=<path>` if `configure` does not properly locate your ALSA Use `--with-alsa=<path>` if `configure` does not properly locate your ALSA
files. files.
@ -484,6 +496,7 @@ Hotspot.
libffi-dev`. libffi-dev`.
* To install on an rpm-based Linux, try running `sudo yum install * To install on an rpm-based Linux, try running `sudo yum install
libffi-devel`. libffi-devel`.
* To install on Alpine Linux, try running `sudo apk add libffi-dev`.
Use `--with-libffi=<path>` if `configure` does not properly locate your libffi Use `--with-libffi=<path>` if `configure` does not properly locate your libffi
files. files.
@ -499,6 +512,7 @@ platforms. At least version 2.69 is required.
autoconf`. autoconf`.
* To install on an rpm-based Linux, try running `sudo yum install * To install on an rpm-based Linux, try running `sudo yum install
autoconf`. autoconf`.
* To install on Alpine Linux, try running `sudo apk add autoconf`.
* To install on macOS, try running `brew install autoconf`. * To install on macOS, try running `brew install autoconf`.
* To install on Windows, try running `<path to Cygwin setup>/setup-x86_64 -q * To install on Windows, try running `<path to Cygwin setup>/setup-x86_64 -q
-P autoconf`. -P autoconf`.
@ -1113,6 +1127,25 @@ available using `--with-abi-profile`: arm-vfp-sflt, arm-vfp-hflt, arm-sflt,
armv5-vfp-sflt, armv6-vfp-hflt. Note that soft-float ABIs are no longer armv5-vfp-sflt, armv6-vfp-hflt. Note that soft-float ABIs are no longer
properly supported by the JDK. properly supported by the JDK.
### Building for musl
Just like it's possible to cross-compile for a different CPU, it's possible to
cross-compile for musl libc on a glibc-based *build* system.
A devkit suitable for most target CPU architectures can be obtained from
[musl.cc](https://musl.cc). After installing the required packages in the
sysroot, configure the build with `--openjdk-target`:
```
sh ./configure --with-jvm-variants=server \
--with-boot-jdk=$BOOT_JDK \
--with-build-jdk=$BUILD_JDK \
--openjdk-target=x86_64-unknown-linux-musl \
--with-devkit=$DEVKIT \
--with-sysroot=$SYSROOT
```
and run `make` normally.
### Verifying the Build ### Verifying the Build
The build will end up in a directory named like The build will end up in a directory named like