Difference between pages "Cross-compiling with Crossdev" and "Package:Java SE Development Kit (JDK)"

(Difference between pages)
m (tiny edit; great that it's approved, can we get it on the HOW-TO index, I can't edit that)
 
(Updated the install information. Will add information on how to use the jdk later....)
 
Line 1: Line 1:
== Introduction ==
+
{{Ebuild
Crossdev is a great feature of Funtoo that allows you to easily make a basic toolchain for your embedded devices and alternate platform computers. It can be used for distcc for example, so a slow x86 or ARM computer can be assisted on compiles by a much faster x86_64 computer(s). Some, but not all, packages can also be compiled stand-alone without distcc on the faster machine. You can also use the faster 64 bit machine to make kernels for these slower machines, a big advantage.
+
|Summary=Oracle's Java SE Development Kit -- Java runtime, compiler, etc.
 +
|CatPkg=dev-java/oracle-jdk-bin
 +
|Maintainer=
 +
|Homepage=http://www.oracle.com/technetwork/java/javase/overview/index.html
 +
}}
 +
You can install the free icedtea jdk or Oracle's version.
 +
Therefore we have a virtual package called ''virtual/jdk''. By default it will install the Oracle version.
  
This is quite a big subject and the aim of this article is mainly to help new users with some Funtoo specific things relating to cross-compiling that are unique to Funtoo.  So we won't waste time here on things that are covered elsewhere, only those specific things.
+
== Installation ==
== Let's get started! ==
+
The first step is to install crossdev.  Crossdev is written by Mike Frysinger who is quite a busy fellow and does a superb job.  But occasionally there are little hiccups with crossdev.  If ever you are having a problem with crossdev it doesn't hurt to try downgrading to previous versions.  I say this because on the date this article is written, 11-1-14, there are issues with the two latest versions of crossdev - 20140917 and 20141030 (see https://bugs.funtoo.org/browse/FL-1703).  But version 20140729 works flawlessly.  I have seen this happen from time to time, nothing to worry about.
+
 
<console>
 
<console>
###i## emerge -av crossdev
+
###i## emerge -a virtual/jdk
 
</console>
 
</console>
== Funtoo Specific Considerations ==
 
The most important thing to understand is that Funtoo gcc ebuilds are different from Gentoo ebuilds.  This is because Daniel Robbins has made improvements to gcc to help with general usage.  Unfortunately, a side effect has been that they no longer work with crossdev.  But not to worry, there is an easy way around this issue and my understanding is that Funtoo intends to rectify it at a later date.
 
  
Another issue is that you cannot have a toolchain with exactly the same minor number as the current gcc on your system. You must use an ebuild of a slightly different vintageI believe this issue occurs for Gentoo users alsoFor example, at the present time Funtoo current uses sys-devel/gcc-4.8.2-r3So you could use gcc-4.8.1, or 4.8.0 but not any version of 4.8.2 (the revision -rx doesn't matter, can't do it). If you try to do that gcc will compile and then fail in the installation phase due to file collisions. In some cases with embedded devices you may wish to use much older versions, in which case this becomes a moot point.
+
If you receive a message similar to the following, you will have to accept the Oracle java license to emerge the <code>oracle-jdk-bin</code>:
 +
<console>
 +
###i## emerge virtual/jdk
 +
Calculating dependencies... done!
 +
