RE: OpenJDK compilation

View: New views
5 Messages — Rating Filter:   Alert me  

Parent Message unknown RE: OpenJDK compilation

by Sorgius, Aaron :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Oops... sorry Xerxes, I left you off my replies.  Just trying to get Java on ARM


> Aaron Sorgius wrote:

>> I've been trying to google for some how-to's on getting OpenJDK
>> compiled on ARM (cortex-A8 specifically).  I came across your website
>> and it looks like you are doing some things that might be able to
>> point me in a helpful direction.  I was hoping to cross compile using
>> an Ubuntu machine.  I have it compiling natively on Ubuntu, but don't
>> know the best way to build for ARM.  Any suggestions?

OpenJDK doesn't support cross-compilation.  It should.


Sorgius, Aaron wrote:
> Hi Andrew,
>
> Guess I won't go that route then :)
> Have you built it natively on ARM?  

> Can it be done without the binaries for the encumbered components (and
> just not use that functionality), or do some exist for ARM now?

It does build ATM, and you don't need the encumbered components if you build from the IcedTea sources.  However, it's segfaulting at startup.

Andrew.


Sorgius, Aaron wrote:
> Hmm... that's not good.  So there is currently no working build for ARM at the moment?  Any place I can check for status updates on the progress so I don't have to bother you with emails?  :)

Talk to Xerxes.  He's doing the work.

It's a good idea to Cc: the distro-pkg-dev@...

Andrew.


This message (including any attachments) contains confidential
and/or proprietary information intended only for the addressee.
Any unauthorized disclosure, copying, distribution or reliance on
the contents of this information is strictly prohibited and may
constitute a violation of law.  If you are not the intended
recipient, please notify the sender immediately by responding to
this e-mail, and delete the message from your system.  If you
have any questions about this e-mail please notify the sender
immediately.

Re: OpenJDK compilation

by Kelly O'Hair :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



Sorgius, Aaron wrote:

> Oops... sorry Xerxes, I left you off my replies.  Just trying to get Java on ARM
>
>
>> Aaron Sorgius wrote:
>
>>> I've been trying to google for some how-to's on getting OpenJDK
>>> compiled on ARM (cortex-A8 specifically).  I came across your website
>>> and it looks like you are doing some things that might be able to
>>> point me in a helpful direction.  I was hoping to cross compile using
>>> an Ubuntu machine.  I have it compiling natively on Ubuntu, but don't
>>> know the best way to build for ARM.  Any suggestions?
>
> OpenJDK doesn't support cross-compilation.  It should.

In general The JDK team hasn't had a need to do much cross-compilation,
with the exception of our past use of Windows X86 to build Windows IA64
(which is a special case of cross-compilation).

In the hotspot Makefiles there is a REMOTE variable that can be used to
cause certain rules to be built with a prefix, such as 'ssh someothermachine'.
This is usually used to run the JDK javac on a different machine, since
it doesn't matter where the class file is compiled (this REMOTE assumes
a shared file system of course).

The JDK builds require a bootstrap JDK, but the JDK build can easily
be primed on a supported machine, and the native libraries displaced.
The JDK Makefiles don't have any kind of REMOTE feature, but that's
certainly possible. (See jdk/make/common/shared/Defs-java.gmk)
http://hg.openjdk.java.net/jdk7/jdk7/jdk/file/tip/make/common/shared/Defs-java.gmk

The JDK build itself is not used during the build procedure until it's
needed to build the demos, just before the JDK images target.
So I imagine the build can only get as far as just before creating
images.

So doing cross compilation is certainly possible, just not easy.
Every time I talk to someone wanting cross-compilation, it turns out
that they have a very specific situation of cross-compilation, not
all situations are the same. I don't see a solution for all situations.

-kto

