Archive for March, 2014

Gentoo Oracle JDK on ARM

Mar 19 2014 Published by under Linux

Installing a JDK on ARM has several challenges. First, there is no binary icedtea for ARM. Second, building icedtea generates circular build time dependencies.
On my first attempt, I just ran the following commands:

emerge --autounmask-write virtual/jdk
dispatch-conf
emerge virtual/jdk

However, it soon met an error:

(controller) sabre2 ~ # cat /var/tmp/portage/dev-java/icedtea-bin-6.1.12.6-r1/temp/build.log
 * Package:    dev-java/icedtea-bin-6.1.12.6-r1
 * Repository: gentoo
 * Maintainer: java@gentoo.org
 * USE:        alsa arm elibc_glibc kernel_linux userland_GNU
 * FEATURES:   preserve-libs sandbox userpriv usersandbox
>>> Unpacking source...
 * ERROR: dev-java/icedtea-bin-6.1.12.6-r1::gentoo failed (unpack phase):
 *   Nothing passed to the 'unpack' command
 *
 * Call stack:
 *          ebuild.sh, line   93:  Called src_unpack
 *        environment, line 2546:  Called unpack
 *   phase-helpers.sh, line  291:  Called die
 * The specific snippet of code:
 *      [ -z "$*" ] && die "Nothing passed to the 'unpack' command"
 *
 * If you need support, post the output of `emerge --info '=dev-java/icedtea-bin-6.1.12.6-r1::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=dev-java/icedtea-bin-6.1.12.6-r1::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/dev-java/icedtea-bin-6.1.12.6-r1/temp/build.log'.
 * The ebuild environment file is located at '/var/tmp/portage/dev-java/icedtea-bin-6.1.12.6-r1/temp/environment'.
 * Working directory: '/var/tmp/portage/dev-java/icedtea-bin-6.1.12.6-r1/work'
 * S: '/var/tmp/portage/dev-java/icedtea-bin-6.1.12.6-r1/work/icedtea-bin-6.1.12.6'

Later, when I checked on gentoo-packages, it didn’t have an arm ebuild. Oracle has hardfloat and softfloat binary JDKs for ARM, so I went on to install them. They can be used to bootstrap an icedtea build.

# emerge -av dev-java/oracle-jdk-bin

 * IMPORTANT: 1 news items need reading for repository 'gentoo'.
 * Use eselect news to read news items.

 * Last emerge --sync was 92d 19h 31m 27s ago.

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild  N     ] media-fonts/dejavu-2.33  USE="-X -fontforge" 4,767 kB
[ebuild  N     ] media-libs/freetype-2.4.11:2  USE="bindist bzip2 -X -auto-hinter -debug -doc -fontforge (-infinality) -static-libs -utils" 1,510 kB
[ebuild  N     ] virtual/ttf-fonts-1  0 kB
[ebuild  N     ] media-libs/fontconfig-2.10.92:1.0  USE="-doc -static-libs" 1,490 kB
[ebuild  N     ] app-admin/eselect-fontconfig-1.0  0 kB
[ebuild  N F  *] dev-java/oracle-jdk-bin-1.7.0.40:1.7  USE="fontconfig -X -alsa
-derby -doc -examples -jce -nsplugin -pax_kernel -source" 138,494 kB

Total: 6 packages (6 new), Size of downloads: 146,260 kB
Fetch Restriction: 1 package (1 unsatisfied)

Fetch instructions for dev-java/oracle-jdk-bin-1.7.0.40:
 *
 * Oracle requires you to download the needed files manually after
 * accepting their license through a javascript capable web browser.
 *
 * Download the following files:
 *   jdk-7u40-linux-arm-vfp-sflt.tar.gz
 *   jdk-7u40-linux-arm-vfp-hflt.tar.gz
 * at 'http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html'
 * and move them to '/distfiles'
 *

The following keyword changes are necessary to proceed:
 (see "package.accept_keywords" in the portage(5) man page for more details)
# required by dev-java/oracle-jdk-bin (argument)
=dev-java/oracle-jdk-bin-1.7.0.40 **

The following license changes are necessary to proceed:
 (see "package.license" in the portage(5) man page for more details)
# required by dev-java/oracle-jdk-bin (argument)
>=dev-java/oracle-jdk-bin-1.7.0.40 Oracle-BCLA-JavaSE

NOTE: The --autounmask-keep-masks option will prevent emerge
      from creating package.unmask or ** keyword changes.

Use --autounmask-write to write changes to config files (honoring
CONFIG_PROTECT). Carefully examine the list of proposed changes,
paying special attention to mask or keyword changes that may expose
experimental or unstable packages.

You may not have a browser installed on your ARM board, so I suggest just uploading the Oracle tarballs to a server and using wget to download them.
To fix the control panel error when you don’t have a desktop environment installed, you need to remove lines from the ebuild and digest it.

vim /usr/portage/dev-java/oracle-jdk-bin/oracle-jdk-bin-1.7.0.40.ebuild

These lines need to be removed:

    newicon jre/lib/desktop/icons/hicolor/48x48/apps/sun-jcontrol.png \
        sun-jcontrol-${PN}-${SLOT}.png || die
    sed -e "s#Name=.*#Name=Java Control Panel for Oracle JDK ${SLOT}#" \
        -e "s#Exec=.*#Exec=/opt/${P}/jre/bin/jcontrol#" \
        -e "s#Icon=.*#Icon=sun-jcontrol-${PN}-${SLOT}#" \
        -e "s#Application;##" \
        -e "/Encoding/d" \
        jre/lib/desktop/applications/sun_java.desktop \
        > "${T}"/jcontrol-${PN}-${SLOT}.desktop || die
    domenu "${T}"/jcontrol-${PN}-${SLOT}.desktop

Once removed, generate the manifest for it.

ebuild /usr/portage/dev-java/oracle-jdk-bin/oracle-jdk-bin-1.7.0.40.ebuild digest

If you run emerge dev-java/oracle-jdk-bin, it will succeed.

No responses yet