Closed swarren closed 5 years ago
Here's a link to the latest version, already built and ready to use.
https://www.arduino.cc/download_handler.php?f=/arduino-1.8.7-linuxaarch64.tar.xz
@jboco make sure your JAVA_HOME environment variable is not pointing to Oracle JDK (which does only ship a headless version of Java runtime) but to OpenJDK8. We are still trying to solve this problem, thus the "experimental" label on the download page.
PATH as well as JAVA_HOME too, I think?
Pretty sure "ant run" will not work on AARCH64, so you can't use those instructions exactly on Jetson (at least not until Oracle provides a normal Java runtime with GUI support).
You can use Oracle's JDK 8u171 to build the code. But you can't use Oracle's Java to actually run it.
Try running just "ant" (without "run"). Then "cd linux/work" to change to the directory where your freshly-built IDE is awaiting you. Type "ls -l" to check what's actually in that folder. There should NOT be a "java" folder. If there is, delete it with "rm -rf java". Then use "./arduino" to run it.
You will need to have the OpenJDK runtime installed to actually run the IDE. Type "sudo apt install openjdk-8-jre" to get it.
Hopefully these instructions help?
@PaulStoffregen , if I download the latest version in the link you provided, what would be the installation and run procedure. would it be as usual: cd /opt/arduino/ then chmod +x install.sh and finally ./install.sh ?
I just run it with "./arduino".
@PaulStoffregen for some reason, it still doesn't work.
Looks like it's trying to use the Oracle JRE, not the OpenJDK JRE.
If you don't have the OpenJDK JRE installed, run "sudo apt install openjdk-8-jre" to get it.
If you do have it, well, you're going to have to figure out how to get it to use OpenJDK rather than Oracle. Maybe find and delete the Oracle stuff somehow. Sorry, I can't guide you with the exact commands. You're going to have to figure this out.
Best I can tell you is it definitely did run here on my Jetson TX2 boards. I'm sure it'll work on yours too, once you overcome this problem with the Oracle headless JRE.
But if anything, this really shows the necessity of bundling a compatible JRE with the IDE, rather than relying on whatever the system provides, so things "just work" for end users!
@PaulStoffregen I was thinking about integrating this JVM instead than Oracle's, do you think it could work? https://adoptopenjdk.net/releases.html Maybe we can start using it in beta channel to get a broader testing audience?
OpenJDK 8 is the JDK that's typically bundled with Linux distros, and it's what people have used to test this release, so bundling that version makes sense to me.
However, @facchinm didn't want to bundle OpenJDK in an earlier comment for some reason:
I'd try to avoid embedding openjdk, but a release without java at all is feasible.
Still, if you've changed your mind, I think it's a good way forward.
I was thinking about integrating this JVM instead than Oracle's, do you think it could work? https://adoptopenjdk.net/releases.html
Nope, not looking good. Tried it just now on my Jetson TX2. The IDE crashes when I try to open the serial monitor, with this error:
/home/paul/arduino-1.8.7/java/bin/java: symbol lookup error: /home/paul/.jssc/linux/libjSSC-2.8_aarch64.so: undefined symbol: _Znwm
I was able to successfully upload to an Arduino Uno. I can also upload to Teensy and successfully open the serial monitor if using Teensy's native communication. But if I select Teensy from the Serial section of Port, same IDE crash as with Uno.
The IDE completely crashes. There's no Java exception thrown. The windows all disappear and that symbol lookup error ends up in the terminal window where I ran "./arduino".
For a little more detail, first I ran "sudo apt remove openjdk-8-jre openjdk-8-jre-headless". Then I tried to run the IDE, and sure enough I got "./arduino: line 35: java: command not found". Then I created a "java" folder. I extracted OpenJDK8_aarch64_Linux_jdk8u172-b11.tar.gz and copied the contents of its "jre" folder to the new "java" folder.
It does seem to work if I copy the JRE from /usr/lib/jvm/java-8-openjdk-arm64/jre.
I tried this just now:
rm -rf java/
sudo apt install openjdk-8-jre
mkdir java
cp -r /usr/lib/jvm/java-8-openjdk-arm64/jre/* java
sudo apt remove openjdk-8-jre
sudo apt remove openjdk-8-jre-headless
The IDE seems to run fine. I was able to upload to Arduino Uno and then open the serial monitor and see a sketch printing. Teensy also works with the serial monitor, both Teensy's native method and the Serial way.
Here's a copy of that java folder. If you'd like a quick and easy way to make an experimental 1.8.7 release for aarch64, I'd recommend just adding this.
https://www.pjrc.com/teensy/beta/java_folder_for_aarch64.tar.xz
If you run ldd /home/paul/.jssc/linux/libjSSC-2.8_aarch64.so
, does the output reference libstdc++? If not, it probably needs to be rebuilt including -lstdc++ or something like that. It sounds like the required library isn't available when the .so file is loaded, hence the crash. If the .so is linked correctly so that it knows it requires the library, there shouldn't be a crash, hopefully.
Note the license for OpenJDK (I don't recall what it is, but I assume GPL). If you distribute binaries, you likely need to either distribute the source too, or at least provide an offer of the source that people can follow up on.
ldd /home/paul/.jssc/linux/libjSSC-2.8_aarch64.so
linux-vdso.so.1 => (0x0000007f95371000)
libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000007f951f8000)
/lib/ld-linux-aarch64.so.1 (0x000000558609d000)
for some reason, it still doesn't work.
@jboco - You need to run "sudo apt install openjdk-8-jre"
Or you can extract that file I just posted, so it creates a "java" folder inside your Downloads/arduino-1.8.7 folder.
Yes, libjSSC.so needs to be rebuilt; it depends on a variety of symbols:
0000000000000000 F *UND* 0000000000000000 tcflush@@GLIBC_2.17
0000000000000000 *UND* 0000000000000000 **_ZdlPv**
0000000000000000 w *UND* 0000000000000000 _ITM_deregisterTMCloneTable
0000000000000000 *UND* 0000000000000000 **_Znam**
0000000000000000 w F *UND* 0000000000000000 __cxa_finalize@@GLIBC_2.17
0000000000000000 F *UND* 0000000000000000 cfsetospeed@@GLIBC_2.17
0000000000000000 F *UND* 0000000000000000 tcgetattr@@GLIBC_2.17
0000000000000000 F *UND* 0000000000000000 open@@GLIBC_2.17
0000000000000000 F *UND* 0000000000000000 __stack_chk_fail@@GLIBC_2.17
0000000000000000 F *UND* 0000000000000000 close@@GLIBC_2.17
0000000000000000 w *UND* 0000000000000000 __gmon_start__
0000000000000000 O *UND* 0000000000000000 __stack_chk_guard@@GLIBC_2.17
0000000000000000 F *UND* 0000000000000000 write@@GLIBC_2.17
0000000000000000 F *UND* 0000000000000000 nanosleep@@GLIBC_2.17
0000000000000000 F *UND* 0000000000000000 fcntl@@GLIBC_2.17
0000000000000000 F *UND* 0000000000000000 read@@GLIBC_2.17
0000000000000000 F *UND* 0000000000000000 tcsetattr@@GLIBC_2.17
0000000000000000 w *UND* 0000000000000000 _Jv_RegisterClasses
0000000000000000 F *UND* 0000000000000000 select@@GLIBC_2.17
0000000000000000 *UND* 0000000000000000 **_Znwm**
0000000000000000 F *UND* 0000000000000000 cfsetispeed@@GLIBC_2.17
0000000000000000 w *UND* 0000000000000000 _ITM_registerTMCloneTable
0000000000000000 F *UND* 0000000000000000 __errno_location@@GLIBC_2.17
0000000000000000 F *UND* 0000000000000000 ioctl@@GLIBC_2.17```
... some of which are implemented in the C++ library, but doesn't have a DT_NEEDED entry for the C++ library:
```[swarren@swarren-lx1 linux]$ readelf -d libjSSC-2.8_aarch64.so|grep NEEDED
0x0000000000000001 (NEEDED) Shared library: [libc.so.6]
0x0000000000000001 (NEEDED) Shared library: [ld-linux-aarch64.so.1]```
This is the same problem as:
https://github.com/scream3r/java-simple-serial-connector/issues/121#issuecomment-419741972
I should have mentioned two more things:
1) The other libjSSC*.so do depend on the C+++ library, for example:
$ readelf -d libjSSC-2.8_armhf.so
Dynamic section at offset 0x222c contains 28 entries:
Tag Type Name/Value
0x00000001 (NEEDED) Shared library: [libstdc++.so.6]
0x00000001 (NEEDED) Shared library: [libm.so.6]
0x00000001 (NEEDED) Shared library: [libgcc_s.so.1]
0x00000001 (NEEDED) Shared library: [libc.so.6]
$ readelf -d libjSSC-2.8_x86_64.so
Dynamic section at offset 0x2e10 contains 24 entries:
Tag Type Name/Value
0x0000000000000001 (NEEDED) Shared library: [libstdc++.so.6]
0x0000000000000001 (NEEDED) Shared library: [libm.so.6]
0x0000000000000001 (NEEDED) Shared library: [libgcc_s.so.1]
0x0000000000000001 (NEEDED) Shared library: [libc.so.6]
2) If the JDK/JRE just happens to have loaded the C++ library into memory for some other reason, libjSSC*.so will still work even if the required DT_NEEDED flag is missing. Different JDK/JRE versions might have different behaviour re: whether they do/don't happen to load this library, hence this might all work in some cases but not others.
Did libjSSC.so get rebuilt to solve the issue in the previous comment?
The IDE seems to run fine. I was able to upload to Arduino Uno and then open the serial monitor and see a sketch printing. Teensy also works with the serial monitor, both Teensy's native method and the Serial way.
+1. Just tried your pre-built aarch64 for v1.8.7 on ArchLinux with OpenJDK v8 and the IDE started up with default sketch.
I did notice some slowness. For example, loading the UI to the Libraries is taking forever ("forever" = 1min+). I'll go increase the JVM heap sizes to see if that helps.
@swarren not yet, I'm a bit busy at the moment but I'll mark it as todo before 1.8.9 (so we can probably go official at this point).
Just curious, will a known-good JRE be bundled with a non-beta 1.8.9 release?
Yup, both hourly and beta are being bundled with adoptopenjdk
There are currently no 64-bit ARM (AArch64) binaries of the Arduino IDE available to download, and it doesn't quite build from source.
I have modified the source of the IDE and all binary dependencies so that it builds (at least on Ubuntu 16.04), and will eventually send pull requests for all the build script repos.
Question: How do we go about updating the tool downloads on arduino.cc so that the IDE build can pull in the binary dependencies? Will you run the build process for each dependency after the relevant pull requests are merged, or would you want me to supply the binaries (for corporate legal reasons, that would be painful for me). Do you have access to an AArch64 to run the builds (NVIDIA Jetson TX1/TX2, a Raspberry Pi with a non-default Linux distro, and probably a few other devices would work).