>
>
> Sorgius, Aaron wrote:
>> Hi Andrew,
>>
>> Guess I won't go that route then :)
>> Have you built it natively on ARM?  
>
>> Can it be done without the binaries for the encumbered components (and
>> just not use that functionality), or do some exist for ARM now?
>
> It does build ATM, and you don't need the encumbered components if you build from the IcedTea sources.  However, it's segfaulting at startup.
>
> Andrew.
>
>
> Sorgius, Aaron wrote:
>> Hmm... that's not good.  So there is currently no working build for ARM at the moment?  Any place I can check for status updates on the progress so I don't have to bother you with emails?  :)
>
> Talk to Xerxes.  He's doing the work.
>
> It's a good idea to Cc: the distro-pkg-dev@...
>
> Andrew.
>
>
> This message (including any attachments) contains confidential
> and/or proprietary information intended only for the addressee.
> Any unauthorized disclosure, copying, distribution or reliance on
> the contents of this information is strictly prohibited and may
> constitute a violation of law.  If you are not the intended
> recipient, please notify the sender immediately by responding to
> this e-mail, and delete the message from your system.  If you
> have any questions about this e-mail please notify the sender
> immediately.

Re: OpenJDK compilation

by Christian Thalinger :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, 2008-07-22 at 09:44 -0700, Kelly O'Hair wrote:

>
> Sorgius, Aaron wrote:
> > Oops... sorry Xerxes, I left you off my replies.  Just trying to get Java on ARM
> >
> >
> >> Aaron Sorgius wrote:
> >
> >>> I've been trying to google for some how-to's on getting OpenJDK
> >>> compiled on ARM (cortex-A8 specifically).  I came across your website
> >>> and it looks like you are doing some things that might be able to
> >>> point me in a helpful direction.  I was hoping to cross compile using
> >>> an Ubuntu machine.  I have it compiling natively on Ubuntu, but don't
> >>> know the best way to build for ARM.  Any suggestions?
> >
> > OpenJDK doesn't support cross-compilation.  It should.
>
> In general The JDK team hasn't had a need to do much cross-compilation,
> with the exception of our past use of Windows X86 to build Windows IA64
> (which is a special case of cross-compilation).
>
> In the hotspot Makefiles there is a REMOTE variable that can be used to
> cause certain rules to be built with a prefix, such as 'ssh someothermachine'.
> This is usually used to run the JDK javac on a different machine, since
> it doesn't matter where the class file is compiled (this REMOTE assumes
> a shared file system of course).
>
> The JDK builds require a bootstrap JDK, but the JDK build can easily
> be primed on a supported machine, and the native libraries displaced.
> The JDK Makefiles don't have any kind of REMOTE feature, but that's
> certainly possible. (See jdk/make/common/shared/Defs-java.gmk)
> http://hg.openjdk.java.net/jdk7/jdk7/jdk/file/tip/make/common/shared/Defs-java.gmk
>
> The JDK build itself is not used during the build procedure until it's
> needed to build the demos, just before the JDK images target.
> So I imagine the build can only get as far as just before creating
> images.
>
> So doing cross compilation is certainly possible, just not easy.
> Every time I talk to someone wanting cross-compilation, it turns out
> that they have a very specific situation of cross-compilation, not
> all situations are the same. I don't see a solution for all situations.

Hi!

I have successfully cross-compiled IcedTea on x86_64 Linux for ARM Linux
(with CACAO as VM).  Except some stuff I have disabled in the build
system, because I didn't have the headers and libraries (ALSA, ...), all
stuff is working, like AWT/Swing.

The only problem during cross-compilation is the sizer.32 executable,
which has to be run on the target machine:

$ file ./gensrc/sun/awt/X11/generator/sizer.32
./gensrc/sun/awt/X11/generator/sizer.32: ELF 32-bit LSB executable, ARM,
version 1 (SYSV), for GNU/Linux 2.6.14, dynamically linked (uses shared
libs), not stripped

But this can be done manually and the result file copied over into the
cross-build system.

- twisti


Parent Message unknown Re: OpenJDK compilation (ARM native buildsystem installation)

by Xerxes Rånby :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

When you have a working system running Fedora core 8 on a ARM platform
with network support you can install all required packages to build
Icedtea6 by running yum.

yum install vi mercurial cups-devel lesstif-devel libXp-devel
libXtst-devel libXi-devel xalan-j2 xerces-j2 \
libXt-devel freetype-devel gcc gcc-c++ wget java-1.5.0-gcj-devel
alsa-lib-devel firefox-devel glib2-devel gtk2-devel \
ant libXinerama-devel libjpeg-devel libpng-devel giflib-devel patch tar
unzip make gzip rhino

