From sgehwolf at redhat.com Tue Dec 9 09:27:06 2014 From: sgehwolf at redhat.com (Severin Gehwolf) Date: Tue, 09 Dec 2014 10:27:06 +0100 Subject: How to cross compile OpenJDK for Arm32? In-Reply-To: <54858F7F.6060707@oracle.com> References: <54858F7F.6060707@oracle.com> Message-ID: <1418117226.3210.5.camel@localhost.localdomain> Hi, On Mon, 2014-12-08 at 21:46 +1000, David Holmes wrote: > On 8/12/2014 7:10 PM, ChenLong wrote: > > Hi > > > > Apologize if this is not the right place to ask. > > I want to try OpenJDK8 on Armv7. Is there a guideline on how to cross compile OpenJDK8 for Armv7? And if not, could someone share some experiences? I went through the README-builds.html and did not find any clues for cross compiling. > > The only OpenJDK build for ARM would be a ZERO build. But I don't know > how to do Zero builds - though I'm sure the Zero folk will chime in. CC'ing zero-dev. I've done Zero builds before but have never used OpenJDK's cross-compile feature to build it on ARMv7. There is an Arm32 bit JIT in IcedTea[1], but I don't know if that can be cross-compiled. Cheers, Severin [1] http://blog.fuseyism.com/index.php/2014/03/28/icedtea-2-3-14-2-4-6-considered-armful-released/ > David > > > Thanks > > Chen Long > > From xerxes at zafena.se Tue Dec 9 11:16:10 2014 From: xerxes at zafena.se (=?UTF-8?B?WGVyeGVzIFLDpW5ieQ==?=) Date: Tue, 09 Dec 2014 12:16:10 +0100 Subject: How to cross compile OpenJDK for Arm32? In-Reply-To: <1418117226.3210.5.camel@localhost.localdomain> References: <54858F7F.6060707@oracle.com> <1418117226.3210.5.camel@localhost.localdomain> Message-ID: <5486D9FA.9050606@zafena.se> Den 2014-12-09 10:27, Severin Gehwolf skrev: > Hi, > > On Mon, 2014-12-08 at 21:46 +1000, David Holmes wrote: >> On 8/12/2014 7:10 PM, ChenLong wrote: >>> Hi >>> >>> Apologize if this is not the right place to ask. >>> I want to try OpenJDK8 on Armv7. Is there a guideline on how to cross compile OpenJDK8 for Armv7? And if not, could someone share some experiences? I went through the README-builds.html and did not find any clues for cross compiling. >> The only OpenJDK build for ARM would be a ZERO build. But I don't know >> how to do Zero builds - though I'm sure the Zero folk will chime in. > CC'ing zero-dev. when I cross-compile OpenJDK 9 for ARM32 I pass the following configure options configure # these options tell openjdk to do a cross compile build. --build=x86_64-unknown-linux-gnu --host=arm-buildroot-linux-gnueabi --target=arm-buildroot-linux-gnueabi # these two options enable zero --with-jvm-interpreter=cpp --with-jvm-variants=zero # specific options to make the build find the X and freetype headers and librarys found on the ARM32 root filesystem. --disable-freetype-bundling --with-freetype-include=/home/xranby/rpi-buildroot/output/host/usr/arm-buildroot-linux-gnueabi/sysroot/usr/include/freetype2 --with-freetype-lib=/home/xranby/rpi-buildroot/output/host/usr/arm-buildroot-linux-gnueabi/sysroot/usr/lib --with-freetype=/home/xranby/rpi-buildroot/output/host/usr/arm-buildroot-linux-gnueabi/sysroot/usr/ --with-x=/home/xranby/rpi-buildroot/output/host/usr/arm-buildroot-linux-gnueabi/sysroot/usr/include # the sysroot shall point to the ARM32 root file system, the build will use librarys inside the sys root during linking native libraries. --with-sys-root=/home/xranby/rpi-buildroot/output/host/usr/arm-buildroot-linux-gnueabi/sysroot # The tools dir contains binarys to run on the host x86 system, you may point this to your system root dir / # in my case the tools i use have been compiled by buildroot thus I use the buildroot tools dir. --with-tools-dir=/home/xranby/rpi-buildroot/output/host # OpenJDK 9 require OpenJDK 8, i point with boot jdk to an OpenJDK 8 image that can be run on the host x86 system. --with-boot-jdk=/home/xranby/images-jdk8/j2sdk-image/ # some parts of the openjdk build still expect that the cross compile tools are found in the system PATH # on my system i have to explicitly tell where the tools are located because my cross compile toolchain is not found on the path. # i use gcc to do the linking instead of ld because the openjdk build passes -Xlinker -z OBJCOPY=/home/xranby/rpi-buildroot/output/host/usr/bin/arm-buildroot-linux-gnueabi-objcopy STRIP=/home/xranby/rpi-buildroot/output/host/usr/bin/arm-buildroot-linux-gnueabi-strip CPP=/home/xranby/rpi-buildroot/output/host/usr/bin/arm-buildroot-linux-gnueabi-cpp CXX=/home/xranby/rpi-buildroot/output/host/usr/bin/arm-buildroot-linux-gnueabi-g++ CC=/home/xranby/rpi-buildroot/output/host/usr/bin/arm-buildroot-linux-gnueabi-gcc LD=/home/xranby/rpi-buildroot/output/host/usr/bin/arm-buildroot-linux-gnueabi-gcc CPP_FLAGS=-lstdc++ CXX_FLAGS=-lstdc++ when running make i pass the following options to make # BUILD_CC and BUILD_LD shall point to host x86 executables. BUILD_CC=gcc BUILD_LD=gcc OBJCOPY=/home/xranby/rpi-buildroot/output/host/usr/bin/arm-buildroot-linux-gnueabi-objcopy STRIP=/home/xranby/rpi-buildroot/output/host/usr/bin/arm-buildroot-linux-gnueabi-strip CPP=/home/xranby/rpi-buildroot/output/host/usr/bin/arm-buildroot-linux-gnueabi-cpp CXX=/home/xranby/rpi-buildroot/output/host/usr/bin/arm-buildroot-linux-gnueabi-g++ CC=/home/xranby/rpi-buildroot/output/host/usr/bin/arm-buildroot-linux-gnueabi-gcc LD=/home/xranby/rpi-buildroot/output/host/usr/bin/arm-buildroot-linux-gnueabi-gcc #and finally the target, this will build compact profiles, jre and jdk images. all images profiles CONF=linux-arm-normal-zero-release I have automated these configure and make options for openjdk 9 into buildroot build scripts https://github.com/xranby/rpi-buildroot/tree/openjdk > > I've done Zero builds before but have never used OpenJDK's cross-compile > feature to build it on ARMv7. There is an Arm32 bit JIT in IcedTea[1], > but I don't know if that can be cross-compiled. If you cross compile icedtea then you need to make sure that the bytecode generator tool is compiled by the host x86 toolchain. openembedded meta-java contains buildscripts that can cross compile the Arm32 JIT found in IcedTea. https://github.com/woglinde/meta-java Cheers Xerxes > > Cheers, > Severin > > [1] > http://blog.fuseyism.com/index.php/2014/03/28/icedtea-2-3-14-2-4-6-considered-armful-released/ > >> David >> >>> Thanks >>> Chen Long >>> > > From aph at redhat.com Wed Dec 10 09:08:21 2014 From: aph at redhat.com (Andrew Haley) Date: Wed, 10 Dec 2014 09:08:21 +0000 Subject: How to cross compile OpenJDK for Arm32? In-Reply-To: References: Message-ID: <54880D85.3040502@redhat.com> On 10/12/14 03:29, ChenLong wrote: > 2) Is there any place that I can download prebuilt sysroot/rootfs? That would be great helpful. It makes far more sense simply to copy the root filesystem from your target. You really don't want someone else's sysroot. Andrew.