Processing-io.so on Raspberry Pi

I have a Processing sketch that uses the IO library to use the GPIO pins on a Raspberry Pi. It works. But the sketch has reached a size and level of complexity that I want to switch to Java for additional tooling and test libraries. I’ve gotten it building and running, except for the part that uses the IO library. I copied the io.jar from the /usr/local/lib/processing-3.4 dir to my project, and the project builds when I have that on the classpath. I added the linux-arm64 version of libprocessing-io.so, which seems like it should be correct. But when I run it I get this error:

OpenJDK Client VM warning: You have loaded library /usr/local/lib/processing-3.4/modes/java/libraries/io/library/linux-arm64/libprocessing-io.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'.

java.lang.UnsatisfiedLinkError: /usr/local/lib/processing-3.4/modes/java/libraries/io/library/linux-arm64/libprocessing-io.so: /usr/local/lib/processing-3.4/modes/java/libraries/io/library/linux-arm64/libprocessing-io.so: wrong ELF class: ELFCLASS64 (Possible cause: architecture word width mismatch)
at processing.opengl.PSurfaceJOGL$2.run(PSurfaceJOGL.java:408)
at java.lang.Thread.run(Thread.java:748)

When I run execstack on the .so file I get:

execstack: "/usr/local/lib/processing-3.4/modes/java/libraries/io/library/linux-arm64/libprocessing-io.so"'s architecture is not supported

I tried all the other versions of libprocessing-io.so and none work but this seems like the one that’s closest to being correct.

I realize I’m pretty far off the beaten path here, but it seems like I should be able to run this in plain Java, since it does work as .pde files. It seems like I might have the wrong .so file for Raspberry Pi? Does anyone have knowledge of how this dependency is resolved when running in plain Processing?

1 Like

If the application runs in the PDE, then you should be able to run the Java version of your code in your preferred Java editor. I suggest you hit the “Export this application” in the PDE and explore the generated file structure for your project. You can see what libraries are required to run your sketch.

Kf

1 Like

Sorry for the delay in responding. That worked! I started with the build script that is generated by the export, then modified it to use my compiled class, and it worked. Thanks so much!

2 Likes