When i did my last install yum complained that the eclipse-ecj package
could not be found precompiled for armv5tel but there is a quick fix for
that!
There is one available compiled by one of the Fedora core 8 maintainers
for armv5tejl yet since the jazelle instructions is not used it can be
installed on a armv5tel system!
rpm -i --ignorearch
http://www.wantstofly.org/~buytenh/RPMS.built.crap/eclipse-ecj-3.3.0-30.fc8.armv5tejl.rpm

To improve your development experience i reccomend you to install a
openssh server on your target!
gdb and ddd are usefull to have if you are going to do some debugging!

then you can simply ssh in to the target running ssh -X
username@armdevtarget
and do remote graphical debugging with ddd by simply running ddd
./executableToBeDebugged on the target!

With everything in place you can get the icedtea6 sources by running
hg clone http://icedtea.classpath.org/hg/icedtea6
cd icedtea6
autoconf
./configure --disable-docs
make

Some current issues with Icedtea6 on ARM:

If the compile complains about libffi headerfiles redeclared #ARM
install libffi from sources. this have been fixed in libffi releases
3.0.5 and above.
ftp://sources.redhat.com/pub/libffi/

It will build ok but then the built java will segfault when run.
Yesterday it wave been sorted out that the segfault was optimization
related. With gcc compiler v 4.1.2 shipped with fc8  a pointer got
mangled during execution when compiled with -O3 optimization on ARM target.
You can manually change the file
openjdk-ecj/hotspot/build/linux/makefiles/gcc.make to change the
optimization to -O0      (the file exists after make have downloaded the
openjdk sources unpacked them and patched them)
Or better install a more recent gcc like 4.3.1 from source.
Im currently doing both and will see at the end of this day if all
systems are go when running a -O0 compilation.

Several Java alternatives for ARM based on free software:

The description above compiles Icedtea6 with the default zero hotspot
for ARM.

If you want to test some java code quickly on arm first try running your
code using gcj ! Some swing applications do work and you can test JNI
bindings and more. gcj can run java code both interperted and
precompiled to native code. When gcj is installed you can run java
classes by simply using the java "wrapper" command. Icedtea uses gcj för
bootstrapping itself aswell!

Icedtea can be configured to use CACAO as VM instead of the default zero
hotspot. Christian Thalinger have made this JIT VM compile and run with
the icedtea classes on hos ARM machines. Ask him about anything Cacao
related!

There is a new shark hotspot you could try as well with JIT support that
can be enabled during configure of Icedtea6. This is all new cool and
experimental.

Have a great day!
Xerxes


Xerxes Rånby skrev:

> Hi Aaron!
>
> Some quick notes how i installed a native arm build system to compile
> icedtea6.
>
> I have set up a build environment using the Fedora core 8 ARM
> distribution.
> http://fedoraproject.org/wiki/Architectures/ARM
>
> I have a AT91SAM9263 based arm-devkit (armv5tejl cpu). Yet when
> running the build system on that one it is too slow since my devkit
> have only about 98mb of ram.
> Instead I have set up my build system on a emulated arm platform by
> using the qemu emulator.
> http://fedoraproject.org/wiki/Architectures/ARM/HowToQemu
>
> My installation went like this:
>
> First i downloaded a prebuild rootfilesystem for fc8:
> http://ftp.linux.org.uk/pub/linux/arm/fedora/rootfs/rootfs-f8.tar.bz2
> I uncompressed the rootfilesystem to a ext3 filesystem on a
> usbmemorystick for my real hardware and on a loopbackmounted image
> file for use in qemu.
>
> Then you have to compile your own linux kernel if you are going to run
> it on your own hardware, there are prebuilt kernels from the fc8
> homepage for emulated systems.
>
> for my real hardware i booted up my system by letting the hardware
> load the kernel over a tftp server and boot the filesystem directly
> from the usbflashdrive.
>
> on qemu it is just a matter of supplying the correct bootflags to the
> qemu emulator to load the kernel and instruct it to use the image file
> like a harddrive.
>
> i added some swapspace to both systems as well.
>
> ok.. now with everything in place fc8 can boot up!
>
> When you have fedora 8 running with networking up it is possible to
> install all the devtools you need by using the yum command.
>
> i will continue in the next letter with some instructions what to
> install using yum.
> comment if it is something you wish to have clarifyed.
>
> Have a great day!
> Xerxes
>


