Raspberry Pi 3 B+ and pi4j not playing well together.

640 views
Skip to first unread message

Steven F. Le Brun

unread,
Apr 8, 2018, 11:08:34 PM4/8/18
to Pi4J

Has anyone tried to use pi4j on the new Raspberry Pi 3 B+?


The RPi 3B+ requires the use of wiringPi version 2.46, released sometime after March 14, 2018 and the latest version of Raspbian "stretch".


The pi4j 1.2 jar files include the library libpi4j.so which is the embedded copy of wiringPi v2.44 which does not include the fixes for the 3B+.


When I try to run the statement:


protected GpioController gpio = GpioFactory.getInstance();


I get the following exception:




OpenJDK 64-Bit Server VM warning: You have loaded library /tmp/libpi4j6824788762589179225.so which might have disabled stack guard. The VM will try to fix the stack guard now.It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
Apr 07, 2018 9:26:14 PM com.pi4j.util.NativeLibraryLoader load
SEVERE: Unable to load [libpi4j.so] using path: [/lib/raspberrypi/static/libpi4j.so]
java.lang.UnsatisfiedLinkError: /tmp/libpi4j6824788762589179225.so: /tmp/libpi4j6824788762589179225.so: wrong ELF class: ELFCLASS32 (Possible cause: architecture word width mismatch)
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
at java.lang.Runtime.load0(Runtime.java:809)
at java.lang.System.load(System.java:1086)
at com.pi4j.util.NativeLibraryLoader.loadLibraryFromClasspath(NativeLibraryLoader.java:148)
at com.pi4j.util.NativeLibraryLoader.load(NativeLibraryLoader.java:97)
at com.pi4j.wiringpi.Gpio.<clinit>(Gpio.java:189)
at com.pi4j.io.gpio.RaspiGpioProvider.<init>(RaspiGpioProvider.java:69)
at com.pi4j.io.gpio.RaspiGpioProvider.<init>(RaspiGpioProvider.java:51)
at com.pi4j.platform.Platform.getGpioProvider(Platform.java:125)
at com.pi4j.platform.Platform.getGpioProvider(Platform.java:118)
at com.pi4j.io.gpio.GpioFactory.getDefaultProvider(GpioFactory.java:109)
at com.pi4j.io.gpio.impl.GpioControllerImpl.<init>(GpioControllerImpl.java:56)
at com.pi4j.io.gpio.GpioFactory.getInstance(GpioFactory.java:91)
at com.lebruns.steven.epaper.WaveshareEP_SPI.<init>(WaveshareEP_SPI.java:110)
at com.lebruns.steven.epaper.WaveshareEPDisplay.<init>(WaveshareEPDisplay.java:20)
at com.lebruns.steven.epaper.Waveshare27BFrame.<init>(Waveshare27BFrame.java:23)
at com.lebruns.steven.epaper.epaper.main(epaper.java:29)

Exception in thread "main" java.lang.UnsatisfiedLinkError: com.pi4j.wiringpi.Gpio.wiringPiSetup()I
at com.pi4j.wiringpi.Gpio.wiringPiSetup(Native Method)
at com.pi4j.io.gpio.RaspiGpioProvider.<init>(RaspiGpioProvider.java:69)
at com.pi4j.io.gpio.RaspiGpioProvider.<init>(RaspiGpioProvider.java:51)
at com.pi4j.platform.Platform.getGpioProvider(Platform.java:125)
at com.pi4j.platform.Platform.getGpioProvider(Platform.java:118)
at com.pi4j.io.gpio.GpioFactory.getDefaultProvider(GpioFactory.java:109)
at com.pi4j.io.gpio.impl.GpioControllerImpl.<init>(GpioControllerImpl.java:56)
at com.pi4j.io.gpio.GpioFactory.getInstance(GpioFactory.java:91)
at com.lebruns.steven.epaper.WaveshareEP_SPI.<init>(WaveshareEP_SPI.java:110)
at com.lebruns.steven.epaper.WaveshareEPDisplay.<init>(WaveshareEPDisplay.java:20)
at com.lebruns.steven.epaper.Waveshare27BFrame.<init>(Waveshare27BFrame.java:23)
at com.lebruns.steven.epaper.epaper.main(epaper.java:29)



Running gpio from v2.44, the error message displayed is:


Oops - unable to determine board type... model: 13


gpio version 2.46 runs with no problems.


Is my exception problem due to pi4j 1.2-snapshot using an older version of wiringPi?  Or, is this a problem due to something else?


Are there any plans for spinning a new version of pi4j that uses the updated v2.46 of wiringPi?


Is there a way to force pi4j to use an external version of wiringPi?


Please note that I am doing my development on a Linux Mint laptop using Eclipse and debugging remotely on my Raspberry Pi.  When I started this project, I needed to use pi4j 1.2 in order to develop on a Raspberry Pi 3.  This added the requirement to use Java 8.  At that time, I could not find a version of Eclipse compiled for the Raspberry Pi that supported Java 8.  Now that I am starting to use a Raspberry Pi 3 B+, I am seeing this exception problem with a new set of code.

nicotine

unread,
Apr 9, 2018, 3:08:28 AM4/9/18
to Pi4J
已经有两年没有更新了,希望可以将项目更新起来

在 2018年4月9日星期一 UTC+8上午11:08:34,Steven F. Le Brun写道:

Robert Savage

unread,
Apr 23, 2018, 1:35:00 PM4/23/18
to Pi4J
All,

I was able to update the Pi4J 1.2-SNAPSHOT build today with the latest WiringPi. 
I have not had a change to thoroughly test it but it is available if you want to try it again.

Please Note: I have removed the default Pi4J native library static compile against WiringPi.  Now  Pi4J only dynamically links against WiringPi and thus you must have WiringPi installed on your target Raspberry Pi system.  (WiringPi is already included by default in the latest Raspbian images) 
Reply all
Reply to author
Forward
0 new messages