Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to find multiple files from /root/.wpilib/... in PATH at jar runtime (Debian 11 / Ubuntu 22.04) #1151

Closed
Dannyzen opened this issue Jan 12, 2024 · 4 comments · May be fixed by #1195
Closed
Labels
bug Something isn't working

Comments

@Dannyzen
Copy link

Describe the bug

Hi there, I'm trying to get photonvision running on an arm64 debian 11 device. My current thinking is that the PATH variable is not being picked up by photonvision.jar based on the below (though welcome an alternative diagnosis):

java.io.IOException: /root/.wpilib/nativecache/linux/arm64/1cc8e0c0c9df1063c6f3789cda757535/libwpiutiljni.so could not be loaded from path
        attempted to load for platform /linux/arm64/
Last Load Error: 
/root/.wpilib/nativecache/linux/arm64/1cc8e0c0c9df1063c6f3789cda757535/libwpiutiljni.so: /root/.wpilib/nativecache/linux/arm64/1cc8e0c0c9df1063c6f3789cda757535/libwpiutiljni.so: file too short

        at edu.wpi.first.util.CombinedRuntimeLoader.loadLibrary(CombinedRuntimeLoader.java:158)
        at edu.wpi.first.util.CombinedRuntimeLoader.loadLibraries(CombinedRuntimeLoader.java:194)
        at org.photonvision.common.util.TestUtils.loadLibraries(TestUtils.java:57)
        at org.photonvision.Main.main(Main.java:307)
[2024-01-13 04:27:07] [General - Main] [INFO] Native libraries loaded.
java.io.IOException: /root/.wpilib/nativecache/linux/arm64/1cc8e0c0c9df1063c6f3789cda757535/libwpiutiljni.so could not be loaded from path
        attempted to load for platform /linux/arm64/
Last Load Error: 
/root/.wpilib/nativecache/linux/arm64/1cc8e0c0c9df1063c6f3789cda757535/libwpiutiljni.so: /root/.wpilib/nativecache/linux/arm64/1cc8e0c0c9df1063c6f3789cda757535/libwpiutiljni.so: file too short

        at edu.wpi.first.util.CombinedRuntimeLoader.loadLibrary(CombinedRuntimeLoader.java:158)
        at edu.wpi.first.util.CombinedRuntimeLoader.loadLibraries(CombinedRuntimeLoader.java:194)
        at org.photonvision.common.util.TestUtils.loadLibraries(TestUtils.java:57)
        at org.photonvision.mrcal.MrCalJNILoader.forceLoad(MrCalJNILoader.java:29)
        at org.photonvision.Main.main(Main.java:322)
[2024-01-13 04:27:07] [Camera - MrCalJNILoader] [ERROR] Couldn't load shared object mrcal_jni: /tmp/libmrcal_jni.so: libopencv_calib3d.so.4.8: cannot open shared object file: No such file or directory
java.lang.UnsatisfiedLinkError: /tmp/libmrcal_jni.so: libopencv_calib3d.so.4.8: cannot open shared object file: No such file or directory
        at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
        at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:388)
        at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:232)
        at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:174)
        at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2394)
        at java.base/java.lang.Runtime.load0(Runtime.java:755)
        at java.base/java.lang.System.load(System.java:1953)
        at org.photonvision.jni.PhotonJNICommon.forceLoad(PhotonJNICommon.java:61)
        at org.photonvision.mrcal.MrCalJNILoader.forceLoad(MrCalJNILoader.java:49)
        at org.photonvision.Main.main(Main.java:322)

What's confusing is that if I explicitly set the path variable in a shell, prior to run to:
PATH=PATH:**/root/.wpilib/nativecache/linux/arm64/1cc8e0c0c9df1063c6f3789cda757535**/lib:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

I still get the same issue when invoking
sudo java -jar photonvision.jar

journal_ctl_example.txt
photonvision-2024-1-13_04-30-17.log

@Dannyzen Dannyzen added the bug Something isn't working label Jan 12, 2024
@mcm001
Copy link
Contributor

mcm001 commented Jan 12, 2024

Iirc someone else saw the same error message -- maybe search through GitHub issues and discord message history to see if you can find that?

@Dannyzen
Copy link
Author

Dannyzen commented Jan 23, 2024

Tried installation today and receive the same result on


Description:    Ubuntu 22.04.3 LTS
Release:        22.04
Codename:       jammy

Why is the jar complaining at runtime that it's unable to find the libs in path, even after PATH contains the lib files?

@Dannyzen Dannyzen changed the title Linux / Debian 11: libwpiutiljni.so could not be loaded from path Unable to find multiple files in PATH at jar runtime (Debian 11 / Ubuntu 22.04) Jan 23, 2024
@Dannyzen Dannyzen changed the title Unable to find multiple files in PATH at jar runtime (Debian 11 / Ubuntu 22.04) Unable to find multiple files from /root/.wpilib/... in PATH at jar runtime (Debian 11 / Ubuntu 22.04) Jan 23, 2024
@Dannyzen
Copy link
Author

Resolved.

Things I did wrong: I ran apt-get update and apt-get upgrade after install. This (oddly) broke the installation environment expectations and caused the above issues.

@Dannyzen
Copy link
Author

Actually.... This service may have just needed a PATH variable set in the systemd service config.

https://stackoverflow.com/questions/63377036/systemd-unable-to-find-java explains how to add a PATH variable at startup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants