Closed eitch closed 4 years ago
Is anyone taking care of the open merge requests? IS the project still actively maintained ?
As Robert has mentioned elsewhere, current development is focused on 2.0
Although i would enjoy having my merge request merged, unless something is incorrect, and then having a release made, as i need the changes for my production systems.
Thanks for the quick answer! I just landed on the project and realized that there was little to no activity since the last release in February so I was wondering. I didn't see much activity from the owners in the PRs and issues. I do realize it's OSS and how much time it costs though, hence my question.
Thanks for the info, good luck getting it merged and sorry for interfering here :).
Hi @savageautomate i would greatly appreciate it, if you would merge my pull request. Or maybe you could give me write access to the repo so i could fix the biggest issues?
Is it possible to use this branch in one of my projects on the new Pi OS 64 bit? Will I need to recompile or is there a libpi4j.so that I can simply download and use? I downloaded and compiled but it gives me a 32 bit libpi4j.so file.
Hi @dajma00
Yes, you will have to compile it for 64-bit, and you will also have to install a 64-bit wiring pi.
You will have to use the develop/1.4 branch and then compile using the following:
RPI_CROSS_COMPILE=true mvn clean install -Prelease -DskipTests -Pall-platforms
But this only works on an Ubuntu/Debian system as it expects certain packages to be around for cross compiling.
Hi @dajma00
Yes, you will have to compile it for 64-bit, and you will also have to install a 64-bit wiring pi.
You will have to use the develop/1.4 branch and then compile using the following:
RPI_CROSS_COMPILE=true mvn clean install -Prelease -DskipTests -Pall-platforms
But this only works on an Ubuntu/Debian system as it expects certain packages to be around for cross compiling.
Which directory should be used to build? There are pom files in various directories.
@eitch is this pull request ready for merge? I briefly reviewed the changes and it looks like its all there to handle the additional 64-bit artifact and build.
After compiling, I just checked the following file and got this:
pi@raspberrypi:~ $ file /home/pi/pi4j/pi4j-core/target/classes/lib/raspberrypi/dynamic/libpi4j.so /home/pi/pi4j/pi4j-core/target/classes/lib/raspberrypi/dynamic/libpi4j.so: ELF 32-bit LSB shared object, ARM, EABI5 version 1 (SYSV), dynamically linked, BuildID[sha1]=144fad2f96db21f821af58f39af476a77c02f3d6, not stripped
I dont think I should have a 32 bit .so file generated?
@savageautomate yes, this branch is ready to merge. I should maybe do another test with in all 4 versions for 32/64-bit and RPi3 and RPi4.
I'll go ahead and merge and we can fix if any testing result in failures.
@savageautomate So with this merge, should I be using DEVELOP 1.4 for 64 bit compilation? Does anyone have any instructions on how to compile this on Raspberry Pi 4 running Pi OS 64 bit?
@dajma00 The readme on the branch develop/1.4 has the build instructions, but here they are too:
RPI_CROSS_COMPILE=true mvn clean install -Prelease -DskipTests -Pall-platforms
@dajma00
Yes, only branch develop/1.4
supports the compiler instructions for building on aarch64
(ARM64).
I have not tested this myself, but if you are building directly on the RPi hardware running 64-bit OS, then you may not need the cross compiler argument. Just try
mvn clean install -Prelease -DskipTests -Pall-platforms
(The all-platforms profile is fine because v1.4 only supports Raspberry Pi platforms)
Thanks, Robert
Hi Robert @savageautomate , I get the following output when I issue this command to compile. Its trying to reach a remote raspberry pi whereas I want to compile locally on my Raspberry Pi (stops trying to ssh to an IP address):
pi@raspberrypi:~/pi4j $ mvn clean install -Prelease -DskipTests -P raspberrypi
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[INFO] Scanning for projects...
[WARNING] The project com.pi4j:pi4j-parent:pom:1.4-SNAPSHOT uses prerequisites which is only intended for maven-plugin projects but not for non maven-plugin projects. For such purposes you should use the maven-enforcer-plugin. See https://maven.apache.org/enforcer/enforcer-rules/requireMavenVersion.html
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] Pi4J :: Parent POM [pom]
[INFO] Pi4J :: JNI Native Library [pom]
[INFO] Pi4J :: Java Library (Core) [jar]
[INFO] Pi4J :: Java Examples [jar]
[INFO] Pi4J :: Distribution [deb]
[INFO]
[INFO] ------------------------< com.pi4j:pi4j-parent >------------------------
[INFO] Building Pi4J :: Parent POM 1.4-SNAPSHOT [1/5]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ pi4j-parent ---
[INFO] Deleting /home/pi/pi4j/target
[INFO]
[INFO] --- maven-enforcer-plugin:3.0.0-M1:enforce (enforce-java) @ pi4j-parent ---
[INFO]
[INFO] --- maven-enforcer-plugin:3.0.0-M1:enforce (enforce-maven) @ pi4j-parent ---
[INFO]
[INFO] --- license-maven-plugin:1.19:update-file-header (append-license-file-headers) @ pi4j-parent ---
[WARNING] No file to scan.
[INFO]
[INFO]
[INFO] --- license-maven-plugin:1.19:update-project-license (update-project-license) @ pi4j-parent ---
[INFO]
[INFO] --- whitespace-maven-plugin:1.0.4:trim (default) @ pi4j-parent ---
[INFO]
[INFO] --- build-helper-maven-plugin:3.0.0:attach-artifact (attach-artifacts) @ pi4j-parent ---
[INFO]
[INFO] --- maven-gpg-plugin:1.6:sign (sign-artifacts) @ pi4j-parent ---
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) @ pi4j-parent ---
[INFO] Installing /home/pi/pi4j/pom.xml to /home/pi/.m2/repository/com/pi4j/pi4j-parent/1.4-SNAPSHOT/pi4j-parent-1.4-SNAPSHOT.pom
[INFO] Installing /home/pi/pi4j/LICENSE.txt to /home/pi/.m2/repository/com/pi4j/pi4j-parent/1.4-SNAPSHOT/pi4j-parent-1.4-SNAPSHOT-license.txt
[INFO] Installing /home/pi/pi4j/NOTICE.txt to /home/pi/.m2/repository/com/pi4j/pi4j-parent/1.4-SNAPSHOT/pi4j-parent-1.4-SNAPSHOT-notice.txt
[INFO] Installing /home/pi/pi4j/README.md to /home/pi/.m2/repository/com/pi4j/pi4j-parent/1.4-SNAPSHOT/pi4j-parent-1.4-SNAPSHOT-readme.md
[INFO] Installing /home/pi/pi4j/target/pi4j-parent-1.4-SNAPSHOT.pom.asc to /home/pi/.m2/repository/com/pi4j/pi4j-parent/1.4-SNAPSHOT/pi4j-parent-1.4-SNAPSHOT.pom.asc
[INFO] Installing /home/pi/pi4j/target/gpg/LICENSE.txt.asc to /home/pi/.m2/repository/com/pi4j/pi4j-parent/1.4-SNAPSHOT/pi4j-parent-1.4-SNAPSHOT-license.txt.asc
[INFO] Installing /home/pi/pi4j/target/gpg/NOTICE.txt.asc to /home/pi/.m2/repository/com/pi4j/pi4j-parent/1.4-SNAPSHOT/pi4j-parent-1.4-SNAPSHOT-notice.txt.asc
[INFO] Installing /home/pi/pi4j/target/gpg/README.md.asc to /home/pi/.m2/repository/com/pi4j/pi4j-parent/1.4-SNAPSHOT/pi4j-parent-1.4-SNAPSHOT-readme.md.asc
[INFO]
[INFO] ------------------------< com.pi4j:pi4j-native >------------------------
[INFO] Building Pi4J :: JNI Native Library 1.4-SNAPSHOT [2/5]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ pi4j-native ---
[INFO] Deleting /home/pi/pi4j/pi4j-native/target
[INFO]
[INFO] --- maven-enforcer-plugin:3.0.0-M1:enforce (enforce-java) @ pi4j-native ---
[INFO]
[INFO] --- maven-enforcer-plugin:3.0.0-M1:enforce (enforce-maven) @ pi4j-native ---
[INFO]
[INFO] --- maven-antrun-plugin:1.8:run (generate-sources) @ pi4j-native ---
[WARNING] Parameter tasks is deprecated, use target instead
[INFO] Executing tasks
main:
[mkdir] Created dir: /home/pi/pi4j/pi4j-native/target/classes
[mkdir] Created dir: /home/pi/pi4j/pi4j-native/target/native
[mkdir] Created dir: /home/pi/pi4j/pi4j-native/target/native/lib
[INFO] Executed tasks
[INFO]
[INFO] --- license-maven-plugin:1.19:update-file-header (append-license-file-headers) @ pi4j-native ---
[INFO] Will search files to update from root /home/pi/pi4j/pi4j-native/src/main/native
[INFO] Scan 40 files header done in 368.11ms.
[INFO]
* update header on 40 files.
[INFO]
[INFO] --- whitespace-maven-plugin:1.0.4:trim (default) @ pi4j-native ---
[INFO]
[INFO] --- maven-antrun-plugin:1.8:run (pi4j-build-native-libraries) @ pi4j-native ---
[INFO] Executing tasks
pi4j-build-platform-libraries:
build-libpi4j.so-remote:
raspberrypi-remote:
[echo] ----------------------------------------------------
[echo] Pi4J NATIVE LIBRARY BUILD FOR: RaspberryPi
[echo] ----------------------------------------------------
[echo] HOST: 192.168.1.100
[echo] PORT: 22
[echo] USER: pi
[echo] DIR : pi4j-temp
[echo] ----------------------------------------------------
[sshexec] Connecting to 192.168.1.100:22
I changed the IP address in the pom.xml and proceeded that way. But then got this error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.8:run (pi4j-attach-native-library-artifacts) on project pi4j-native: An Ant BuildException has occured: File does not exist: /home/pi/pi4j/pi4j-native/target/native/lib/raspberrypi/dynamic/libpi4j-armhf.so
[ERROR] around Ant part ...<attachartifact file="/home/pi/pi4j/pi4j-native/target/native/lib/raspberrypi/dynamic/libpi4j-armhf.so" classifier="raspberrypi-dynamic-armhf" type="so"/>... @ 8:161 in /home/pi/pi4j/pi4j-native/target/antrun/build-pi4j-attach-platform-libraries.xml
It is looking for libpi4j-armhf.so file. I looked in the /home/pi/pi4j/pi4j-native/target/native/lib/raspberrypi/dynamic/ directory and it only has the "libpi4j-.so" file. I checked and this is a 64 bit .so file. I think only the name is not correct.
Why not cross-compile on your computer? It builds faster and requires no configuration...
I will have to test it myself, which will take a while.
@eitch Ok, so can I cross compile from my Windows PC? Do I need to install Liberica 11 on my PC? Do I need to install Liberica on the Raspberry Pi as well?
Hi @dajma00 sadly cross-compiling from Windows is not possible. You could install Ubuntu in a VM and then cross-compile from there. And yes, you would need to have a Java 11 installed then as well, e.g. from https://bell-sw.com/pages/downloads/#/java-11-lts
In the version 2 codebase, we include a cross-compiling option using a Docker container. I wonder if it would be worthwhile to enable builds in v1.4 to use this docker cross compiler option. With that said, I have not tested the current docker image for x64 builds.
I think leave it for version 2. Why make double effort?
Meanwhile, I compiled on my WSL system but am getting the the following error, can't figure out what command/executable is missing on the system. Appreciate any help.
[INFO] Pi4J :: Parent POM ................................. SUCCESS [ 9.879 s]
[INFO] Pi4J :: JNI Native Library ......................... FAILURE [ 8.144 s]
[INFO] Pi4J :: Java Library (Core) ........................ SKIPPED
[INFO] Pi4J :: GPIO Extension ............................. SKIPPED
[INFO] Pi4J :: Device Abstractions ........................ SKIPPED
[INFO] Pi4J :: Java Examples .............................. SKIPPED
[INFO] Pi4J :: Distribution ............................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 20.182 s
[INFO] Finished at: 2020-06-19T00:16:12+05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.8:run (pi4j-build-native-libraries) on project pi4j-native: An Ant BuildException has occured: The following error occurred while executing this line:
[ERROR] /usr/pi4j/pi4j-native/build.xml:320: The following error occurred while executing this line:
[ERROR] /usr/pi4j/pi4j-native/build.xml:227: The following error occurred while executing this line:
[ERROR] /usr/pi4j/pi4j-native/build.xml:85: exec returned: 127
[ERROR] around Ant part ...<ant inheritRefs="true" target="build-libpi4j.so-cross-compile">... @ 4:67 in /usr/pi4j/pi4j-native/target/antrun/build-pi4j-build-platform-libraries.xml
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.8:run (pi4j-build-native-libraries) on project pi4j-native: An Ant BuildException has occured: The following error occurred while executing this line:
/usr/pi4j/pi4j-native/build.xml:320: The following error occurred while executing this line:
/usr/pi4j/pi4j-native/build.xml:227: The following error occurred while executing this line:
/usr/pi4j/pi4j-native/build.xml:85: exec returned: 127
around Ant part ...<ant inheritRefs="true" target="build-libpi4j.so-cross-compile">... @ 4:67 in /usr/pi4j/pi4j-native/target/antrun/build-pi4j-build-platform-libraries.xml
...
Caused by: org.apache.maven.plugin.MojoExecutionException: An Ant BuildException has occured: The following error occurred while executing this line:
/usr/pi4j/pi4j-native/build.xml:320: The following error occurred while executing this line:
/usr/pi4j/pi4j-native/build.xml:227: The following error occurred while executing this line:
/usr/pi4j/pi4j-native/build.xml:85: exec returned: 127
around Ant part ...<ant inheritRefs="true" target="build-libpi4j.so-cross-compile">... @ 4:67 in /usr/pi4j/pi4j-native/target/antrun/build-pi4j-build-platform-libraries.xml
....
Caused by: org.apache.tools.ant.BuildException: The following error occurred while executing this line:
/usr/pi4j/pi4j-native/build.xml:320: The following error occurred while executing this line:
/usr/pi4j/pi4j-native/build.xml:227: The following error occurred while executing this line:
/usr/pi4j/pi4j-native/build.xml:85: exec returned: 127
....
Caused by: org.apache.tools.ant.BuildException: The following error occurred while executing this line:
/usr/pi4j/pi4j-native/build.xml:227: The following error occurred while executing this line:
/usr/pi4j/pi4j-native/build.xml:85: exec returned: 127
...
Caused by: org.apache.tools.ant.BuildException: The following error occurred while executing this line:
/usr/pi4j/pi4j-native/build.xml:85: exec returned: 127
@dajma00
I have been. working to clean up/streamline the native build process and I went ahead and added support for docker builds because its an effort I had to complete for V2 anyway. My work is currently staged here: https://github.com/savageautomate/pi4j/tree/develop/1.4
Building from a Docker image is now the default method to build. All you should need is Docker installed on the host computer and the host is a 64-bit Intel/AMD or ARM64 processor. I have built from macOS, Ubuntu and Raspberry Pi OS 64-bit (on a RPi4B).
The native build will compile both 32-bit and 64-bit versions of the native libraries. I plan on making some changes to the maven profiles but for now the build commands are:
Build using Docker container; you need Docker installed on host computer
mvn clean deploy -Pall-platforms -DskipTests
Build using cross compiler toolchains (armhf, aarch64) on local system
mvn clean deploy -Pall-platforms -Pcross-compile -DskipTests
Additionally, I have pushed the latest build artifacts to the SNAPSHOT maven repository. So you could skip the native build and get the artifacts from the repository instead.
Thanks, Robert
I have built a 64 bit Debian image for the Raspberry Pi and installed Liberica JDK 11.0.3.
For my project i use pi4j and the current version does not work on a 64bit system, thus i modified the develop/1.4 branch of pi4j to build locally a 64bit libpi4j.so using cross compile. This is my merge request, with the relevant changes.
The changes made me change the name of the .so file so that the architecture is in the name, thus i updated the calls to load the library without passing the file ending, and the rest is done in the NativeLibraryLoader.load() method.
I understand that the develop/1.4 might not be released, yet i would be really happy if we did release a 1.4 version. I tested this version on my project using the following protocols: