diff --git a/doc/building.html b/doc/building.html index 4d5cdf67c3a..022b1d94899 100644 --- a/doc/building.html +++ b/doc/building.html @@ -76,7 +76,7 @@
If the X11 libraries are not properly detected by configure
, you can point them out by --with-x
.
Fortunately, you can create sysroots for foreign architectures with tools provided by your OS. On Debian/Ubuntu systems, one could use qemu-deboostrap
to create the target system chroot, which would have the native libraries and headers specific to that target system. After that, we can use the cross-compiler on the build system, pointing into chroot to get the build dependencies right. This allows building for foreign architectures with native compilation speed.
For example, cross-compiling to AArch64 from x86_64 could be done like this:
sudo qemu-debootstrap \
--arch=arm64 \
--verbose \
- --include=fakeroot,symlinks,build-essential,libx11-dev,libxext-dev,libxrender-dev,libxrandr-dev,libxtst-dev,libxt-dev,libcups2-dev,libfontconfig1-dev,libasound2-dev,libfreetype6-dev,libpng-dev \
+ --include=fakeroot,symlinks,build-essential,libx11-dev,libxext-dev,libxrender-dev,libxrandr-dev,libxtst-dev,libxt-dev,libcups2-dev,libfontconfig1-dev,libasound2-dev,libfreetype6-dev,libpng-dev,libffi-dev \
--resolve-deps \
buster \
~/sysroot-arm64 \
@@ -646,67 +646,125 @@ cp: cannot stat `arm-linux-gnueabihf/libXt.so': No such file or directoryMake sure the symlinks inside the newly created chroot point to proper locations:
sudo chroot ~/sysroot-arm64 symlinks -cr .
Configure and build with newly created chroot as sysroot/toolchain-path:
-CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ sh ./configure \
- --openjdk-target=aarch64-linux-gnu \
- --with-sysroot=~/sysroot-arm64 \
- --with-toolchain-path=~/sysroot-arm64 \
- --with-freetype-lib=~/sysroot-arm64/usr/lib/aarch64-linux-gnu/ \
- --with-freetype-include=~/sysroot-arm64/usr/include/freetype2/ \
- --x-libraries=~/sysroot-arm64/usr/lib/aarch64-linux-gnu/
+sh ./configure \
+ --openjdk-target=aarch64-linux-gnu \
+ --with-sysroot=~/sysroot-arm64
make images
ls build/linux-aarch64-server-release/
The build does not create new files in that chroot, so it can be reused for multiple builds without additional cleanup.
+The build system should automatically detect the toolchain paths and dependencies, but sometimes it might require a little nudge with:
+Native compilers: override CC
or CXX
for ./configure
Freetype lib location: override --with-freetype-lib
, for example ${sysroot}/usr/lib/${target}/
Freetype includes location: override --with-freetype-include
for example ${sysroot}/usr/include/freetype2/
X11 libraries location: override --x-libraries
, for example ${sysroot}/usr/lib/${target}/
Architectures that are known to successfully cross-compile like this are:
Target | -CC |
-CXX |
---arch=... |
+Debian tree | +Debian arch | --openjdk-target=... |
+--with-jvm-variants=... |
---|---|---|---|---|---|---|---|
x86 | -default | -default | +buster | i386 | i386-linux-gnu | +(all) | |
armhf | -gcc-arm-linux-gnueabihf | -g++-arm-linux-gnueabihf | +arm | +buster | armhf | arm-linux-gnueabihf | +(all) |
aarch64 | -gcc-aarch64-linux-gnu | -g++-aarch64-linux-gnu | +buster | arm64 | aarch64-linux-gnu | +(all) | |
ppc64el | -gcc-powerpc64le-linux-gnu | -g++-powerpc64le-linux-gnu | +ppc64le | +buster | ppc64el | powerpc64le-linux-gnu | +(all) |
s390x | -gcc-s390x-linux-gnu | -g++-s390x-linux-gnu | +buster | s390x | s390x-linux-gnu | +(all) | +|
mipsle | +buster | +mipsel | +mipsel-linux-gnu | +zero | +|||
mips64le | +buster | +mips64el | +mips64el-linux-gnueabi64 | +zero | +|||
armel | +buster | +arm | +arm-linux-gnueabi | +zero | +|||
ppc | +sid | +powerpc | +powerpc-linux-gnu | +zero | +|||
ppc64be | +sid | +ppc64 | +powerpc64-linux-gnu | +(all) | +|||
m68k | +sid | +m68k | +m68k-linux-gnu | +zero | +|||
alpha | +sid | +alpha | +alpha-linux-gnu | +zero | +|||
sh4 | +sid | +sh4 | +sh4-linux-gnu | +zero |
Additional architectures might be supported by Debian/Ubuntu Ports.
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 --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.