Build OpenJDK 8 for armhf (Raspberry Pi)?

Jim Connors james.connors at oracle.com
Fri May 2 04:00:41 UTC 2014


Hello again,

Just thought I'd provide an update to the forum about my travails in 
trying to build an armhf version of OpenJDK 8...

Gave up trying to cross-compile, and instead built it natively on an Arm 
device.  The Rasberry Pi is woefully underpowered for such and endeavor, 
but I do have a quad-core Cortex-A9 device which is a lot faster.  No 
way near the speed of even a modest laptop, but nonetheless much better.

After fits and starts, here's the configuration which enabled a partial 
build:

$ bash configure --with-jvm-variants=zero --disable-headful 
--with-memory-size=1024 --enable-openjdk-only

Comments:

1.  Added "--disable-headful" because there were errors building what 
looked like part of Java 2d.  As no graphics were required, a headless 
build is just fine.

2. Added "--with-memory-size=1024".  This device only has 1GB RAM, and 
without this option, configure will specify that BOOT_JAVAC be run with 
the following options: "-Xms256M -Xmx512M".  When it comes time to 
compiling the 9416 files for BUILD_JDK, an OutOfMemoryException will be 
thrown.

By providing the "--with-memory-size=1024"option, configure will now 
specify that BOOT_JAVAC will be run with "-Xms400M -Xmx1100M".  The 
astute will notice that -Xmx1100M is actually larger than physical RAM 
which is indeed correct.  Which also means that swap space must be 
configured, and thrashing will take place during certain parts of the 
build.  But hey, that's what was needed.

Also note that these systems traditionally use SD cards as their sole 
filesystem.  The thought of swapping to an SD card based disk sounds 
excruciating and it is.  To alleviate somewhat, I attached a USB hard 
drive and located the build and swap space there.

3. Not sure the "--enable-openjdk-only" is needed.

5. Issued the following command to build:

    $ time make LOG=debug JOBS=4 images

    real    42m16.850s
    user   33m42.020s
    sys     4m42.970s


Cheers,
-- Jim C

On 4/29/2014 12:34 PM, Jim Connors wrote:
> Hello,
>
> Trying to build OpenJDK 8 for armhf, ultimately to be hosted on a 
> Raspberry Pi.  I'm cross compiling from a Ubuntu 12.04 x86 Virtualbox 
> image and am using gcc-4.7-linaro-rpi-gnueabihf for a toolchain.
>
> Configuration invocation looks as follows:
>
> $ bash configure 
> --with-sys-root=/home/jimc/gcc-4.7-linaro-rpi-gnueabihf/ 
> --target=arm-unknown-linux-gnueabihf --with-jvm-variants=zero 
> --with-num-cores=2
>
> The make fails like this:
>
> Compiling /home/jimc/openjdk8/hotspot/src/os/posix/vm/os_posix.cpp
> /home/jimc/openjdk8/hotspot/src/os/linux/vm/os_linux.cpp: In static 
> member function 'static jint os::init_2()':
> /home/jimc/openjdk8/hotspot/src/os/linux/vm/os_linux.cpp:4853:42: 
> error: 'workaround_expand_exec_shield_cs_limit' was not declared in 
> this scope
>
> Might there a set of patches that are required to get this going 
> further?  Anything else I'm missing?
>
> Any pointer greatly appreciated,
> -- Jim C
>
> -- 
>
> *Jim Connors,* Principal Sales Consultant
> Oracle Alliances & Channels | Java Embedded Global Sales Unit
> Office: +1 516.809.5925
> Cell: +1 516.782.5501
> Email: james.connors at oracle.com <mailto:james.connors at oracle.com>
>
> *Learn more about Embeddable Java:*
> http://www.oracle.com/goto/javaembedded
>




More information about the build-dev mailing list