Temurin-build: arm32 builds on armv6 pi fail with Atomic store(jlong) unsupported

Created on 6 Nov 2018  ·  25Comments  ·  Source: adoptium/temurin-build

Hello!

I have Eclipse on my Ubuntu where I have installed OpenJDK 8 for running Eclipse IDE.

asus@asus-X551MA:~$ java -version
openjdk version "1.8.0_181"
OpenJDK Runtime Environment (build 1.8.0_181-8u181-b13-1ubuntu0.18.04.1-b13)
OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)
asus@asus-X551MA:~$ 

In Eclipse I use the Linux 64 OpenJDK-10.0.2+13 as compiler. I also use arm32 OpenJDK-10.0.2+13 on Raspberry Pi B+ v1.2

pi@raspberrypi:~ $ java -version
openjdk version "10.0.2-adoptopenjdk" 2018-07-17
OpenJDK Runtime Enviroment (build 10.0.2-adoptopenjdk+13)
OpenJDK Client VM (build 10.0.2-adoptopenjdk+13, mixed mode)
pi@raspberrypi: ~ $

I installed the OpenJDK-10.0.2+13 on Raspberry Pi B+ v1.2 by using:

export JAVA_HOME="path that you found"
export PATH=$JAVA_HOME/bin:$PATH

When I run my java program I have compile from Eclipse IDE. I got this error:

pi@raspberrypi:~ $ java -jar JoystickStepperLCD.jar
========================= DEBUG MESSAGE: Atomic load(jlong) unsupported on this platform ===============

[error occurred during error reportin ((null)), id 0xe0000000]
pi@raspberrypi:~ $

You can download the JoystickStepperLCD.jar from JoystickStepperLCD.zip where are located at:
https://github.com/DanielMartensson/Embedded-Systems/tree/master/JoystickStepperLCD

bug

Most helpful comment

Hi,
I think that the problematic thing might be enabled AssumeMP flag. Could you please try running java like this:

java -XX:-AssumeMP -jar JoystickStepperLCD.jar

Alternatively, could you try running a JDK build from https://ci.adoptopenjdk.net/view/ev3dev/job/openjdk11_build_ev3_linux/ ? We are patching OpenJDK to run on an ARMv5 processor in a LEGO Mindstorms kit and it seems to work well so far.
Regards,
Jakub Vaněk

All 25 comments

@DanielMartensson Ohhhhhh this makes sense. You've compiled a feature from a runtime which arm32v6 doesn't support. I think you need to compile the same program on your Pi and see what happens. This is a rare case where WORA is broken.

@karianna I already compile my program by using Project->Clean in Eclipse IDE. I know that should be standing "Compile only", but in this IDE, it's standing "Clean". The reason why I can't run the application on my Ubuntu computer (64-bit), is because Pi4J (a library included on my application) cannot run on other computers that is not a "Pi"-computer such as NanoPi, RaspberryPi, BananaPi and so on.

One problem more, Eclipse IDE on Raspberry Pi will slow down my Raspberry Pi so mutch that it would take hours to compile. That's the reason why I compile on Ubuntu -> USB stick -> Raspberry Pi.

Compiling Java code on Raspberry Pi, no matter what IDE I have, takes to long time. Is it not possible to make fix the WORA on OpenJDK 10.0.2+13 ?

To run this application. WiringPi MUST be installed on the Raspberry Pi.

sudo apt-get install wiringpi

WiringPi is a C-library. Pi4J is a Java library who can communicate with WiringPi via JNI.

@DanielMartensson Can you compile without eclipse? e.g. on the Command line using Ant/Maven et al?

@DanielMartensson Can you compile without eclipse? e.g. on the Command line using Ant/Maven et al?

I think so. Well, I got lot's of jar files included and I don't know how to include them when I do the "javac" command in the terminal at my Pi. Have you download the package?

I always using an IDE when I compile. Do you have any suggestion how to compile with that amount of jars included?

@karianna I will try to compile a simple hello world project. Or do I need to use the same libraries like Pi4J?

IIRC in eclipse, you'll have a file called .project, which lists all of your dependencies. I can then give you a sample script to run that from the Command Line. It will look something like:

