Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arm32 builds on armv6 pi fail with Atomic store(jlong) unsupported #715

Closed
DanielMartensson opened this issue Nov 6, 2018 · 25 comments
Closed
Assignees
Labels
bug Issues that are problems in the code as reported by the community

Comments

@DanielMartensson
Copy link

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

@karianna karianna added this to TODO in temurin-build via automation Nov 6, 2018
@karianna karianna added the bug Issues that are problems in the code as reported by the community label Nov 6, 2018
@karianna
Copy link
Contributor

karianna commented Nov 6, 2018

@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 karianna added the Waiting on OP Issues that are awaiting a response from the original author of the ticket label Nov 6, 2018
@DanielMartensson
Copy link
Author

DanielMartensson commented Nov 6, 2018

@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.

@karianna
Copy link
Contributor

karianna commented Nov 6, 2018

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

@DanielMartensson
Copy link
Author

DanielMartensson commented Nov 6, 2018

@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?

@DanielMartensson
Copy link
Author

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

@karianna
Copy link
Contributor

karianna commented Nov 7, 2018

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

@DanielMartensson
Copy link
Author

DanielMartensson commented Nov 7, 2018

@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

?

@DanielMartensson
Copy link
Author

DanielMartensson commented Nov 9, 2018

@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.

@karianna
Copy link
Contributor

karianna commented Nov 9, 2018

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

@DanielMartensson
Copy link
Author

@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.

@karianna
Copy link
Contributor

karianna commented Nov 9, 2018

OK - let me try to find an ARM expert.

@karianna
Copy link
Contributor

karianna commented Nov 9, 2018

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

@sxa
Copy link
Member

sxa commented Nov 9, 2018

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

@DanielMartensson
Copy link
Author

DanielMartensson commented Nov 9, 2018

@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 

@sxa
Copy link
Member

sxa commented Nov 9, 2018

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

@DanielMartensson
Copy link
Author

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

@karianna
Copy link
Contributor

karianna commented Nov 9, 2018

@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.

@JakubVanek
Copy link

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

@DanielMartensson
Copy link
Author

DanielMartensson commented Nov 12, 2018

@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?

@JamesKingdon
Copy link

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.

@DanielMartensson
Copy link
Author

@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:~ $

@JamesKingdon
Copy link

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.

@DanielMartensson
Copy link
Author

DanielMartensson commented Nov 12, 2018

@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.

@karianna karianna removed the Waiting on OP Issues that are awaiting a response from the original author of the ticket label Nov 12, 2018
@JakubVanek
Copy link

JakubVanek commented Nov 12, 2018

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) ...

@karianna karianna moved this from TODO to In Progress in temurin-build Nov 12, 2018
@karianna karianna self-assigned this Nov 12, 2018
@karianna
Copy link
Contributor

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

temurin-build automation moved this from In Progress to Done Nov 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that are problems in the code as reported by the community
Projects
No open projects
temurin-build
  
Done
Development

No branches or pull requests

5 participants