Currently Being Moderated

Bootstrap Icedtea6 from the ground up

VERSION 1

Created on: May 3, 2009 10:03 AM by codestr0m - Last Modified:  May 3, 2009 10:08 AM by codestr0m


Small upfront disclaimer...

These instructions aren't really clean, organized and sometimes specific to a 64bit build.  (IOW don't complain if you see some dirty hacks)  Corrections welcome.. drop me a comment and I'll fix..

Things needed to build and get working in order in order.. gcj, ecj, jamvm-1.5.3 (read gotchas below) , classpath, ant.   From this you'll have enough to at least bootstrap the first part of icedtea6.

Prerequisites

Xorg - might as well build the whole thing.. until someone makes a --without-awt you'll need it..
Cups - Building cups is beyond the scope of this doc, but you'll need cups.h http://ftp.easysw.com/pub/cups/1.3.10/cups-1.3.10-source.tar.bz2
xalan.jar wget http://godel.cs.bilgi.edu.tr/apache/xml/xalan-j/xalan-j_2_7_1-bin.zip
serializer.jar wget http://godel.cs.bilgi.edu.tr/apache/xml/xalan-j/xalan-j_2_7_1-bin.zip
wget http://www.apache.org/dist/xerces/j/Xerces-J-bin.2.9.1.zip
Freetype, jpeg, gif and png libraries as well

Step 1 gcj

gcc is really evil, but we need to start somewhere..

This should give an idea of how I built gcc-4.4 prelease..

http://hg.osunix.org/osunix-overlay/src/tip/sys-devel/gcc/gcc-4.4-r2.ebuild

# Note : don't set target/build/host env variables
just change --enable-languages=c,c++ to--enable-languages=c,c++,java

#  Note : gij is broken on (open)solaris so may as well delete it to avoid wasting your time..

Step 2 ecj

Pull ecj.jar

wget "http://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops/R-3.4-200806172000/ecj-3.4.jar&url=http://eclipse.mirror.kangaroot.net/eclipse/downloads/drops/R-3.4-200806172000/ecj-3.4.jar&mirror_id=468"

gcj -findirect-dispatch -m64 -o native_ecj --main=org.eclipse.jdt.internal.compiler.batch.Main ecj.jar

# Now you'll have a native 64bit ecj that you can build other things with..


Step 3 jamvm

Change a couple solaris x86 lines in configure to x86_64
mv -f solaris x86 sub directory to x86_64
CFLAGS=-m64 LDFLAGS=-m64

# Some jamvm gotchas..
# 1.5.2 has a 64K stack size by default.. When generating some files you'll eventually hit a stackoverflow unless you add -Xss256K or higher..  That's why 1.5.3 should work out of the box.. Also.. if you do hit a stackoverflow the generated file is probably corrupted.
# jvmtiEnterTrace.cpp won't be generated correctly.. I'm not certain the point of failure, but you'll need to download it from somewhere
# After the bootstrap ant needs to find build.properties file.  If using jamvm it doesn't seem to find it and the build will fail.  Switching to the just bootstrapped java should fix it.

Step 4 GNU Classpath

More evil gnu saves the day..
# You can download the prebuilt one, but the location of ecj.jar for it will not be the same and thus later mess things up.  Adjust --with-ecj-jar=/usr/local/src/ecj.jar to your location..

./configure --prefix=/usr/local/classpath --with-glibj-zip=/usr/local/classpath/share/classpath/glibj.zip --with-pic --disable-gconf-peer --enable-jni --with-ecj-jar=/usr/local/src/ecj.jar --without-x --disable-plugin --disable-gtk-peer  --disable-examples --disable-gjdoc 'CFLAGS=-m64' 'LDFLAGS=-m64'

Step 5 ant (which is really evil)

I personally loath ant.. So with that out of the way we have to get it working..

# Note : disable junit first http://ant.apache.org/faq.html#170-requires-junit
# Before the icedtea6 was bootstrapped I dirty hacked the ant shell script to set JAVA_HOME inside it so I didn't have to export to the env.  After icedtea6 is removed you must remember to remove this.

/usr/local/src/jamvm/bin/jamvm -classpath /usr/local/src/apache-ant-1.7.1/lib/ant-launcher.jar -Dant.home=/usr/share/ant-core -Dbuild.compiler=gcj org.apache.tools.ant.launch.Launcher

./dist/bin/ant -Dant.install=/usr/local/src/ant install

Step 6 icedtea6 (yay!)

# If you're using (t)csh.. bash and normal shell users feel free to adjust

setenv ALT_CUPS_HEADERS_PATH /usr/include
setenv ALT_FREETYPE_LIB_PATH /usr/lib/amd64
setenv ALT_FREETYPE_HEADERS_PATH /usr/include/freetype2
setenv XARCH '-m64'
setenv ARCH amd64
setenv ARCH_DATA_MODEL 64
setenv MAKE /usr/bin/gmake
# Note : If you set to 5.10 which is what Sun Studio Express currently is it'll not pick up the most recent cflags in some places.
setenv ENFORCE_COMPILER_REV '5.9'
setenv ENFORCE_C_COMPILER_REV '5.9'
setenv ALT_COMPILER_PATH /opt/SunStudioExpress/bin
setenv NO_DOCS true

mkdir mybuild ; cd mybuild

# Note : adjust accordingly

../configure --prefix=/usr/jdk/icedtea6 --disable-cacao --disable-liveconnect --disable-pulse-java --with-gcj-home=/usr/lib/gcj-4.4.0-10 --with-ecj=/usr/bin/ecj  --with-ecj-jar=/usr/local/src/ecj.jar --with-xalan2-jar=/usr/local/src/xalan-j_2_7_1/xalan.jar --with-xalan2-serializer-jar=/usr/local/src/xalan-j_2_7_1/serializer.jar --with-xerces2-jar=/usr/local/src/xerces-2_9_1/xercesImpl.jar --without-rhino --disable-visualvm --with-ant-home=/usr/local/src/ant --with-java=/usr/local/src/jamvm/bin/jamvm --with-pkgversion=Icedtea6-1.4.1  'CC=/opt/SunStudioExpress/bin/cc' 'CFLAGS=-m64 -I/usr/include/cups -I/usr/local/classpath/include' 'LDFLAGS=-m64'

# depending on your version you may also need
# --with-libgcj-jar=/usr/share/java/libgcj-4.4.0.jar

# The big list of problems and stuff..
1) Where you point JAVA_HOME should have a jdk like structure.  There's the gcj-jdk redhat package that sets this up, but it didn't build/work so I did it manually.. ymmv

# Note : The dirty hacks in no particular order...
cd /usr/lib/gcj-4.4.0-10/jre/lib/
ln -sf /usr/local/classpath/share/classpath/glibj.zip rt.jar

# Note : can't find Invocable?
cp ./lib/rt/javax/script/Invocable.class ./lib/hotspot-tools/javax/script/
/usr/gcc/temp/bin/gjar cf bootstrap/jdk1.7.0/jre/lib/tools.jar -C lib/hotspot-tools com -C lib/hotspot-tools sun -C lib/hotspot-tools org -C lib/hotspot-tools java -C lib/hotspot-tools javax

# The arch targets are all screwed up and confused because of amd64
cd /usr/local/src/icedtea6-1.4.1/mybuild/openjdk-ecj/control/build/
ln -sf solaris-amd64 solaris-i586

# Test fails.. Just make sure it doesn't..
cd  /usr/local/src/icedtea6-1.4.1/mybuild/openjdk-ecj/jdk/make/sun/xawt

--- Makefile.old        2009-05-01 08:38:56.261848810 -0700
+++ Makefile    2009-05-01 08:31:33.127737691 -0700
@@ -248,6 +248,7 @@
        fi
        @if [ "$(DOCOMPARE)$(suffix $@)" = "true.64" ]; then \
            $(ECHO) COMPARING $@ and $(STORED_SIZES_TMPL_$(PLATFORM)_$(LIBARCH)); \
+           cp $@ $(STORED_SIZES_TMPL_$(PLATFORM)_$(LIBARCH)); \
            $(DIFF) $@ $(STORED_SIZES_TMPL_$(PLATFORM)_$(LIBARCH)); \
        fi 

# You'll have some missing symbols from the mapfiles.. Removing those lets the build go further

Java_sun_java2d_xr_XRSurfaceData_XRIsDrawableValid /usr/local/src/icedtea6-1.4.1/mybuild/openjdk-ecj/control/build/solaris-amd64/tmp/sun/sun.awt.X11/xawt/mapfile-vers
Java_sun_java2d_xr_XRSurfaceData_flushNativeSurface /usr/local/src/icedtea6-1.4.1/mybuild/openjdk-ecj/control/build/solaris-amd64/tmp/sun/sun.awt.X11/xawt/mapfile-vers
Java_sun_java2d_xr_XRSurfaceData_XRSetGradientPaint /usr/local/src/icedtea6-1.4.1/mybuild/openjdk-ecj/control/build/solaris-amd64/tmp/sun/sun.awt.X11/xawt/mapfile-vers
Java_sun_java2d_xr_XRSurfaceData_setInvalid /usr/local/src/icedtea6-1.4.1/mybuild/openjdk-ecj/control/build/solaris-amd64/tmp/sun/sun.awt.X11/xawt/mapfile-vers

---
Java_sun_java2d_x11_X11SurfaceData_XResetClip /usr/local/src/icedtea6-1.4.1/mybuild/openjdk-ecj/control/build/solaris-amd64/tmp/sun/sun.awt/headless/mapfile-vers
Java_sun_java2d_x11_X11SurfaceData_XSetClip /usr/local/src/icedtea6-1.4.1/mybuild/openjdk-ecj/control/build/solaris-amd64/tmp/sun/sun.awt/headless/mapfile-vers
Java_sun_java2d_x11_X11SurfaceData_setInvalid /usr/local/src/icedtea6-1.4.1/mybuild/openjdk-ecj/control/build/solaris-amd64/tmp/sun/sun.awt/headless/mapfile-vers
Java_sun_java2d_x11_X11SurfaceData_XCreateGC /usr/local/src/icedtea6-1.4.1/mybuild/openjdk-ecj/control/build/solaris-amd64/tmp/sun/sun.awt/headless/mapfile-vers
Java_sun_java2d_x11_X11SurfaceData_isDrawableValid /usr/local/src/icedtea6-1.4.1/mybuild/openjdk-ecj/control/build/solaris-amd64/tmp/sun/sun.awt/headless/mapfile-vers
Java_sun_java2d_x11_X11SurfaceData_initOps /usr/local/src/icedtea6-1.4.1/mybuild/openjdk-ecj/control/build/solaris-amd64/tmp/sun/sun.awt/headless/mapfile-vers
---
Java_sun_java2d_xr_XRSurfaceData_initOps /usr/local/src/icedtea6-1.4.1/mybuild/openjdk-ecj/control/build/solaris-amd64/tmp/sun/sun.awt.X11/xawt/mapfile-vers

# Icedtea6 assume gnu cp and ln
ln -sfv can be converted to ln -sf
cp -a can be converted to cp -pPrf

# First time around you'll need to steal libjvm.so
mkdir -p /usr/local/src/icedtea6-1.4.1/mybuild/bootstrap/jdk1.6.0/jre/lib/amd64/server
cp ../../jamvm-1.5.3/src/.libs/libjvm.so /usr/local/src/icedtea6-1.4.1/mybuild/bootstrap/jdk1.6.0/jre/lib/amd64/server

# Manual symlink... (ugly hack)
/usr/local/src/icedtea6-1.4.1/mybuild/bootstrap # ln -sf /usr/local/src/icedtea6-1.4.1/mybuild/bootstrap/openjdk-ecj/control/build/solaris-i586 icedtea

# Since this is amd64 only..  bin/* won't have any commands.. they are all in bin/amd64/*
# cd location/of/your/bin
ln -sf amd64/* .

# On OpenJDK bootstrap use icedtea6 libjvm.so and the other jre bits

cp -rf ./openjdk-ecj/control/build/solaris-amd64/j2sdk-image/jre /usr/local/src/icedtea6-1.4.1/mybuild/bootstrap/jdk1.6.0/

# Didn't get copied over?
cp /usr/local/src/icedtea6-1.4.1/mybuild/bootstrap/jdk1.7.0/jre/lib/tools.jar /usr/local/src/icedtea6-1.4.1/mybuild/bootstrap/jdk1.6.0/lib/

# This needs to be changed to gas and use -64 as flag to build 64bit..
# As a quick fix you can cd to that directory and run gas manually

mybuild/openjdk/hotspot/make/solaris/makefiles/sparcWorks.make
AS   = /usr/ccs/bin/as


# ./test_gamma breaks stuff so once again disable the test

--- openjdk/hotspot/make/solaris/Makefile.old   2009-05-03 05:24:28.591298714 -0700
+++ openjdk/hotspot/make/solaris/Makefile       2009-05-03 05:24:45.635642249 -0700
@@ -236,35 +236,30 @@
 
  $(TARGETS_C2):  $(SUBDIRS_C2)
         cd $(OSNAME)_$(BUILDARCH)_compiler2/$@ && $(MAKE) $(MFLAGS)
-       cd $(OSNAME)_$(BUILDARCH)_compiler2/$@ && ./test_gamma
  ifdef INSTALL
         cd $(OSNAME)_$(BUILDARCH)_compiler2/$@ && $(MAKE) $(MFLAGS) install
  endif
 
  $(TARGETS_TIERED):  $(SUBDIRS_TIERED)
         cd $(OSNAME)_$(BUILDARCH)_tiered/$(patsubst %tiered,%,$@) && $(MAKE) $(MFLAGS)
-       cd $(OSNAME)_$(BUILDARCH)_tiered/$(patsubst %tiered,%,$@) && ./test_gamma
  ifdef INSTALL
         cd $(OSNAME)_$(BUILDARCH)_tiered/$(patsubst %tiered,%,$@) && $(MAKE) $(MFLAGS) install
  endif
 
  $(TARGETS_C1):  $(SUBDIRS_C1)
         cd $(OSNAME)_$(BUILDARCH)_compiler1/$(patsubst %1,%,$@) && $(MAKE) $(MFLAGS)
-       cd $(OSNAME)_$(BUILDARCH)_compiler1/$(patsubst %1,%,$@) && ./test_gamma
  ifdef INSTALL
         cd $(OSNAME)_$(BUILDARCH)_compiler1/$(patsubst %1,%,$@) && $(MAKE) $(MFLAGS) install
  endif
 
  $(TARGETS_CORE):  $(SUBDIRS_CORE)
         cd $(OSNAME)_$(BUILDARCH)_core/$(patsubst %core,%,$@) && $(MAKE) $(MFLAGS)
-       cd $(OSNAME)_$(BUILDARCH)_core/$(patsubst %core,%,$@) && ./test_gamma
  ifdef INSTALL
         cd $(OSNAME)_$(BUILDARCH)_core/$(patsubst %core,%,$@) && $(MAKE) $(MFLAGS) install
  endif
 
  $(TARGETS_KERNEL):  $(SUBDIRS_KERNEL)
         cd $(OSNAME)_$(BUILDARCH)_kernel/$(patsubst %kernel,%,$@) && $(MAKE) $(MFLAGS)
-       cd $(OSNAME)_$(BUILDARCH)_kernel/$(patsubst %kernel,%,$@) && ./test_gamma
  ifdef INSTALL
         cd $(OSNAME)_$(BUILDARCH)_kernel/$(patsubst %kernel,%,$@) && $(MAKE) $(MFLAGS) install
  endif


# More mapfiles..

Java_sun_java2d_xr_XRSurfaceData_XRIsDrawableValid /usr/local/src/icedtea6-1.4.1/mybuild/openjdk/control/build/solaris-amd64/tmp/sun/sun.awt.X11/xawt/mapfile-vers
Java_sun_java2d_xr_XRSurfaceData_flushNativeSurface /usr/local/src/icedtea6-1.4.1/mybuild/openjdk/control/build/solaris-amd64/tmp/sun/sun.awt.X11/xawt/mapfile-vers
Java_sun_java2d_xr_XRSurfaceData_XRSetGradientPaint /usr/local/src/icedtea6-1.4.1/mybuild/openjdk/control/build/solaris-amd64/tmp/sun/sun.awt.X11/xawt/mapfile-vers
Java_sun_java2d_xr_XRSurfaceData_setInvalid /usr/local/src/icedtea6-1.4.1/mybuild/openjdk/control/build/solaris-amd64/tmp/sun/sun.awt.X11/xawt/mapfile-vers
Java_sun_java2d_xr_XRSurfaceData_initOps /usr/local/src/icedtea6-1.4.1/mybuild/openjdk/control/build/solaris-amd64/tmp/sun/sun.awt.X11/xawt/mapfile-vers

---
Java_sun_java2d_x11_X11SurfaceData_XResetClip /usr/local/src/icedtea6-1.4.1/mybuild/openjdk/control/build/solaris-amd64/tmp/sun/sun.awt/headless/mapfile-vers
Java_sun_java2d_x11_X11SurfaceData_XSetClip /usr/local/src/icedtea6-1.4.1/mybuild/openjdk/control/build/solaris-amd64/tmp/sun/sun.awt/headless/mapfile-vers
Java_sun_java2d_x11_X11SurfaceData_setInvalid /usr/local/src/icedtea6-1.4.1/mybuild/openjdk/control/build/solaris-amd64/tmp/sun/sun.awt/headless/mapfile-vers
Java_sun_java2d_x11_X11SurfaceData_XCreateGC /usr/local/src/icedtea6-1.4.1/mybuild/openjdk/control/build/solaris-amd64/tmp/sun/sun.awt/headless/mapfile-vers
Java_sun_java2d_x11_X11SurfaceData_isDrawableValid /usr/local/src/icedtea6-1.4.1/mybuild/openjdk/control/build/solaris-amd64/tmp/sun/sun.awt/headless/mapfile-vers
----

Java_sun_java2d_x11_X11SurfaceData_initOps /usr/local/src/icedtea6-1.4.1/mybuild/openjdk/control/build/solaris-amd64/tmp/sun/sun.awt/headless/mapfile-vers

Towards the end one last dirty hack...
cp -prf openjdk/control/build/solaris-amd64/* openjdk/control/build/solaris-i586/

# Congrats! From here you should have icedtea6 served

----
References:
https://c1.complang.tuwien.ac.at/cacaowiki/OpenJDK

Andrew John Hughes - ebuilds
http://overlays.gentoo.org/proj/java/browser/java-overlay/dev-java/icedtea6


Big thanks to everyone in #openjdk on oftc

Average User Rating
(0 ratings)




There are no comments on this document

More Like This

  • Retrieving data ...