Java on Raspbian


106 posts   Page 2 of 5   1, 2, 3, 4, 5
by neaso » Mon Jul 23, 2012 1:31 am
I would love to be able to run the Oracle EJRE on Raspbian. I don't understand the ABI issues enough but is the soft-float EJRE unable to run because the loader is unable to link in the so? Or is it because the libc is incompatible?

When I tried running
Code: Select all
ejre-1_6_0_32-fcs-b05-linux-arm-vfp-eabi-headless-05_apr_2012.gz


On Raspbian I would get an error
Code: Select all
java: error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory


Using strace I watched java try and load the libjli.so and still give me the error. Leading me to believe that it didn't know how to load an so of that type.

Is there a fundamental reason why a system can't run both types of calling conventions?

Having benchmarked using scimark both JamVM and the Oracle EJRE on archlinux, I can say that the Oracle JVM is about 8x faster than JamVM.

Code: Select all
SciMark 2.0a

Composite Score: 21.582351383019546
FFT (1024): 19.018674527942434
SOR (100x100):   42.90512330810745
Monte Carlo : 7.770827523163708
Sparse matmult (N=1000, nz=5000): 15.485822417908741
LU (100x100): 22.731309137975405

java.vendor: Sun Microsystems Inc.
java.version: 1.6.0_32
os.arch: arm
os.name: Linux
os.version: 3.1.9-20-ARCH+

JRE Package:ejre-1_6_0_32-fcs-b05-linux-arm-vfp-eabi-headless-05_apr_2012.gz


vs

Code: Select all
 /usr/local/jamvm/bin/jamvm -cp /tmp/scimark2lib.jar jnt.scimark2.commandline   
SciMark 2.0a

Composite Score: 2.852721052522502
FFT (1024): 1.782223294969543
SOR (100x100):   4.894127477682866
Monte Carlo : 0.5537766128184834
Sparse matmult (N=1000, nz=5000): 3.294723252262579
LU (100x100): 3.738754624879039

java.vendor: GNU Classpath
java.version: 1.5.0
os.arch: arm
os.name: Linux
os.version: 3.1.9-20-ARCH+

JRE Package:JamVM 1.5.4 gnuclasspath via packman (0.98)
Posts: 5
Joined: Sat Jul 21, 2012 8:54 pm
by mpthompson » Mon Jul 23, 2012 3:55 am
neaso wrote:Using strace I watched java try and load the libjli.so and still give me the error. Leading me to believe that it didn't know how to load an so of that type.


Yes, this is correct. As far as Debian/Raspbian Wheezy armhf is concerned, the armel packages are as alien to it as i386 packages and it will refuse to load or perform runtime linking.

neaso wrote:Is there a fundamental reason why a system can't run both types of calling conventions?


Theoretically, it should be possible to run Debian Wheezy armel binaries on a Debian Wheezy armhf system (which is essentially what Raspbian is) using a mechanism called multiarch. I don't know much about it other than that it exists. Plugwash seems more familiar with the technology and may able to provide an answer as to why or why not it may be a possible solution for packages only supported under Debian armel. I don't believe it's fully implemented yet, but the good news is that Debian is targetting armhf as one of the platforms for it to be working on first.

Multiarch documentation from Debian is here: http://wiki.debian.org/Multiarch/

An end user howto is here: http://wiki.debian.org/Multiarch/HOWTO

If someone does try to get multiarch working with the Java JRE or with some other package, please report back success or failure.
User avatar
Forum Moderator
Forum Moderator
Posts: 620
Joined: Fri Feb 03, 2012 7:18 pm
Location: San Carlos, CA
by rlougher » Mon Jul 23, 2012 9:46 am
Your benchmark results for JamVM are rather low. Can you tell me which configure options you used and the gcc version? Also, just to be clear, you are testing JamVM with GNU Classpath, and not OpenJDK?

Anyway, here's my figures for OpenJDK/JamVM on raspbian:

SciMark 2.0a

Composite Score: 4.367919110173835
FFT (1024): 2.8295016700944284
SOR (100x100): 8.338042506531783
Monte Carlo : 0.8230580533505529
Sparse matmult (N=1000, nz=5000): 4.193284343943708
LU (100x100): 5.655708976948698

