Skip to content

Commit

Permalink
8247591: Document Alpine Linux build steps in OpenJDK build guide
Browse files Browse the repository at this point in the history
Co-authored-by: Aleksei Voitylov <[email protected]>
Reviewed-by: erikj
  • Loading branch information
Aleksei Voitylov authored and Alexander Scherbatiy committed Oct 13, 2020
1 parent 63009f9 commit 508c8a9
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
18 changes: 18 additions & 0 deletions doc/building.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ <h1 class="title">Building the JDK</h1>
<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="#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>
</ul></li>
<li><a href="#build-performance">Build Performance</a><ul>
Expand Down Expand Up @@ -224,6 +225,8 @@ <h3 id="linux">Linux</h3>
<pre><code>sudo apt-get install build-essential</code></pre>
<p>For rpm-based distributions (Fedora, Red Hat, etc), try this:</p>
<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>
<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>
Expand Down Expand Up @@ -313,34 +316,39 @@ <h3 id="freetype">FreeType</h3>
<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 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>
<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>
<p>CUPS, <a href="http://www.cups.org">Common UNIX Printing System</a> header files are required on all platforms, except Windows. Often these files are provided by your operating system.</p>
<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 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>
<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>
<p>Certain <a href="http://www.x.org/">X11</a> libraries and include files are required on Linux.</p>
<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 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>
<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>
<p>ALSA, <a href="https://www.alsa-project.org/">Advanced Linux Sound Architecture</a> is required on Linux. At least version 0.9.1 of ALSA is required.</p>
<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 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>
<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>
<p>libffi, the <a href="http://sourceware.org/libffi">Portable Foreign Function Interface Library</a> is required when building the Zero version of Hotspot.</p>
<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 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>
<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>
Expand All @@ -349,6 +357,7 @@ <h3 id="autoconf">Autoconf</h3>
<ul>
<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 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 Windows, try running <code>&lt;path to Cygwin setup&gt;/setup-x86_64 -q -P autoconf</code>.</li>
</ul>
Expand Down Expand Up @@ -688,6 +697,15 @@ <h3 id="creating-and-using-sysroots-with-qemu-deboostrap">Creating And Using Sys
<p>Additional architectures might be supported by Debian/Ubuntu Ports.</p>
<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>
<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>
<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>
Expand Down
33 changes: 33 additions & 0 deletions doc/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,13 @@ For rpm-based distributions (Fedora, Red Hat, etc), try this:
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

Please consult the AIX section of the [Supported Build Platforms](
Expand Down Expand Up @@ -431,6 +438,7 @@ rather than bundling the JDK's own copy.
libfreetype6-dev`.
* To install on an rpm-based Linux, try running `sudo yum install
freetype-devel`.
* To install on Alpine Linux, try running `sudo apk add freetype-dev`.

Use `--with-freetype-include=<path>` and `--with-freetype-lib=<path>`
if `configure` does not automatically locate the platform FreeType files.
Expand All @@ -445,6 +453,7 @@ your operating system.
libcups2-dev`.
* To install on an rpm-based Linux, try running `sudo yum install
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
files.
Expand All @@ -458,6 +467,8 @@ Linux.
libx11-dev libxext-dev libxrender-dev libxrandr-dev libxtst-dev libxt-dev`.
* To install on an rpm-based Linux, try running `sudo yum install
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.

Expand All @@ -470,6 +481,7 @@ required on Linux. At least version 0.9.1 of ALSA is required.
libasound2-dev`.
* To install on an rpm-based Linux, try running `sudo yum install
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
files.
Expand All @@ -484,6 +496,7 @@ Hotspot.
libffi-dev`.
* To install on an rpm-based Linux, try running `sudo yum install
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
files.
Expand All @@ -499,6 +512,7 @@ platforms. At least version 2.69 is required.
autoconf`.
* To install on an rpm-based Linux, try running `sudo yum install
autoconf`.
* To install on Alpine Linux, try running `sudo apk add autoconf`.
* To install on macOS, try running `brew install autoconf`.
* To install on Windows, try running `<path to Cygwin setup>/setup-x86_64 -q
-P autoconf`.
Expand Down Expand Up @@ -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
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
The build will end up in a directory named like
Expand Down

0 comments on commit 508c8a9

Please sign in to comment.