javac -cp "Path's to all of your JARs" YourClass.java

@karianna

What if I have multiple of classes? In different folders too.

javac -cp "Path's to all of your JARs" YourClass.java MySecondClass.java AnotherClass.java .... class.java

?

@karianna Can you compile this and then upload it so I can run it with AdoptOpenJDK 10.0.2+13 ?

https://ufile.io/99cdb

It need to be a executable jar file.

I don't have the appropriate platform to compile this on. But from your command line on the Pi you can run:

find . -name "*.java" > sources.txt
javac -cp Jars/pi4j-core.jar @sources.txt

@karianna

Can't even compile due to the same message above "Atomic store(jlong) unsupported in this platform".
With OpenJDK 8, I can compile. With AdoptOpenJDK 10.0.2 form ARM32, it won't work.

OK - let me try to find an ARM expert.

You can join us on adoptopenjdk.net/slack.html and jump on the #arm channel

For what it's worth I can replicate this on my Pi Zero-W

@sxa555 Try to write

cat /proc/cpuinfo

And see if you have the same CPU as me does:

processor : 0
model_name : ARMv6-compatible processor rev 7 (v6l)
Hardware : BCM2835

Yeah the Zero-W is more or less the same as an original model A I think but with the wifi adapter added so all three lines are identical to what you've posted

@karianna @sxa555 Has anyone tried ARM64 bits singleboard computers with AdoptOpenJDK? That worked or not?

@karianna @sxa555 Has anyone tried ARM64 bits singleboard computers with AdoptOpenJDK? That worked or not?

I'm not sure - probably worth asking on our ARM channel on slack.

Hi,
I think that the problematic thing might be enabled AssumeMP flag. Could you please try running java like this:

java -XX:-AssumeMP -jar JoystickStepperLCD.jar

Alternatively, could you try running a JDK build from https://ci.adoptopenjdk.net/view/ev3dev/job/openjdk11_build_ev3_linux/ ? We are patching OpenJDK to run on an ARMv5 processor in a LEGO Mindstorms kit and it seems to work well so far.
Regards,
Jakub Vaněk

@karianna @sxa555 @JakubVanek

It worked! I need to use sudo to control the GPIO pins. I got the OpenJDK 8 installed, but I just change the JAVA_HOME to AdoptOpenJDK instead.

pi@raspberrypi:~ $ export JAVA_HOME="/home/pi/Program/jdk-10.0.2+13"
pi@raspberrypi:~ $ export PATH=$JAVA_HOME/bin:$PATH
pi@raspberrypi:~ $ java -version
openjdk version "10.0.2-adoptopenjdk" 2018-07-17
OpenJDK Runtime Environment (build 10.0.2-adoptopenjdk+13)
OpenJDK Client VM (build 10.0.2-adoptopenjdk+13, mixed mode)
pi@raspberrypi:~ $ ls
Desktop Downloads Flaktstyrning.jar Pictures Public Videos
Documents FläktStyrning Music Program Templates
pi@raspberrypi:~ $ java -XX:-AssumeMP -jar Flaktstyrning.jar
OpenJDK Client VM warning: Option AssumeMP was deprecated in version 10.0 and will likely be removed in a future release.
Exception in thread "main" java.lang.RuntimeException: Unable to open GPIO direction interface for pin [28]: Permission denied

at com.pi4j.wiringpi.GpioUtil.export(Native Method)
at com.pi4j.io.gpio.WiringPiGpioProviderBase.export(WiringPiGpioProviderBase.java:108)
at com.pi4j.io.gpio.impl.GpioPinImpl.export(GpioPinImpl.java:158)
at com.pi4j.io.gpio.impl.GpioControllerImpl.provisionPin(GpioControllerImpl.java:566)
at com.pi4j.io.gpio.impl.GpioControllerImpl.provisionDigitalOutputPin(GpioControllerImpl.java:718)
at com.pi4j.io.gpio.impl.GpioControllerImpl.provisionDigitalOutputPin(GpioControllerImpl.java:730)
at se.spektrakon.hardware.L293.WriteL293.(WriteL293.java:30)
at se.spektrakon.hardware.raspberry.Raspberry.(Raspberry.java:48)
at se.spektrakon.hardware.Main.main(Main.java:11)
pi@raspberrypi:~ $ sudo java -XX:-AssumeMP -jar Flaktstyrning.jar
OFF or reset. Count : 0 pulse_seconds 0
Forward. Count : 1 pulse_seconds 36
Forward. Count : 2 pulse_seconds 36
Forward. Count : 3 pulse_seconds 36
Forward. Count : 4 pulse_seconds 36
Forward. Count : 5 pulse_seconds 36
Forward. Count : 6 pulse_seconds 36
OFF or reset. Count : 0 pulse_seconds 0
OFF or reset. Count : 0 pulse_seconds 0
^CExited!
OFF or reset. Count : 0 pulse_seconds 0
pi@raspberrypi:~ $

When I uninstall OpenJDK 8 I cannot find the command java when I run:

pi@raspberrypi:~ $ sudo java -XX:-AssumeMP -jar Flaktstyrning.jar
sudo java: command not found
pi@raspberrypi:~ $

If I don't use the sudo command, I got the same as above:

pi@raspberrypi:~ $ java -XX:-AssumeMP -jar Flaktstyrning.jar
OpenJDK Client VM warning: Option AssumeMP was deprecated in version 10.0 and will likely be removed in a future release.
Exception in thread "main" java.lang.RuntimeException: Unable to open GPIO direction interface for pin [28]: Permission denied

at com.pi4j.wiringpi.GpioUtil.export(Native Method)
at com.pi4j.io.gpio.WiringPiGpioProviderBase.export(WiringPiGpioProviderBase.java:108)
at com.pi4j.io.gpio.impl.GpioPinImpl.export(GpioPinImpl.java:158)
at com.pi4j.io.gpio.impl.GpioControllerImpl.provisionPin(GpioControllerImpl.java:566)
at com.pi4j.io.gpio.impl.GpioControllerImpl.provisionDigitalOutputPin(GpioControllerImpl.java:718)
at com.pi4j.io.gpio.impl.GpioControllerImpl.provisionDigitalOutputPin(GpioControllerImpl.java:730)
at se.spektrakon.hardware.L293.WriteL293.(WriteL293.java:30)
at se.spektrakon.hardware.raspberry.Raspberry.(Raspberry.java:48)
at se.spektrakon.hardware.Main.main(Main.java:11)
pi@raspberrypi:~$

Anyway! The OpenJDK 10.0.2 seems to work at 32-bit ARM. Does anyone know how I can bypass the sudo command and still got rights to use GPIO pins?

Hi Daniel, could you show the output of

cat /proc/cpuinfo

on your board? I'm curious why -AssumeMP seems to have made a difference.

@JamesKingdon

pi@raspberrypi:~ $ cat /proc/cpuinfo
processor : 0
model name : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS : 697.95
Features : half thumb fastmult vfp edsp java tls
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xb76
CPU revision : 7

Hardware : BCM2835
Revision : 0010
Serial : 00000000b486e11c
pi@raspberrypi:~ $

Oh, ok. Well that fits then :)
Ah, I got my wires crossed, for some reason I thought it was Pi 2 you were using, so was expecting multi-core.

@JamesKingdon

Do you know what's the solution for the issue why I need to use -XX:-AssumeMP to make it work?

Will Oracle use AdoptOpenJDK for it's own purposes? I'm mean, OpenJDK 8 is the last version from Oracle who support ARM.

OpenJDK 12ea detects multiprocessor systems on the fly, so that probably the best solution. Otherwise, we have a source patch that disables AssumeMP in code:
https://github.com/ev3dev-lang-java/openjdk-ev3/blob/2f9d939e984d93ad391e5ab8dfdbca4099258b65/scripts/jdk10.patch#L181
AFAIK ARMv6 and older depend on that nobody breaks the remaining supporting infrastructure.
Also, to run the java as root, try sudo $(which java) ...

Closing this as resolved - a document is being worked on our ARM channel in slack

Was this page helpful?
0 / 5 - 0 ratings