[##g##ebuild N    ##!g##] ##g##dev-java/java-config-wrapper-0.16 ##!g##
 +
[##g##ebuild N    ##!g##] ##g##sys-apps/baselayout-java-0.1.0 ##!g##
 +
[##g##ebuild  N    ##!g##] ##g##app-admin/eselect-java-0.1.0 ##!g##
 +
[##g##ebuild N    ##!g##] ##g##dev-java/java-config-2.2.0-r1000  ##!g## PYTHON_ABIS="##r##2.7 3.3##!r## ##bl##-2.6 -3.1 -3.2 -3.4 (-3.5)##!bl##"
 +
[##g##ebuild N    ##!g##] ##g##dev-java/oracle-jdk-bin-1.8.0.11 ##!g## USE="##r##X alsa fontconfig nsplugin##!r## ##bl##(-aqua) -derby -doc -examples -jce -pax_kernel (-selinux) -source##!bl##"
  
Finally, a general issue with using crossdev with any distro is that you must sometimes juggle the various versions of binutils, gcc, glibc and linux-headers so that they are compatible with one another.  This is the easiest problem to deal with, just use versions of the same time vintage, in extreme cases you may need to start changing revisions to get all of them to compile.
+
The following ##r##license changes##!r## are necessary to proceed:
 +
(see "package.license" in the portage(5) man page for more details)
 +
# required by oracle-jdk-bin (argument)
 +
##g##>=dev-java/oracle-jdk-bin-1.8.0.11 Oracle-BCLA-JavaS##!g##
 +
</console>
  
That's it, that's what you need to know.
+
To accept the required license, create the directory <code>/etc/portage/package.license</code> if it does not already exist.  
== GCC Ebuilds ==
+
The workaround to make gcc compile is to use Gentoo gcc ebuilds.  They are readily available at the Gentoo attic: http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/?hid
+
Going back historically for as far as you'd ever need.  Go to the sys-devel/gcc folder and right click on a version and copy the link.  I suggest a version that isn't even in the Funtoo tree, then there is no ambiguity about what is being used.
+
Next copy it to your local repository, we'll assume /usr/local/portage here. So if you haven't already got a sys-devel/gcc directory there you could do
+
 
<console>
 
<console>
###i## install -d /usr/local/portage/sys-devel/gcc
+
###i## mkdir /etc/portage/package.license
 
</console>
 
</console>
Now go to that directory in your terminal and wget <the link you copied>.  At the end will be some fluff you don't want, delete all the way back to the word .ebuild and hit enter.  In a second or so you'll have that ebuild in your repository.
+
 
If you haven't done this before you'll need to link the files directory from the tree, so that it can find patches, etc.  So do this
+
After we create this directory, portage will read files that we create inside of it to see that we have accepted licenses required to install certain packages. To accept the license for <code>oracle-jdk-bin</code>, create a file called something like <code>/etc/portage/package.license/oracle-jdk-bin</code> and add the line <code>dev-java/oracle-jdk-bin Oracle-BCLA-JavaS</code> to it:
 
<console>
 
<console>
###i## ln -s /usr/portage/sys-devel/gcc/files .
+
###i## tee /etc/portage/package.license/oracle-jdk-bin <<< "dev-java/oracle-jdk-bin Oracle-BCLA-JavaS"
 
</console>
 
</console>
Finally you must create the manifest
+
 
 +
Now you can emerge <code>oracle-jdk-bin</code>
 
<console>
 
<console>
###i## ebuild gcc-<version>.ebuild manifest
+
###i## emerge virtual/jdk
 
</console>
 
</console>
And now you are ready!
 
== Really, that's it? ==
 
Yes.  Well, one other thing that you may need to do, if you've chosen a gcc version that is in the Funtoo tree, crossdev may get confused and try to install the tree version.  At the beginning of the crossdev run it creates links in the crossdev repository, most people will just want this to be their local repository.  So you can let crossdev run for a few seconds to create those links and then cancel it with ctl-c.  Then go to the crossdev repository and delete the gcc link and replace it with a link to /usr/local/portage/sys-devel/gcc.  Here's an example in my local repository:
 
<console>
 
###i## ls -l /usr/local/portage/cross-avr
 
total 0
 
lrwxrwxrwx 1 root root 50 Nov  1 00:41 avr-libc ->/usr/portage/dev-embedded/avr-libc
 
lrwxrwxrwx 1 root root 47 Nov  1 00:41 binutils -> /usr/portage/sys-devel/binutils
 
##g##lrwxrwxrwx 1 root root 32 Nov  1 00:41 gcc -> /usr/local/portage/sys-devel/gcc##!g##
 
lrwxrwxrwx 1 root root 42 Nov  1 00:41 gdb -> /usr/portage/sys-devel/gdb
 
</console>
 
Note that the link for gcc is different from the others, which point to the normal Funtoo Portage tree, it points to my local repository, where the Gentoo ebuilds are stored.  Most of the time also you would be linked to sys-libs/glibc, avr-libc is a bit unusual but normal for avr cross toolchains.
 
 
Once the link is fixed (if it even needed fixing), just hit your up arrow to get the same crossdev command line again and let it run through this time.  You'll be rewarded with a shiny new cross toolchain at the end..
 
 
Of course, there is a bit more to making a cross toolchain, but as stated at the beginning of this article, only the unique differences for Funtoo are shown here.
 
You should find nearly all the rest you need to know at https://www.gentoo.org/proj/en/base/embedded/handbook/cross-compiler.xml?style=printable.  Only the top 1/4 page is needed.
 
  
One note, at the current time (11-1-14) you need to preface your crossdev command line statement with USE="-sanitize". This is a known bug (not Funtoo specific) that will soon be fixed in crossdev.  You will find -sanitize in the package.use files, but you still must do it on the command line, else gcc will fail.  For example the following command line was successful for me today
+
After the installation finishes, you may want to check and see if you can use the jdk. You can do so by issuing the following command:
 
<console>
 
<console>
###i## USE="-sanitize" crossdev --binutils 2.23-2 --g 4.8.1-r1 --l 1.8.0 -t avr -P -v
+
$##i## java
 
</console>
 
</console>
 +
{{PageNeedsUpdates}}
 +
{{EbuildFooter}}

Revision as of 19:11, November 2, 2014

dev-java/oracle-jdk-bin


Source Repository:Funtoo Overlay
Homepage

Summary: Oracle's Java SE Development Kit -- Java runtime, compiler, etc.

Use Flags

derby
Enable Installation of Bundled Derby (Java DB)
jce
Enable Java Cryptographic Extension Unlimited Strength Policy files
pax_kernel
Use paxctl to mark the JVM binaries.

Java SE Development Kit (JDK)

You can install the free icedtea jdk or Oracle's version. Therefore we have a virtual package called virtual/jdk. By default it will install the Oracle version.

Installation

# emerge -a virtual/jdk

If you receive a message similar to the following, you will have to accept the Oracle java license to emerge the oracle-jdk-bin:

# emerge virtual/jdk
Calculating dependencies... done!
[ebuild  N     ] dev-java/java-config-wrapper-0.16 
[ebuild  N     ] sys-apps/baselayout-java-0.1.0 
[ebuild  N     ] app-admin/eselect-java-0.1.0 
[ebuild  N     ] dev-java/java-config-2.2.0-r1000   PYTHON_ABIS="2.7 3.3 -2.6 -3.1 -3.2 -3.4 (-3.5)" 
[ebuild  N     ] dev-java/oracle-jdk-bin-1.8.0.11  USE="X alsa fontconfig nsplugin (-aqua) -derby -doc -examples -jce -pax_kernel (-selinux) -source" 

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

To accept the required license, create the directory /etc/portage/package.license if it does not already exist.

# mkdir /etc/portage/package.license

After we create this directory, portage will read files that we create inside of it to see that we have accepted licenses required to install certain packages. To accept the license for oracle-jdk-bin, create a file called something like /etc/portage/package.license/oracle-jdk-bin and add the line dev-java/oracle-jdk-bin Oracle-BCLA-JavaS to it:

# tee /etc/portage/package.license/oracle-jdk-bin <<< "dev-java/oracle-jdk-bin Oracle-BCLA-JavaS"

Now you can emerge oracle-jdk-bin

# emerge virtual/jdk

After the installation finishes, you may want to check and see if you can use the jdk. You can do so by issuing the following command:

$ java

Important

This page is in need of updates.