Closed Fernthedev closed 3 years ago
Not really an answer to your question, but V2 of Pi4J - which uses PiGpio instead of WiringPi - will allow you to specify the path to the native library. For more info, see https://v2.pi4j.com/documentation/advanced/library-path. Maybe you can start your experiment with the new work-in-progress version of Pi4J?
Related to https://github.com/Pi4J/pi4j/issues/491
Not really an answer to your question, but V2 of Pi4J - which uses PiGpio instead of WiringPi - will allow you to specify the path to the native library. For more info, see https://v2.pi4j.com/documentation/advanced/library-path. Maybe you can start your experiment with the new work-in-progress version of Pi4J?
Been eyeying v2 for a while and I'm not sure where to get started. All I need access is to the documentation for Gradle, Ubuntu install (if applicable) and GPIO Pin outputs. Would you be kind enough to direct me where I can find the documentation for those (if they exist) :)
Closing with workaround in Pi4J v1.3.
Added support for system property ("pi4j.library.path") to override default embedded library resolution and allow for user explicitly defined resolution path for libpi4j.so
native library.
If there is no /tmp
available, then the Pi4J JAR does not have a location to extract the embedded ("libpi4j.so") native library. The library will need to be extracted and place on the system and a path provided using this system property. Note: you can also use "system" or "local" to have the JAR look for the "libpi4j.so" native library in the system path or in the local runtime directory alongside the JAR file.
Alternatively, this post suggests that /tmp
is not mounted by default on Ubuntu 20.04 and provides a configuration option to enable /tmp
mounting. https://askubuntu.com/questions/1232004/mounting-tmp-as-tmpfs-on-ubuntu-20-04
I had the exact same issue, and I managed to work it around as follows:
$ cd /usr/lib/arm-linux-gnueabihf/
$ sudo ln -s libwiringPi.so.2 libwiringPi.so
$ sudo ln -s libwiringPiDev.so.2 libwiringPiDev.so
Then I could successfully provisionDigitalOutputPin(RaspiPin.GPIO_01, "MyLED", PinState.HIGH)
, and change it to high and low.
If you follow the above steps, then please keep in mind, that this is hack, and you might experience unexpected behavior.
I am using Pi4J 1.2 in my Gradle project. I am using the latest packages in Ubuntu 20.04 while running the 32 bit server variant on a Pi 3 B+. I have also installed the Pi4J and WiringPi libraries. These are the commands I used to install the packages on Ubuntu:
curl -sSL https://pi4j.com/install | sudo bash
(Pi4J)sudo apt install wiringpi
So I know that Raspbian works out of the box with my software. I'm not sure how the situation is for supporting other OSes or Ubuntu specifically. Any workarounds or plans to fix this?
Result of
pi4j --version
Result of
gpio -v
NeoFetch to provide system info:
The stacktrace: