Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 24 Oct 2015 14:10:21 -0400
From:      "Curtis Hamilton" <hamiltcl@verizon.net>
To:        "'Greg Lewis'" <glewis@eyesbeyond.com>
Cc:        <freebsd-java@freebsd.org>
Subject:   RE: Icedtea on FreeBSD PowerPC
Message-ID:  <005b01d10e87$3fbefcb0$bf3cf610$@verizon.net>
In-Reply-To: <20151024012039.GA57742@misty.eyesbeyond.com>
References:  <002b01d0ef2d$86363290$92a297b0$@verizon.net> <20150925043739.GA51468@misty.eyesbeyond.com> <009d01d0fab9$827b8050$877280f0$@verizon.net> <001401d10d8a$7487cd80$5d976880$@verizon.net> <20151024012039.GA57742@misty.eyesbeyond.com>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
My initial success was in building the mercurial OpenJDK7 BSD-Port, using
the attached build script and instructions obtained from the OpenJDK Wiki
Darwin9Build section.  Subsequently, I used information from the arm patch
to modify the ports Makefile and build the ports distribution.  Other than
what's in the make file patch, no other patches were needed, as I used the
mercurial build as the bootstrap.

As you previously noted, the key for non-x86 builds is the bootstrap.  I
used the GCC java tools and created a bootstrap from sym links to the GCJ
executables in /usr/local/bin.   I can provide more details if needed,
however, building GCC java is not straight forward as it is not an available
option for non-x86 GCC builds.

-----Original Message-----
From: Greg Lewis [mailto:glewis@eyesbeyond.com] 
Sent: Friday, October 23, 2015 9:21 PM
To: Curtis Hamilton <hamiltcl@verizon.net>
Cc: freebsd-java@freebsd.org
Subject: Re: Icedtea on FreeBSD PowerPC

On Fri, Oct 23, 2015 at 08:00:47AM -0400, Curtis Hamilton wrote:
> After many failed tries, I finally succeeded in building Openjdk 7 on 
> PowerPC64.  Anyone interested in how it was done or wants the binaries?
> 
> My next challenge is to build OpenJDK 8 on PowerPC64 .

Cool :)

Do you have patches or were no code changes required?

-- Greg

> -----Original Message-----
> From: owner-freebsd-java@freebsd.org 
> [mailto:owner-freebsd-java@freebsd.org]
> On Behalf Of Curtis Hamilton
> Sent: Tuesday, September 29, 2015 9:20 AM
> To: 'Greg Lewis' <glewis@eyesbeyond.com>
> Cc: freebsd-java@freebsd.org
> Subject: RE: Icedtea on FreeBSD PowerPC
> 
> Thanks for the insight, but l don't have a sufficient bootstrap to for 
> openjdk8.  Like I said, I've had some success building openjdk6, but I 
> get a seg fault and core dump when the newly created 'java' executable is
run.
> 
> It would be helpful if you could view the attached log file that is 
> created and point me to what I'm doing wrong.
> 
> Thanks in advance.
> 
> Curtis
> 
> -----Original Message-----
> From: Greg Lewis [mailto:glewis@eyesbeyond.com]
> Sent: Friday, September 25, 2015 12:38 AM
> To: Curtis Hamilton <hamiltcl@verizon.net>
> Cc: freebsd-java@freebsd.org
> Subject: Re: Icedtea on FreeBSD PowerPC
> 
> On Mon, Sep 14, 2015 at 04:39:59PM -0400, Curtis Hamilton wrote:
> > Has anyone been successful in building openjdk6 or openjdk7 using 
> > icedtea on a FreeBSD PowerPC based system?  If so, I'd love to know 
> > how
> you did it.
> > 
> >  I've successfully implemented a workable bootsrap using GCJ and 
> > ECJ, but encounter problems in building HotSpot.
> 
> You may be able to build openjdk8 using the Zero VM if you apply the 
> patches from
> 
> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=201308
> 
> and additionally modify the Makefile to also allow the correct ARCH 
> settings for powerpc.
> 
> However, that would still require some sort of bootstrapping, so maybe 
> you'd hit the same error still, depending on what is causing that.
> 
> -- 
> Greg Lewis                          Email   : glewis@eyesbeyond.com
> Eyes Beyond                         Web     : http://www.eyesbeyond.com
> Information Technology              FreeBSD : glewis@FreeBSD.org

-- 
Greg Lewis                          Email   : glewis@eyesbeyond.com
Eyes Beyond                         Web     : http://www.eyesbeyond.com
Information Technology              FreeBSD : glewis@FreeBSD.org

[-- Attachment #2 --]
--- ./Makefile
+++ ./Makefile
@@ -78,11 +78,12 @@
 
 DOS2UNIX_FILES=	jdk/src/share/classes/com/sun/org/apache/xml/internal/security/resource/xmlsecurity_en.properties
 
-OPENJDK_OSARCH=	bsd-${ARCH:S/i386/i586/}
+OPENJDK_OSARCH=	bsd-${ARCH:S/i386/x86/:S/amd64/x86_64/:S/armv6/arm/:S/powerpc64/powerpc/}
 
 NOPRECIOUSMAKEVARS=	yes
 
-ONLY_FOR_ARCHS=	i386 amd64
+ONLY_FOR_ARCHS=	i386 amd64 armv6 powerpc64
 
 _MAKE_JOBS=	#
 MAKE_ENV+=	LANG="C" \
@@ -116,6 +117,23 @@
 
 MAKE_ENV+=	HOTSPOT_BUILD_JOBS=${MAKE_JOBS_NUMBER}

 .include <bsd.port.options.mk>

+.if ${ARCH} == "armv6"
+CONFIGURE_ARGS+=	--with-jvm-variants=zero
+
+# we're building a zero build
+JDK_BUILDDIR=	${WRKSRC}/build/${OPENJDK_OSARCH}-normal-zero-${JDK_BUILD_TYPE}
+
+# bootstrap-openjdk is based on openjdk7 and can compile openjdk8
+BOOTSTRAP_JDKS=		${LOCALBASE}/bootstrap-openjdk
+BOOTSTRAPJDKDIR=	${LOCALBASE}/bootstrap-openjdk
+
+# libffi is needed for zerobuild
+BUILD_DEPENDS+= ${BOOTSTRAPJDKDIR}/bin/javac:${PORTSDIR}/java/bootstrap-openjdk
+LIB_DEPENDS+=	libffi.so:${PORTSDIR}/devel/libffi
+.endif
+
+.if ${ARCH} == "powerpc64"
+CONFIGURE_ARGS+=	--with-jvm-variants=zero
+
+# libffi is needed for zerobuild
+BUILD_DEPENDS+= ${BOOTSTRAPJDKDIR}/bin/javac:${PORTSDIR}/java/bootstrap-openjdk
+LIB_DEPENDS+=	libffi.so:${PORTSDIR}/devel/libffi
+
+MAKE_ENV+=	ZERO_BUILD=true \
+			ZERO_ENDIANNESS=big \
+			ZERO_LIBARCH=ppc \
+			ZERO_ARCHDEF=PPC \
+			ZERO_ARCHFLAG="-mpowerpc64" \
+			PARALLEL_COMPILE_JOBS=8 
+
+.endif
+
 BOOTSTRAP_JDKS=	${LOCALBASE}/openjdk7 \
 		${LOCALBASE}/openjdk6 \
 		${LOCALBASE}/bootstrap-openjdk
@@ -143,7 +161,7 @@
 
 # GCC is broken with PCH: https://lists.freebsd.org/pipermail/svn-src-all/2015-March/101722.html
 .if ${COMPILER_TYPE} == gcc
-MAKE_ENV+=	USE_PRECOMPILED_HEADER=0
+MAKE_ENV+=	USE_PRECOMPILED_HEADER=1
 .endif
 
 .if empty(ICONV_LIB)
@@ -160,6 +178,34 @@
 		${WRKSRC}/jdk/make/sun/splashscreen/Makefile \
 		${WRKSRC}/jdk/make/java/npt/Makefile \
 		${WRKSRC}/jdk/make/java/instrument/Makefile
+.endif
+
+.if ${ARCH} == "armv6" || "powerpc64"
+	# From NetBSD http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/lang/openjdk7/hacks.mk
+	# Workaround incorrect constant folding of subnormals in javac when the FPU
+	# does not handle subnormal arithmetic, like on powerpc in Flush-to-zero mode.
+	# These workarounds avoid underflow conditions during the bootstrap so the
+	# JDK can correctly build itself. Compiling or running programs other than
+	# openjdk itself on such hardware may still cause unexpected behaviour.
+	#
+	@${REINPLACE_CMD} -e 's|2.2250738585072014e-308d*|Double.longBitsToDouble(0x10000000000000L)|ig' \
+		-e 's|0x1.0p-1022d*|Double.longBitsToDouble(0x10000000000000L)|ig' \
+		-e 's|4.9e-324d*|Double.longBitsToDouble(0x1L)|ig' \
+		-e 's|0x0.0000000000001p-1022d*|Double.longBitsToDouble(0x1L)|ig' \
+		${WRKSRC}/jdk/src/share/classes/sun/misc/DoubleConsts.java \
+		${WRKSRC}/jdk/src/share/classes/java/lang/Double.java
+	@${REINPLACE_CMD} -e 's|1.17549435e-38f*|Float.intBitsToFloat(0x800000)|ig' \
+		-e 's|0x1.0p-126f*|Float.intBitsToFloat(0x800000)|ig' \
+		-e 's|1.4e-45f*|Float.intBitsToFloat(0x1)|ig' \
+		-e 's|0x0.000002P-126f*|Float.intBitsToFloat(0x1)|ig' \
+		${WRKSRC}/jdk/src/share/classes/sun/misc/FloatConsts.java \
+		${WRKSRC}/jdk/src/share/classes/java/lang/Float.java
+	@${REINPLACE_CMD} -e 's|n.floatValue() == 0.0f && !isZero(proper)|& \&\& Float.floatToIntBits(n) != 0x1|' \
+		-e 's|n.doubleValue() == 0.0d && !isZero(proper)|& \&\& Double.doubleToLongBits(n) != 0x1L|' \
+		${WRKSRC}/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java
+	@${REINPLACE_CMD} -e 's|x == 0.0f && 1.0f / x > 0.0f|Float.floatToIntBits(x) == 0x0|g' \
+		-e 's|x == 0.0d && 1.0d / x > 0.0d|Double.doubleToLongBits(x) == 0x0L|g' \
+		${WRKSRC}/langtools/src/share/classes/com/sun/tools/javac/jvm/Items.java
 .endif
 
 .if ${PORT_OPTIONS:MTZUPDATE}

[-- Attachment #3 --]
#!/bin/sh
cd /usr/ports/tmp/bsd-port
time env -i \
 PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin \
 LANG=C \
 gmake \
 CC=gcc48 \
 CXX=g++48 \
 ALLOW_DOWNLOADS=true \
 ALT_JAVA_HOME=/usr/local/bootstrap-openjdk \
 ALT_BOOTDIR=/usr/local/bootstrap-openjdk \
 ALT_JDK_IMPORT_PATH=/usr/local/bootstrap-openjdk \
 ALT_FREETYPE_HEADERS_PATH=/usr/local/include \
 ALT_FREETYPE_LIB_PATH=/usr/local/lib \
 ALT_CACERTS_FILE=/usr/local/bootstrap-openjdk/jre/lib/security/cacerts \
 LIBFFI_CFLAGS="-I/usr/local/lib/libffi-3.2.1/include" \
 DEFAULT_LIBPATH="/lib:/usr/lib:/usr/local/lib" \
 NO_DOCS=true \
 ZERO_BUILD=true \
 ZERO_ENDIANNESS=big \
 ZERO_LIBARCH=ppc \
 ZERO_ARCHDEF=PPC \
 ZERO_ARCHFLAG="-mpowerpc64" \
 PARALLEL_COMPILE_JOBS=8 \
 HOTSPOT_BUILD_JOBS=8 
home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?005b01d10e87$3fbefcb0$bf3cf610$>