{"id":1359,"date":"2014-03-19T14:04:33","date_gmt":"2014-03-19T18:04:33","guid":{"rendered":"http:\/\/yuguangzhang.com\/blog\/?p=1359"},"modified":"2014-03-19T14:04:33","modified_gmt":"2014-03-19T18:04:33","slug":"gentoo-oracle-jdk-on-arm","status":"publish","type":"post","link":"http:\/\/yuguangzhang.com\/blog\/gentoo-oracle-jdk-on-arm\/","title":{"rendered":"Gentoo Oracle JDK on ARM"},"content":{"rendered":"<p>Installing a JDK on ARM has several challenges. First, there is no binary icedtea for ARM. Second, building icedtea generates circular build time dependencies.<br \/>\nOn my first attempt, I just ran the following commands:<br \/>\n<code>emerge --autounmask-write virtual\/jdk<br \/>\ndispatch-conf<br \/>\nemerge virtual\/jdk<\/code><br \/>\nHowever, it soon met an error:<br \/>\n<code><br \/>\n(controller) sabre2 ~ # cat \/var\/tmp\/portage\/dev-java\/icedtea-bin-6.1.12.6-r1\/temp\/build.log<br \/>\n * Package:    dev-java\/icedtea-bin-6.1.12.6-r1<br \/>\n * Repository: gentoo<br \/>\n * Maintainer: java@gentoo.org<br \/>\n * USE:        alsa arm elibc_glibc kernel_linux userland_GNU<br \/>\n * FEATURES:   preserve-libs sandbox userpriv usersandbox<br \/>\n>>> Unpacking source...<br \/>\n * ERROR: dev-java\/icedtea-bin-6.1.12.6-r1::gentoo failed (unpack phase):<br \/>\n *   Nothing passed to the 'unpack' command<br \/>\n *<br \/>\n * Call stack:<br \/>\n *          ebuild.sh, line   93:  Called src_unpack<br \/>\n *        environment, line 2546:  Called unpack<br \/>\n *   phase-helpers.sh, line  291:  Called die<br \/>\n * The specific snippet of code:<br \/>\n *      [ -z \"$*\" ] && die \"Nothing passed to the 'unpack' command\"<br \/>\n *<br \/>\n * If you need support, post the output of `emerge --info '=dev-java\/icedtea-bin-6.1.12.6-r1::gentoo'`,<br \/>\n * the complete build log and the output of `emerge -pqv '=dev-java\/icedtea-bin-6.1.12.6-r1::gentoo'`.<br \/>\n * The complete build log is located at '\/var\/tmp\/portage\/dev-java\/icedtea-bin-6.1.12.6-r1\/temp\/build.log'.<br \/>\n * The ebuild environment file is located at '\/var\/tmp\/portage\/dev-java\/icedtea-bin-6.1.12.6-r1\/temp\/environment'.<br \/>\n * Working directory: '\/var\/tmp\/portage\/dev-java\/icedtea-bin-6.1.12.6-r1\/work'<br \/>\n * S: '\/var\/tmp\/portage\/dev-java\/icedtea-bin-6.1.12.6-r1\/work\/icedtea-bin-6.1.12.6'<br \/>\n<\/code><br \/>\nLater, <a href=\"http:\/\/web.archive.org\/web\/20130731010904\/http:\/\/packages.gentoo.org\/package\/dev-java\/icedtea-bin\">when I checked on gentoo-packages, it didn&#8217;t have an arm ebuild<\/a>. <a href=\"http:\/\/www.oracle.com\/technetwork\/java\/javase\/downloads\/jdk7-downloads-1880260.html\">Oracle has hardfloat and softfloat binary JDKs for ARM<\/a>, so I went on to install them. They can be used to bootstrap an icedtea build.<br \/>\n<code><br \/>\n# emerge -av dev-java\/oracle-jdk-bin<\/p>\n<p> * IMPORTANT: 1 news items need reading for repository 'gentoo'.<br \/>\n * Use eselect news to read news items.<\/p>\n<p> * Last emerge --sync was 92d 19h 31m 27s ago.<\/p>\n<p>These are the packages that would be merged, in order:<\/p>\n<p>Calculating dependencies... done!<br \/>\n[ebuild  N     ] media-fonts\/dejavu-2.33  USE=\"-X -fontforge\" 4,767 kB<br \/>\n[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<br \/>\n[ebuild  N     ] virtual\/ttf-fonts-1  0 kB<br \/>\n[ebuild  N     ] media-libs\/fontconfig-2.10.92:1.0  USE=\"-doc -static-libs\" 1,490 kB<br \/>\n[ebuild  N     ] app-admin\/eselect-fontconfig-1.0  0 kB<br \/>\n[ebuild  N F  *] dev-java\/oracle-jdk-bin-1.7.0.40:1.7  USE=\"fontconfig -X -alsa<br \/>\n-derby -doc -examples -jce -nsplugin -pax_kernel -source\" 138,494 kB<\/p>\n<p>Total: 6 packages (6 new), Size of downloads: 146,260 kB<br \/>\nFetch Restriction: 1 package (1 unsatisfied)<\/p>\n<p>Fetch instructions for dev-java\/oracle-jdk-bin-1.7.0.40:<br \/>\n *<br \/>\n * Oracle requires you to download the needed files manually after<br \/>\n * accepting their license through a javascript capable web browser.<br \/>\n *<br \/>\n * Download the following files:<br \/>\n *   jdk-7u40-linux-arm-vfp-sflt.tar.gz<br \/>\n *   jdk-7u40-linux-arm-vfp-hflt.tar.gz<br \/>\n * at 'http:\/\/www.oracle.com\/technetwork\/java\/javase\/downloads\/jdk7-downloads-1880260.html'<br \/>\n * and move them to '\/distfiles'<br \/>\n *<\/p>\n<p>The following keyword changes are necessary to proceed:<br \/>\n (see \"package.accept_keywords\" in the portage(5) man page for more details)<br \/>\n# required by dev-java\/oracle-jdk-bin (argument)<br \/>\n=dev-java\/oracle-jdk-bin-1.7.0.40 **<\/p>\n<p>The following license changes are necessary to proceed:<br \/>\n (see \"package.license\" in the portage(5) man page for more details)<br \/>\n# required by dev-java\/oracle-jdk-bin (argument)<br \/>\n>=dev-java\/oracle-jdk-bin-1.7.0.40 Oracle-BCLA-JavaSE<\/p>\n<p>NOTE: The --autounmask-keep-masks option will prevent emerge<br \/>\n      from creating package.unmask or ** keyword changes.<\/p>\n<p>Use --autounmask-write to write changes to config files (honoring<br \/>\nCONFIG_PROTECT). Carefully examine the list of proposed changes,<br \/>\npaying special attention to mask or keyword changes that may expose<br \/>\nexperimental or unstable packages.<br \/>\n<\/code><br \/>\nYou may not have a browser installed on your ARM board, so I suggest just uploading the Oracle tarballs to a server and using <tt>wget<\/tt> to download them.<br \/>\nTo fix <a href=\"http:\/\/bugs.funtoo.org\/browse\/FL-480\">the control panel error<\/a> when you don&#8217;t have a desktop environment installed, you need to remove lines from the ebuild and digest it.<br \/>\n<code><br \/>\nvim \/usr\/portage\/dev-java\/oracle-jdk-bin\/oracle-jdk-bin-1.7.0.40.ebuild<br \/>\n<\/code><br \/>\nThese lines need to be removed:<br \/>\n<code>    newicon jre\/lib\/desktop\/icons\/hicolor\/48x48\/apps\/sun-jcontrol.png \\<br \/>\n        sun-jcontrol-${PN}-${SLOT}.png || die<br \/>\n    sed -e \"s#Name=.*#Name=Java Control Panel for Oracle JDK ${SLOT}#\" \\<br \/>\n        -e \"s#Exec=.*#Exec=\/opt\/${P}\/jre\/bin\/jcontrol#\" \\<br \/>\n        -e \"s#Icon=.*#Icon=sun-jcontrol-${PN}-${SLOT}#\" \\<br \/>\n        -e \"s#Application;##\" \\<br \/>\n        -e \"\/Encoding\/d\" \\<br \/>\n        jre\/lib\/desktop\/applications\/sun_java.desktop \\<br \/>\n        > \"${T}\"\/jcontrol-${PN}-${SLOT}.desktop || die<br \/>\n    domenu \"${T}\"\/jcontrol-${PN}-${SLOT}.desktop<br \/>\n<\/code><br \/>\nOnce removed, generate the manifest for it.<br \/>\n<code>ebuild \/usr\/portage\/dev-java\/oracle-jdk-bin\/oracle-jdk-bin-1.7.0.40.ebuild digest<\/code><br \/>\nIf you run <tt>emerge dev-java\/oracle-jdk-bin<\/tt>, it will succeed. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 &#8211;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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","footnotes":""},"categories":[5],"tags":[208,104,209],"class_list":["post-1359","post","type-post","status-publish","format-standard","hentry","category-linux","tag-arm","tag-gentoo","tag-java"],"aioseo_notices":[],"_links":{"self":[{"href":"http:\/\/yuguangzhang.com\/blog\/wp-json\/wp\/v2\/posts\/1359","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/yuguangzhang.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/yuguangzhang.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/yuguangzhang.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/yuguangzhang.com\/blog\/wp-json\/wp\/v2\/comments?post=1359"}],"version-history":[{"count":0,"href":"http:\/\/yuguangzhang.com\/blog\/wp-json\/wp\/v2\/posts\/1359\/revisions"}],"wp:attachment":[{"href":"http:\/\/yuguangzhang.com\/blog\/wp-json\/wp\/v2\/media?parent=1359"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/yuguangzhang.com\/blog\/wp-json\/wp\/v2\/categories?post=1359"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/yuguangzhang.com\/blog\/wp-json\/wp\/v2\/tags?post=1359"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}