A couple of minor changes are needed to get JamVM to work on raspbian (when I ported JamVM to armhf, I took the opportunity to use thumb2, as armhf specified this as a minimum requirement). Hopefully I'll check these changes in tonight.

Rob.
Posts: 6
Joined: Mon Jul 23, 2012 9:39 am
by plugwash » Mon Jul 23, 2012 11:30 am
rlougher wrote:A couple of minor changes are needed to get JamVM to work on raspbian (when I ported JamVM to armhf, I took the opportunity to use thumb2, as armhf specified this as a minimum requirement). Hopefully I'll check these changes in tonight.

Can you provide us a link to the patch, it would be good to be able to re-enable jamvm in our openjdk packages.
Forum Moderator
Forum Moderator
Posts: 2335
Joined: Wed Dec 28, 2011 11:45 pm
by rlougher » Mon Jul 23, 2012 12:20 pm
plugwash wrote:Can you provide us a link to the patch, it would be good to be able to re-enable jamvm in our openjdk packages.

I'll check it in some time tonight (UK time) and generate a patch, though I'm not sure if the patch will be much use. This is where my ignorance of both the IcedTea build system and its Debian package comes in...

JamVM, when configured for OpenJDK, provides a libjvm.so. For testing purposes I just copy this over an existing IcedTea/OpenJDK install.

Unfortunately, I didn't do the build changes to IcedTea for JamVM. So how JamVM gets built as part of IcedTea, and how the libjvm.so ends up in the package is mostly a mystery to me (I do know it downloads a snapshot of JamVMs GIT tree). Once I've checked the changes into JamVMs GIT tree, I'll let Xerxes Randby know. Hopefully they'll then end up in IcedTea sometime...

Rob.
Posts: 6
Joined: Mon Jul 23, 2012 9:39 am
by plugwash » Mon Jul 23, 2012 2:30 pm
Well debian packages aren't allowed to download anything during package build so the source must be in the debian source package somewhere, it's "just" a matter of finding out where it is and how to apply a patch to it.
Forum Moderator
Forum Moderator
Posts: 2335
Joined: Wed Dec 28, 2011 11:45 pm
by dacha » Wed Aug 01, 2012 5:09 am
mpthompson wrote:Java is a place where Raspbian could really use help from people in the Raspberry Pi community who have an interest in Java. There are similar issues with Mono as well. Hopefully some very experienced Java developers can examine the Debian openjdk package and other Java related packages and tell us what changes need to be made to the build configurations to improve Java support. Plugwash and I try to do the best we can, but our experience with Java is very limited and our ability to really test and optimize the builds is limited as well.


The Avian Java virtual machine (http://oss.readytalk.com/avian/) always worked on the Raspberry Pi with a soft-float ABI, and as of yesterday, it works on Raspbian's hard-float ABI too :) (https://groups.google.com/forum/#!topic ... nz4JZEPwZs).

Now we just have to get OpenJDK7's class library installed so Avian can use it instead of its own incomplete internal class library.
Posts: 11
Joined: Sun Jun 17, 2012 4:35 pm
by plugwash » Wed Aug 01, 2012 9:43 am
I uploaded openjdk-7 to the raspbian repo recently, the contamination checker says it's clean but I haven't actually tested it on a Pi yet.
Forum Moderator
Forum Moderator
Posts: 2335
Joined: Wed Dec 28, 2011 11:45 pm
by dacha » Wed Aug 01, 2012 11:52 am
plugwash wrote:I uploaded openjdk-7 to the raspbian repo recently, the contamination checker says it's clean but I haven't actually tested it on a Pi yet.


Since you manage the repository, let me report that the CACAO JVM already in that repository definitely isn't clean, as all it takes to crash it is this:

Code: Select all
public class Hello {
  public static void main(String args[]) throws Exception {
    System.out.println(3.0);
  }
}

javac Hello.java
java -cacao Hello
Posts: 11
Joined: Sun Jun 17, 2012 4:35 pm
by kermitas » Sat Aug 04, 2012 2:35 pm
I'm also stuck on this Java problem :cry: :cry: :cry: .

My first and based target is to use rpi with Java. Until now I used Oracle Embedded Java 7.

I have two questions:
- is it possible that one of this commands apt-get update, apt-get upgrade or rpi-update automatically switched me from Squeeze to Wheezy hardfp?? (is it safe to do updates, I don't want to be switched form softfp to hardfp...)
- will Debian Squeeze repositories for rpi be updated in future ? (or all work will go to Wheezy hardfp and Java users will have to use old, never updated software)

Thanks,
Arthur.
Posts: 108
Joined: Thu Jan 26, 2012 11:49 am
by dacha » Sun Aug 05, 2012 8:05 pm
plugwash wrote:
rlougher wrote:A couple of minor changes are needed to get JamVM to work on raspbian (when I ported JamVM to armhf, I took the opportunity to use thumb2, as armhf specified this as a minimum requirement). Hopefully I'll check these changes in tonight.

Can you provide us a link to the patch, it would be good to be able to re-enable jamvm in our openjdk packages.


No need for a patch. The only problem JamVM has is that its own JNI invocation mechanism through src/os/linux/arm/callNativeEABI.S doesn't work correctly on Raspbian's hardfp ABI. But JamVM also supports using libffi as an alternative JNI mechanism, which works fine. You enable it as follows:
Code: Select all
./configure --enable-ffi
Posts: 11
Joined: Sun Jun 17, 2012 4:35 pm
by kermitas » Mon Aug 06, 2012 11:20 am
kermitas wrote:I'm also stuck on this Java problem :cry: :cry: :cry: .

My first and based target is to use rpi with Java. Until now I used Oracle Embedded Java 7.

I have two questions:
- is it possible that one of this commands apt-get update, apt-get upgrade or rpi-update automatically switched me from Squeeze to Wheezy hardfp?? (is it safe to do updates, I don't want to be switched form softfp to hardfp...)
- will Debian Squeeze repositories for rpi be updated in future ? (or all work will go to Wheezy hardfp and Java users will have to use old, never updated software)

Thanks,
Arthur.


I am kindly asking if anybody know responses for my questions...

Thanks, Arthur.
Posts: 108
Joined: Thu Jan 26, 2012 11:49 am
by plugwash » Mon Aug 06, 2012 1:08 pm
kermitas wrote:- is it possible that one of this commands apt-get update, apt-get upgrade or rpi-update automatically switched me from Squeeze to Wheezy hardfp?? (is it safe to do updates, I don't want to be switched form softfp to hardfp...)

Upgrades will not switch you from armel to armhf, you have nothing to worry about there.

- will Debian Squeeze repositories for rpi be updated in future ? (or all work will go to Wheezy hardfp and Java users will have to use old, never updated software)

Debian squeeze is a stable release and as such the only updates it will likely get from debian will be security updates etc.

For the Pi specific stuff you can either use rpi-update or install friggle's packages

You also have the option of using armel wheezy. viewtopic.php?f=50&t=8071
Forum Moderator
Forum Moderator
Posts: 2335
Joined: Wed Dec 28, 2011 11:45 pm
by kermitas » Mon Aug 06, 2012 1:42 pm
plugwash wrote:You also have the option of using armel wheezy. viewtopic.php?f=50&t=8071


Thank you for your response.

Yes, I have just discovered that I can use Wheezy softfp from here http://www.raspberrypi.org/archives/1435 (2012-06-18-wheezy-beta.zip). I read that it is better than Squeeze. Now I am updating it (apt-get update, apt-get upgrade, rpi-update).

What about 2012-06-18-wheezy-beta.zip repositories? Will they be always up-to-date?

Thanks:)
Posts: 108
Joined: Thu Jan 26, 2012 11:49 am
by gjb2048 » Sat Aug 11, 2012 6:03 pm
Hi,

I'm getting the same error, is there a way of getting the 'libjli.so' file installed on Raspbian?

Thanks,

Gareth
Posts: 7
Joined: Fri Aug 10, 2012 5:07 pm
by kermitas » Sat Aug 11, 2012 6:29 pm
Many would love to run Oracle Embedded Java on Debian Wheezy hardfp :).

I'm also waiting for any news in this subject!
Posts: 108
Joined: Thu Jan 26, 2012 11:49 am
by rbair » Sun Aug 12, 2012 6:18 am
mpthompson wrote:
acobley wrote:Any ideas ?


Andy, looking at what's available at that site, I don't see any binaries that are supported by Raspbian. The armv6 binaries use the soft float ABI (armel) which is incompatible with Raspbian. Even their armv7 binaries use the soft float ABI which I find a little curious, but there is probably a good reason for that from their perspective.

I live about two miles from the Oracle headquarters in Redwood Shores, CA and I would be happy to see what I could to help them create armv6 hard float ABI (armhf) binaries that would run under Raspbian, but someone would have to contact Oracle to see if there is interest on their behalf.


I'm the Java Client Architect at Oracle. We're both very interested in supporting the Raspberry PI, not only with JavaSE Embedded but also with JavaFX. We have an alpha hard-float JVM and I'm going to be giving it a try along with recompiled JavaFX binaries in hard float to see how this device is going to look.

mpthompson, I'd love for you to come down to the Oracle campus in Santa Clara if you have a chance and I'll show you what we've been working on and spend a little time investigating what could potentially be done in Raspbian in terms of configuration / libraries / performance. If nothing else it should be a lot of fun ;-).
Posts: 7
Joined: Sun Aug 12, 2012 6:08 am
by Jim Manley » Sun Aug 12, 2012 11:45 pm
rbair wrote:I'm the Java Client Architect at Oracle. We're both very interested in supporting the Raspberry PI, not only with JavaSE Embedded but also with JavaFX. We have an alpha hard-float JVM and I'm going to be giving it a try along with recompiled JavaFX binaries in hard float to see how this device is going to look.

mpthompson, I'd love for you to come down to the Oracle campus in Santa Clara if you have a chance and I'll show you what we've been working on and spend a little time investigating what could potentially be done in Raspbian in terms of configuration / libraries / performance. If nothing else it should be a lot of fun ;-).

I talked to some folks from Oracle at the Java education booth at the Maker Faire back in May about Java products being made as compatible with the Pi as possible (especially to take advantage of the FPU and GPU). I was assured that there was high interest, at least among the engineering folks, in that happening for all current and future Java releases. The last I had heard through informal channels was that there were multiple Oracle offices interested in the effort and that they were working out which office was officially going to be lead and what each of the other interested offices might contribute. No timeframe for releases beyond the general Java product roadmap had been developed, but, JavaFX compliance by sometime this coming Fall seemed to be an unofficial goal. Future major numbered Java releases including full Pi support at the same time as other supported platforms was reportedly the long-term goal.

Since the Pi is officially aimed at the educational sector and the folks I talked to are in Oracle's Java educational division, they said that full Java product support for the Pi would fit well within Oracle's business model and long-term strategy. The thinking is similar to how Apple achieved very high penetration in both K-12 and collegiate segments in the U.S. by not only offering essentially at-cost discounts to students and faculty on Apple ][ and Mac hardware and software.

Graduating users carried their experience and passionate brand affinity into the commercial world, especially in the arts, publishing, and many science and engineering disciplines, especially for data visualization. Pascal also enjoyed a great deal of popularity due to its heritage in computer science education (when strong types and structured programming were still relatively new concepts in the 1970s through mid-1980s) and the low cost-of-entry for Turbo Pascal, UCSD p-System Pascal, etc.

If you're looking for another local Pi and Java enthusiast to help get things ported and/or tested, I'll volunteer and I can recruit others. During normal office hours, I can be in your facility in Santa Clara Thursdays except 2 ~ 6 PM. I'll otherwise be busy with tasks related to computing education for the start of the new school year at both high schools and universities through the postgraduate level, in addition to commercial software efforts, all of the above ranging as far away as Monterey. I can also contribute during nights and weekends in remote mode.
The best things in life aren't things ... but, a Pi comes pretty darned close! :D
"Education is not the filling of a pail, but the lighting of a fire." -- W.B. Yeats
In theory, theory & practice are the same - in practice, they aren't!!!
User avatar
Posts: 1357
Joined: Thu Feb 23, 2012 8:41 pm
Location: SillyCon Valley, California, USA
by rbair » Mon Aug 13, 2012 5:02 pm
Hey Jim, send me an email at my oracle email address and I'll be happy to set something up!

Thanks
Richard
Posts: 7
Joined: Sun Aug 12, 2012 6:08 am
by michydk » Tue Aug 14, 2012 8:49 pm
Im testing the:
Code: Select all
ejre-7u6-fcs-b24-linux-arm-vfp-client_headless-10_aug_2012.gz

and got the same issue with libjli.so
Code: Select all
java: error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory

Uname
Code: Select all
Linux raspberrypi 3.1.9+ #168 PREEMPT Sat Jul 14 18:56:31 BST 2012 armv6l GNU/Linux


Please post any fixes / ideas here too,

Kind regards
Michael
Posts: 2
Joined: Tue Aug 14, 2012 8:35 pm
by gjb2048 » Tue Aug 14, 2012 10:04 pm
Hi,

I noticed that the file 'libjli.so' does come with the tarball, in the '/lib/arm/jli' folder, so a quick Google saw posts relating to the 'LD_LIBRARY_PATH' environment variable. So I tried that with an 'export' command but still did not work. I was assuming that a path to the 'lib' folder would do the trick but did not.

Still stumped.

Cheers,

Gareth
Posts: 7
Joined: Fri Aug 10, 2012 5:07 pm
by mpthompson » Wed Aug 15, 2012 5:56 am
rbair wrote:mpthompson, I'd love for you to come down to the Oracle campus in Santa Clara if you have a chance and I'll show you what we've been working on and spend a little time investigating what could potentially be done in Raspbian in terms of configuration / libraries / performance. If nothing else it should be a lot of fun ;-).


Hi Richard, I'm just getting caught up on things after a few days away. I certainly would be willing to come by for a visit and see what could be done on the Raspbian side to help accelerate a port of the Oracle Java VM. I don't see your Oracle email address around here. You can email me at mpthompson(at)gmail(dot)com and we can work out a time for a visit. I should be available pretty much the rest of this week.
User avatar
Forum Moderator
Forum Moderator
Posts: 620
Joined: Fri Feb 03, 2012 7:18 pm
Location: San Carlos, CA
by luismreis » Wed Aug 15, 2012 10:34 am
Hi guys,

I've just installed jdk7u6 on my raspbian, but it doesn't work because of the EABI problem stated above.

Before reading this post I've even tried "touch /etc/ld.so.nohwcap", but, of course, it doesn't work either.

If you need any testers, please contact me (@luismreis, luismreis at gmail dot com).

Thanks,
Best,
Luis
User avatar
Posts: 1
Joined: Mon Aug 13, 2012 8:40 am
by asb » Wed Aug 15, 2012 3:05 pm
kermitas wrote:
plugwash wrote:You also have the option of using armel wheezy. viewtopic.php?f=50&t=8071


Thank you for your response.

Yes, I have just discovered that I can use Wheezy softfp from here http://www.raspberrypi.org/archives/1435 (2012-06-18-wheezy-beta.zip). I read that it is better than Squeeze. Now I am updating it (apt-get update, apt-get upgrade, rpi-update).

What about 2012-06-18-wheezy-beta.zip repositories? Will they be always up-to-date?

Thanks:)


Yes, that image is fine. A refreshed armel image should go on the download page soon, but there's no major updates (just newer firmware and misc accumulated changes).
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 799
Joined: Fri Sep 16, 2011 7:16 pm
by kermitas » Thu Aug 16, 2012 12:40 am
asb wrote:Yes, that image is fine. A refreshed armel image should go on the download page soon, but there's no major updates (just newer firmware and misc accumulated changes).


Thank you 'asb' for the info :).
Posts: 108
Joined: Thu Jan 26, 2012 11:49 am