Gentoo and Free Java
Over the last week, I’ve been getting Gentoo and Free Java up and running on my new x86_64 box, a process which has culminated in the creation of my own overlay:
http://fuseyism.com/hg/libre_java_overlay
For those unfamiliar with Gentoo, an overlay is an additional set of packages (known in Gentoo as ebuilds, as for a source-based distribution the packages are essentially build scripts) which can be placed over the top of the main system tree to provide newer/better versions of existing builds and completely new ones too.
The Libre Java overlay includes a build for GCJ 4.3 (adapted from the one for an alpha snapshot in the java-gcj-overlay) and one for IcedTea6. Unfortunately, Gentoo’s Java support seems incredibly broken — the main stable and experimental (~) distributions don’t include OpenJDK or IcedTea, and the stable versions of GNU Classpath and VMs like CACAO and JamVM are ancient. GNU Classpath is still on 0.90, which is older than the one in Debian stable. It also tries to pull in the proprietary JDK by default; I recommend Free Java Gentoo users add:
dev-java/sun-jdk
dev-java/ibm-jdk
dev-java/jrockit
dev-java/diablo
dev-java/sun-jre-bin
dev-java/blackdown-jdk
to package.mask to avoid accidentally installing proprietary software on their machines. Unfortunately, stable versions of portage have yet to honour any license scheming, although it is in the unstable version. If you use Gentoo, feel free to try out the ebuilds from my overlay and give feedback. To use it, just get Mercurial (emerge mercurial), clone the repository:
hg clone http://fuseyism.com/hg/libre_java_overlay
and then add the following to /etc/make.conf:
PORTDIR_OVERLAY=<location you downloaded libre_java_overlay to>
The build process for IcedTea6 is fully documented on the IcedTea wiki.
April 18th, 2008 at 5:48 pm
Your gnu-classpath status is outdated:
betelgeuse@pena /usr/portage/dev-java/gnu-classpath $ eshowkw
Keywords for dev-java/gnu-classpath:
| s |
| p |
| a x |
| r 8 |
| c 6 | u
| a a p s - - | n
| l m h i m m p s p f f | u s
| p d a p a 6 i p c 3 a b x b | s l
| h 6 r p 6 8 p p 6 9 s r s 8 s | e o
| a 4 m a 4 k s c 4 0 h c d 6 d | d t
——–+——————————-+——-
0.90 | + + + + | 0
——–+——————————-+——-
0.92 | ~ ~ ~ ~ | 0.92
——–+——————————-+——-
0.93 | ~ ~ ~ ~ | 0.93
——–+——————————-+——-
0.97 | ~ ~ ~ ~ | * 0.97
0.97-r1 | + ~ ~ + |
April 21st, 2008 at 3:27 pm
I can’t even read that clearly, but it backs up what I said. Only 0.90 is completely stable.
May 4th, 2008 at 11:56 pm
Where would you prefer to get the feedback? (eclipse-ecj refuse to compile on a amd64 that has no other Java on it) Should I file a bug at bugs.gentoo.org or write here?
May 6th, 2008 at 8:59 pm
Here is fine or you can e-mail me (see http://fuseyism.com/). I think the Gentoo folks would prefer you don’t file bugs about my stuff
Here is better because it’s more public, but I’ll also respond slower (though trying to rectify that and blog more). E-mail I do check more frequently.
What error do you get from eclipse-ecj? I’m also on amd64, and the following works fine for me:
1. Make sure the overlay packages are enabled in /etc/portage/package.keywords and that the proprietary JDKs are blocked in package.mask.
2. You should then be able to emerge eclipse-ecj and it will pull in gcj and gcj-jdk, which will pull in ecj1 (the binary ecj) in turn. If not, you can obviously force these, but it should occur as the only available JDK option.
If not, let me know the output and I’ll try and hunt down the problem.
May 10th, 2008 at 11:52 am
I am also on a amd64 system. (By the way, you should also add dev-java/ibm-jdk-bin to the list of packages to add to package.mask)
What use-flags do you use? Are Gcj enabled or disabled?
# emerge gcj-jdk
Calculating dependencies… done!
>>> Verifying ebuild Manifests…
>>> Emerging (1 of 2) dev-java/eclipse-ecj-3.3.0-r2 to /
… [ ok ]
… [ ok ]
… [ ok ]
… [ ok ]
… [ ok ]
* ecjsrc.zip RMD160 SHA1 SHA256 size
* checking ebuild checksums
* checking auxfile checksums
* checking miscfile checksums
* checking ecjsrc.zip
>>> Unpacking source…
>>> Unpacking ecjsrc.zip to /var/tmp/portage/dev-java/eclipse-ecj-3.3.0-r2/work
* Applying eclipse-ecj-gcj-3.3.0.patch … [ ok ]
>>> Source unpacked.
>>> Compiling source in /var/tmp/portage/dev-java/eclipse-ecj-3.3.0-r2/work …
* bootstrapping ecj with gcj
Exception in thread “main” java.lang.NoClassDefFoundError: org.eclipse.jdt.internal.compiler.batch.GCCMain
at gnu.java.lang.MainThread.run(libgcj.so.9)
Caused by: java.lang.ClassNotFoundException: org.eclipse.jdt.internal.compiler.batch.GCCMain not found in gnu.gcj.runtime.SystemClassLoader{urls=[], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
at java.net.URLClassLoader.findClass(libgcj.so.9)
at java.lang.ClassLoader.loadClass(libgcj.so.9)
at java.lang.ClassLoader.loadClass(libgcj.so.9)
at gnu.java.lang.MainThread.run(libgcj.so.9)
* creating bootstrap jar file
* building ecj binary
* building ecj with bootstrapped ecj
Exception in thread “main” java.lang.NoClassDefFoundError: org.eclipse.jdt.internal.compiler.batch.Main
at gnu.java.lang.MainThread.run(libgcj.so.9)
Caused by: java.lang.ClassNotFoundException: org.eclipse.jdt.internal.compiler.batch.Main not found in gnu.gcj.runtime.SystemClassLoader{urls=[file:./], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
at java.net.URLClassLoader.findClass(libgcj.so.9)
at java.lang.ClassLoader.loadClass(libgcj.so.9)
at java.lang.ClassLoader.loadClass(libgcj.so.9)
at gnu.java.lang.MainThread.run(libgcj.so.9)
*
* ERROR: dev-java/eclipse-ecj-3.3.0-r2 failed.
* Call stack:
* ebuild.sh, line 49: Called src_compile
* environment, line 2127: Called die
* The specific snippet of code:
* LD_LIBRARY_PATH=$libpath ./${MY_PN} -encoding ISO-8859-1 org || die “${MY_PN} build failed!”;
* The die message:
* ecj build failed!
*
* If you need support, post the topmost build error, and the call stack if relevant.
* A complete build log is located at ‘/var/tmp/portage/dev-java/eclipse-ecj-3.3.0-r2/temp/build.log’.
* The ebuild environment file is located at ‘/var/tmp/portage/dev-java/eclipse-ecj-3.3.0-r2/temp/environment’.
* This ebuild is from an overlay: ‘/usr/local/portage/libre_java_overlay/’
*
* Messages for package dev-java/eclipse-ecj-3.3.0-r2:
*
* ERROR: dev-java/eclipse-ecj-3.3.0-r2 failed.
* Call stack:
* ebuild.sh, line 49: Called src_compile
* environment, line 2127: Called die
* The specific snippet of code:
* LD_LIBRARY_PATH=$libpath ./${MY_PN} -encoding ISO-8859-1 org || die “${MY_PN} build failed!”;
* The die message:
* ecj build failed!
*
* If you need support, post the topmost build error, and the call stack if relevant.
* A complete build log is located at ‘/var/tmp/portage/dev-java/eclipse-ecj-3.3.0-r2/temp/build.log’.
* The ebuild environment file is located at ‘/var/tmp/portage/dev-java/eclipse-ecj-3.3.0-r2/temp/environment’.
* This ebuild is from an overlay: ‘/usr/local/portage/libre_java_overlay/’
*
May 14th, 2008 at 10:27 am
Hi here. I’m on x86. trying to compile icedtea in your way, but getting “circular dependencies”. Sorry for flooding your blog.
neptun ~ # emerge -pv icedtea6
These are the packages that would be merged, in order:
Calculating dependencies… done!
[nomerge ] dev-java/icedtea6-1.1 USE=”-debug -doc -examples -nsplugin -zero”
[ebuild N ] dev-java/xalan-2.7.0-r5 USE=”-doc -source”
[ebuild N ] dev-java/javacup-0.10k-r1 USE=”-source”
[ebuild N ] dev-java/bcel-5.2 USE=”-doc -source”
[ebuild N ] dev-java/xerces-2.9.1 USE=”-doc -examples -source”
[ebuild N ] dev-java/xjavac-20041208-r5
[ebuild N ] dev-java/xml-commons-resolver-1.2 USE=”-doc -source”
[ebuild N ] dev-java/xalan-serializer-2.7.0 USE=”-doc -source”
[ebuild N ] dev-java/xml-commons-external-1.3.04 USE=”-doc -source”
[ebuild N ] virtual/jre-1.6.0
[ebuild N ] dev-java/ant-core-1.7.0-r1 USE=”-doc -source”
[ebuild N ] virtual/jdk-1.6.0
[ebuild N ] dev-java/icedtea6-1.1 USE=”-debug -doc -examples -nsplugin -zero”
!!! Error: circular dependencies:
(’ebuild’, ‘/’, ‘dev-java/ant-core-1.7.0-r1′, ‘merge’) depends on
(’ebuild’, ‘/’, ‘dev-java/icedtea6-1.1′, ‘merge’) (hard)
(’ebuild’, ‘/’, ‘virtual/jdk-1.6.0′, ‘merge’) (hard)
(’ebuild’, ‘/’, ‘virtual/jre-1.6.0′, ‘merge’) depends on
(’ebuild’, ‘/’, ‘dev-java/icedtea6-1.1′, ‘merge’) (medium)
(’ebuild’, ‘/’, ‘virtual/jdk-1.6.0′, ‘merge’) (medium)
(’ebuild’, ‘/’, ‘dev-java/xjavac-20041208-r5′, ‘merge’) depends on
(’ebuild’, ‘/’, ‘dev-java/ant-core-1.7.0-r1′, ‘merge’) (hard)
(’ebuild’, ‘/’, ‘dev-java/icedtea6-1.1′, ‘merge’) (hard)
(’ebuild’, ‘/’, ‘virtual/jdk-1.6.0′, ‘merge’) (hard)
(’ebuild’, ‘/’, ‘dev-java/javacup-0.10k-r1′, ‘merge’) depends on
(’ebuild’, ‘/’, ‘dev-java/icedtea6-1.1′, ‘merge’) (hard)
(’ebuild’, ‘/’, ‘virtual/jre-1.6.0′, ‘merge’) (medium)
(’ebuild’, ‘/’, ‘virtual/jdk-1.6.0′, ‘merge’) (hard)
(’ebuild’, ‘/’, ‘dev-java/icedtea6-1.1′, ‘merge’) depends on
(’ebuild’, ‘/’, ‘dev-java/ant-core-1.7.0-r1′, ‘merge’) (hard)
(’ebuild’, ‘/’, ‘dev-java/icedtea6-1.1′, ‘merge’) (hard)
(’ebuild’, ‘/’, ‘virtual/jdk-1.6.0′, ‘merge’) (hard)
(’ebuild’, ‘/’, ‘dev-java/xerces-2.9.1′, ‘merge’) (hard)
(’ebuild’, ‘/’, ‘dev-java/xalan-2.7.0-r5′, ‘merge’) (hard)
(’ebuild’, ‘/’, ‘dev-java/xerces-2.9.1′, ‘merge’) depends on
(’ebuild’, ‘/’, ‘dev-java/ant-core-1.7.0-r1′, ‘merge’) (hard)
(’ebuild’, ‘/’, ‘dev-java/xml-commons-external-1.3.04′, ‘merge’) (hard)
(’ebuild’, ‘/’, ‘dev-java/icedtea6-1.1′, ‘merge’) (hard)
(’ebuild’, ‘/’, ‘virtual/jdk-1.6.0′, ‘merge’) (hard)
(’ebuild’, ‘/’, ‘dev-java/xml-commons-resolver-1.2′, ‘merge’) (hard)
(’ebuild’, ‘/’, ‘dev-java/xalan-serializer-2.7.0′, ‘merge’) (hard)
(’ebuild’, ‘/’, ‘virtual/jre-1.6.0′, ‘merge’) (medium)
(’ebuild’, ‘/’, ‘dev-java/xjavac-20041208-r5′, ‘merge’) (hard)
(’ebuild’, ‘/’, ‘dev-java/xml-commons-external-1.3.04′, ‘merge’) depends on
(’ebuild’, ‘/’, ‘dev-java/ant-core-1.7.0-r1′, ‘merge’) (hard)
(’ebuild’, ‘/’, ‘dev-java/icedtea6-1.1′, ‘merge’) (hard)
(’ebuild’, ‘/’, ‘virtual/jdk-1.6.0′, ‘merge’) (hard)
(’ebuild’, ‘/’, ‘virtual/jre-1.6.0′, ‘merge’) (medium)
(’ebuild’, ‘/’, ‘virtual/jdk-1.6.0′, ‘merge’) depends on
(’ebuild’, ‘/’, ‘dev-java/icedtea6-1.1′, ‘merge’) (medium)
(’ebuild’, ‘/’, ‘dev-java/xml-commons-resolver-1.2′, ‘merge’) depends on
(’ebuild’, ‘/’, ‘dev-java/ant-core-1.7.0-r1′, ‘merge’) (hard)
(’ebuild’, ‘/’, ‘dev-java/icedtea6-1.1′, ‘merge’) (hard)
(’ebuild’, ‘/’, ‘virtual/jdk-1.6.0′, ‘merge’) (hard)
(’ebuild’, ‘/’, ‘virtual/jre-1.6.0′, ‘merge’) (medium)
(’ebuild’, ‘/’, ‘dev-java/xalan-2.7.0-r5′, ‘merge’) depends on
(’ebuild’, ‘/’, ‘dev-java/ant-core-1.7.0-r1′, ‘merge’) (hard)
(’ebuild’, ‘/’, ‘dev-java/xml-commons-external-1.3.04′, ‘merge’) (hard)
(’ebuild’, ‘/’, ‘dev-java/icedtea6-1.1′, ‘merge’) (hard)
(’ebuild’, ‘/’, ‘virtual/jdk-1.6.0′, ‘merge’) (hard)
(’ebuild’, ‘/’, ‘dev-java/xerces-2.9.1′, ‘merge’) (hard)
(’ebuild’, ‘/’, ‘dev-java/xalan-serializer-2.7.0′, ‘merge’) (hard)
(’ebuild’, ‘/’, ‘dev-java/javacup-0.10k-r1′, ‘merge’) (hard)
(’ebuild’, ‘/’, ‘virtual/jre-1.6.0′, ‘merge’) (medium)
(’ebuild’, ‘/’, ‘dev-java/bcel-5.2′, ‘merge’) (hard)
(’ebuild’, ‘/’, ‘dev-java/bcel-5.2′, ‘merge’) depends on
(’ebuild’, ‘/’, ‘dev-java/ant-core-1.7.0-r1′, ‘merge’) (hard)
(’ebuild’, ‘/’, ‘dev-java/icedtea6-1.1′, ‘merge’) (hard)
(’ebuild’, ‘/’, ‘virtual/jdk-1.6.0′, ‘merge’) (hard)
(’ebuild’, ‘/’, ‘virtual/jre-1.6.0′, ‘merge’) (medium)
(’ebuild’, ‘/’, ‘dev-java/xalan-serializer-2.7.0′, ‘merge’) depends on
(’ebuild’, ‘/’, ‘dev-java/ant-core-1.7.0-r1′, ‘merge’) (hard)
(’ebuild’, ‘/’, ‘dev-java/xml-commons-external-1.3.04′, ‘merge’) (hard)
(’ebuild’, ‘/’, ‘dev-java/icedtea6-1.1′, ‘merge’) (hard)
(’ebuild’, ‘/’, ‘virtual/jdk-1.6.0′, ‘merge’) (hard)
(’ebuild’, ‘/’, ‘virtual/jre-1.6.0′, ‘merge’) (medium)
!!! Note that circular dependencies can often be avoided by temporarily
!!! disabling USE flags that trigger optional dependencies.
Any suggestions?
emerge –info
Portage 2.1.4.4 (default/linux/x86/2008.0/desktop, gcc-4.1.2, glibc-2.6.1-r0, 2.6.24-gentoo-r8 i686)
=================================================================
System uname: 2.6.24-gentoo-r8 i686 Intel(R) Core(TM)2 CPU T7600 @ 2.33GHz
Timestamp of tree: Tue, 13 May 2008 20:00:01 +0000
app-shells/bash: 3.2_p33
dev-lang/python: 2.4.4-r9
dev-python/pycrypto: 2.0.1-r6
sys-apps/baselayout: 1.12.11.1
sys-apps/sandbox: 1.2.18.1-r2
sys-devel/autoconf: 2.13, 2.61-r1
sys-devel/automake: 1.5, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.1
sys-devel/binutils: 2.18-r1
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool: 1.5.26
virtual/os-headers: 2.6.23-r3
ACCEPT_KEYWORDS=”x86″
CBUILD=”i686-pc-linux-gnu”
CFLAGS=”-O2 -march=prescott -pipe”
CHOST=”i686-pc-linux-gnu”
CONFIG_PROTECT=”/etc”
CONFIG_PROTECT_MASK=”/etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/revdep-rebuild /etc/terminfo /etc/udev/rules.d”
CXXFLAGS=”-O2 -march=prescott -pipe”
DISTDIR=”/usr/portage/distfiles”
FEATURES=”distlocks metadata-transfer sandbox sfperms strict unmerge-orphans userfetch”
GENTOO_MIRRORS=”http://distfiles.gentoo.org http://distro.ibiblio.org/pub/linux/distributions/gentoo”
LINGUAS=”de ru zh_CN”
MAKEOPTS=”-j5″
PKGDIR=”/usr/portage/packages”
PORTAGE_RSYNC_OPTS=”–recursive –links –safe-links –perms –times –compress –force –whole-file –delete –stats –timeout=180 –exclude=/distfiles –exclude=/local –exclude=/packages”
PORTAGE_TMPDIR=”/var/tmp”
PORTDIR=”/usr/portage”
PORTDIR_OVERLAY=”/home/alien/icedtea/libre_java_overlay”
SYNC=”rsync://rsync.gentoo.org/gentoo-portage”
USE=”X acl acpi alsa berkdb bluetooth branding bzip2 cairo cdr cli cracklib crypt cups dbus dri dvd dvdr dvdread emboss encode evo fam firefox fortran gdbm gif glitz gnome gpm gstreamer gtk hal iconv ipv6 isdnlog jpeg kerberos laptop ldap libnotify mad midi mikmod mp3 mpeg mudflap ncurses nls nptl nptlonly ogg opengl openmp pam pcre pdf perl png ppds pppd python qt3support quicktime readline reflection sdl session spell spl sse2 ssl startup-notification svg tcpd tiff truetype unicode vorbis win32codecs x86 xml xorg xv zlib” ALSA_CARDS=”ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8×0 intel8×0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci” ALSA_PCM_PLUGINS=”adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mulaw multi null plug rate route share shm softvol” APACHE2_MODULES=”actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias” ELIBC=”glibc” INPUT_DEVICES=”evdev keyboard mouse synaptics” KERNEL=”linux” LCD_DEVICES=”bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text” LINGUAS=”de ru zh_CN” USERLAND=”GNU” VIDEO_CARDS=”nv”
Unset: CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
May 26th, 2008 at 9:14 pm
Sveinung, it looks like your ecj1 script is not working. Check that ecj1.jar is in /usr/share/java and that /usr/lib/gcj-4.3.0/lib64/gcc/x86_64-unknown-linux-gnu/4.3.0/ecj1 runs with no errors (it should just return silently). I build eclipse-ecj with the gcj USE flag on.
alien, do you have something installed to satisfy jdk-1.5.0? This is why I originally went with gcj-jdk as the dependency for IcedTea…
June 11th, 2008 at 5:52 pm
ecj1.jar is a link to a nonexisting file. I will update to your latest version and try again.
June 11th, 2008 at 7:02 pm
I found the problem: I was not connected to the Internet while building it. The wget you had put in unpack then of course failed, but the install continued.