Parent Message unknown Re: OpenJDK compilation (ARM native buildsystem installation)

by Xerxes Rånby :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



Sorgius, Aaron skrev:
> I have made considerable progress today I think.  I figured out I had to run aclocal before autoconf.  Also had to install cpio and file.  But I'm getting an error I haven't gotten past yet when running configure.
>
> Configure: error: Could not find libffi headers -    Try installing libffi-devel, libffi-dev or libffi4-dev
>
> I have not tried installing those, but rather took your advice and installed libffi-3.0.6 from source.  This did not help.  I'm calling my work on this a day now, but tomorrow I will try installing libffi-devel and see if that fixes the configure issue.
>
>  
Install libffi-devel package. There is a quick fix to make libffi 3.0.1
compatible with the icedtea build system
when the libffi-devel package is installed edit the file
/usr/lib/libffi-3.0.1/ffi.h and change the line about one page from the top
from
/* Specify wich architecture libffi is configures for. */
#define ARM

to
/* Specify wich architecture libffi is configures for. */
#ifndef ARM
#define ARM
#endif

then it should work!
> Interested to hear if your -O0 flag worked.
>
>  
It was a moderate success with -O0 optimization, the segfaults disapeared!

Instead java executes a bit further and then stops and complains about
running out of memory during launch like this:
[xerxes@fedora-arm bin]$ cd openjdk-ecj/control/build/linux-arm/j2sdk-image
[xerxes@fedora-arm bin]$ ./java -version
Error occurred during initialization of VM
Could not reserve enough space for object heap

There are some options that alter how much heap java can allocate like:

  -Xms<size>        set initial Java heap size
  -Xmx<size>        set maximum Java heap size
  -Xss<size>        set java thread stack size

yet even when i run java with
./java -Xmx600M it still runs out of heap.

i will try a -O2 optimization today and do some furter debugging of the
-O0 optimized one.

Have a great day!
Xerxes

> Cheers,
> Aaron
>
>
> -----Original Message-----
> From: Xerxes Rånby [mailto:xerxes@...]
> Sent: Wednesday, July 23, 2008 8:17 AM
> To: Sorgius, Aaron; distro-pkg-dev@...
> Subject: Re: OpenJDK compilation (ARM native buildsystem installation)
>
> When you have a working system running Fedora core 8 on a ARM platform
> with network support you can install all required packages to build
> Icedtea6 by running yum.
>
> yum install vi mercurial cups-devel lesstif-devel libXp-devel
> libXtst-devel libXi-devel xalan-j2 xerces-j2 \
> libXt-devel freetype-devel gcc gcc-c++ wget java-1.5.0-gcj-devel
> alsa-lib-devel firefox-devel glib2-devel gtk2-devel \
> ant libXinerama-devel libjpeg-devel libpng-devel giflib-devel patch tar
> unzip make gzip rhino
>
> When i did my last install yum complained that the eclipse-ecj package
> could not be found precompiled for armv5tel but there is a quick fix for
> that!
> There is one available compiled by one of the Fedora core 8 maintainers
> for armv5tejl yet since the jazelle instructions is not used it can be
> installed on a armv5tel system!
> rpm -i --ignorearch
> http://www.wantstofly.org/~buytenh/RPMS.built.crap/eclipse-ecj-3.3.0-30.fc8.armv5tejl.rpm
>
> To improve your development experience i reccomend you to install a
> openssh server on your target!
> gdb and ddd are usefull to have if you are going to do some debugging!
>
> then you can simply ssh in to the target running ssh -X
> username@armdevtarget
> and do remote graphical debugging with ddd by simply running ddd
> ./executableToBeDebugged on the target!
>
> With everything in place you can get the icedtea6 sources by running
> hg clone http://icedtea.classpath.org/hg/icedtea6
> cd icedtea6
> autoconf
> ./configure --disable-docs
> make
>
> Some current issues with Icedtea6 on ARM:
>
> If the compile complains about libffi headerfiles redeclared #ARM
> install libffi from sources. this have been fixed in libffi releases
> 3.0.5 and above.
> ftp://sources.redhat.com/pub/libffi/
>
> It will build ok but then the built java will segfault when run.
> Yesterday it wave been sorted out that the segfault was optimization
> related. With gcc compiler v 4.1.2 shipped with fc8  a pointer got
> mangled during execution when compiled with -O3 optimization on ARM target.
> You can manually change the file
> openjdk-ecj/hotspot/build/linux/makefiles/gcc.make to change the
> optimization to -O0      (the file exists after make have downloaded the
> openjdk sources unpacked them and patched them)
> Or better install a more recent gcc like 4.3.1 from source.
> Im currently doing both and will see at the end of this day if all
> systems are go when running a -O0 compilation.
>
> Several Java alternatives for ARM based on free software:
>
> The description above compiles Icedtea6 with the default zero hotspot
> for ARM.
>
> If you want to test some java code quickly on arm first try running your
> code using gcj ! Some swing applications do work and you can test JNI
> bindings and more. gcj can run java code both interperted and
> precompiled to native code. When gcj is installed you can run java
> classes by simply using the java "wrapper" command. Icedtea uses gcj för
> bootstrapping itself aswell!
>
> Icedtea can be configured to use CACAO as VM instead of the default zero
> hotspot. Christian Thalinger have made this JIT VM compile and run with
> the icedtea classes on hos ARM machines. Ask him about anything Cacao
> related!
>
> There is a new shark hotspot you could try as well with JIT support that
> can be enabled during configure of Icedtea6. This is all new cool and
> experimental.
>
> Have a great day!
> Xerxes
>
>
> Xerxes Rånby skrev:
>  
>> Hi Aaron!
>>
>> Some quick notes how i installed a native arm build system to compile
>> icedtea6.
>>
>> I have set up a build environment using the Fedora core 8 ARM
>> distribution.
>> http://fedoraproject.org/wiki/Architectures/ARM
>>
>> I have a AT91SAM9263 based arm-devkit (armv5tejl cpu). Yet when
>> running the build system on that one it is too slow since my devkit
>> have only about 98mb of ram.
>> Instead I have set up my build system on a emulated arm platform by
>> using the qemu emulator.
>> http://fedoraproject.org/wiki/Architectures/ARM/HowToQemu
>>
>> My installation went like this:
>>
>> First i downloaded a prebuild rootfilesystem for fc8:
>> http://ftp.linux.org.uk/pub/linux/arm/fedora/rootfs/rootfs-f8.tar.bz2
>> I uncompressed the rootfilesystem to a ext3 filesystem on a
>> usbmemorystick for my real hardware and on a loopbackmounted image
>> file for use in qemu.
>>
>> Then you have to compile your own linux kernel if you are going to run
>> it on your own hardware, there are prebuilt kernels from the fc8
>> homepage for emulated systems.
>>
>> for my real hardware i booted up my system by letting the hardware
>> load the kernel over a tftp server and boot the filesystem directly
>> from the usbflashdrive.
>>
>> on qemu it is just a matter of supplying the correct bootflags to the
>> qemu emulator to load the kernel and instruct it to use the image file
>> like a harddrive.
>>
>> i added some swapspace to both systems as well.
>>
>> ok.. now with everything in place fc8 can boot up!
>>
>> When you have fedora 8 running with networking up it is possible to
>> install all the devtools you need by using the yum command.
>>
>> i will continue in the next letter with some instructions what to
>> install using yum.
>> comment if it is something you wish to have clarifyed.
>>
>> Have a great day!
>> Xerxes
>>
>>    
>
>
>
> This message (including any attachments) contains confidential
> and/or proprietary information intended only for the addressee.  
> Any unauthorized disclosure, copying, distribution or reliance on
> the contents of this information is strictly prohibited and may
> constitute a violation of law.  If you are not the intended
> recipient, please notify the sender immediately by responding to
> this e-mail, and delete the message from your system.  If you
> have any questions about this e-mail please notify the sender
> immediately.
>  

LightInTheBox - Buy quality products at wholesale price