junixsocket-native not loading

Hi all,
This is a long-shot, but anyone know why the library junixsocket-native might not load on FreeBSD? I am using OpenJDK 13, and have tried every available version on FreeBSD 12.1-RELEASE-p2. I am trying to run the package 'signald', but this appears to be the only (at least current) error I am running into.

I am using junixsocket version 2.3.1.

Code:
[root@signald ~/signald/lib]# java -classpath $APP_HOME/lib/signald.jar:$APP_HOME/lib/signal-service-java-2.13.9_unofficial_1.jar:$APP_HOME/lib/bcprov-jdk15on-1.64.jar:$APP_HOME/lib/junixsocket-common-2.3.1.jar:$APP_HOME/lib/junixsocket-native-common-2.3.1.jar:$APP_HOME/lib/sentry-log4j2-1.7.30.jar:$APP_HOME/lib/log4j-core-2.13.0.jar:$APP_HOME/lib/log4j-api-2.13.0.jar:$APP_HOME/lib/slf4j-nop-1.8.0-beta4.jar:$APP_HOME/lib/picocli-4.2.0.jar:$APP_HOME/lib/signal-metadata-java-0.0.3.jar:$APP_HOME/lib/signal-protocol-java-2.7.1.jar:$APP_HOME/lib/protobuf-java-2.5.0.jar:$APP_HOME/lib/libphonenumber-8.10.7.jar:$APP_HOME/lib/jackson-databind-2.9.9.2.jar:$APP_HOME/lib/okhttp-3.12.1.jar:$APP_HOME/lib/threetenbp-1.3.6.jar:$APP_HOME/lib/sentry-1.7.30.jar:$APP_HOME/lib/slf4j-api-1.8.0-beta4.jar:$APP_HOME/lib/jackson-annotations-2.9.0.jar:$APP_HOME/lib/jackson-core-2.10.0.jar:$APP_HOME/lib/okio-1.15.0.jar:$APP_HOME/lib/curve25519-java-0.5.0.jar io.finn.signald.Main
04:34:00.956 [main] INFO  signald - Binding to socket /var/run/signald/signald.sock
Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load native library junixsocket-native for architecture amd64-FreeBSD
    at org.newsclub.net.unix.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:278)
    at org.newsclub.net.unix.NativeUnixSocket.<clinit>(NativeUnixSocket.java:40)
    at org.newsclub.net.unix.AFUNIXServerSocket.<init>(AFUNIXServerSocket.java:46)
    at org.newsclub.net.unix.AFUNIXServerSocket.newInstance(AFUNIXServerSocket.java:58)
    at io.finn.signald.Main.run(Main.java:96)
    at picocli.CommandLine.executeUserObject(CommandLine.java:1769)
    at picocli.CommandLine.access$900(CommandLine.java:145)
    at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2150)
    at picocli.CommandLine$RunLast.handle(CommandLine.java:2144)
    at picocli.CommandLine$RunLast.handle(CommandLine.java:2108)
    at picocli.CommandLine$AbstractParseResultHandler.handleParseResult(CommandLine.java:1968)
    at picocli.CommandLine.parseWithHandlers(CommandLine.java:2349)
    at picocli.CommandLine.run(CommandLine.java:2807)
    at picocli.CommandLine.run(CommandLine.java:2758)
    at io.finn.signald.Main.main(Main.java:54)
    Suppressed: java.lang.Exception: No library specified with -Dorg.newsclub.net.unix.library.override=
        at org.newsclub.net.unix.NativeLibraryLoader.loadLibraryOverride(NativeLibraryLoader.java:209)
        at org.newsclub.net.unix.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:223)
        ... 14 more
    Suppressed: java.lang.ClassNotFoundException: org.newsclub.lib.junixsocket.custom.NarMetadata
        at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
        at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
        at java.base/java.lang.Class.forName0(Native Method)
        at java.base/java.lang.Class.forName(Class.java:333)
        at org.newsclub.net.unix.NativeLibraryLoader.tryProviderClass(NativeLibraryLoader.java:53)
        at org.newsclub.net.unix.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:238)
        ... 14 more
    Suppressed: java.lang.UnsatisfiedLinkError: no junixsocket-native-2.3.1 in java.library.path: [/usr/lib, /usr/local/lib]
        at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2670)
        at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:806)
        at java.base/java.lang.System.loadLibrary(System.java:1909)
        at org.newsclub.net.unix.NativeLibraryLoader$StandardLibraryCandidate.load(NativeLibraryLoader.java:112)
        at org.newsclub.net.unix.NativeLibraryLoader.loadLibrary(NativeLibraryLoader.java:254)
        ... 14 more

Please also see, the junixsocket jar files exist. Any ideas?

Code:
[root@signald ~/signald/lib]# pwd
/root/signald/lib
[root@signald ~/signald/lib]# ls junixsocket*
junixsocket-common-2.3.1.jar        junixsocket-native-common-2.3.1.jar
 
I apologize, I posted in haste yesterday. I have two junixsockets in my test jail now. The first is one I compiled myself after quite a few typecasts, just to see if it would work. This does not have any libraries. The second is the one that signald, the package I am ultimately trying to use, has in its lib directory. The second has what you referenced but note the lack of FreeBSD

First:

Code:
root@signald:~/junixsocket/junixsocket-native-common/target # tar -tf junixsocket-native-common-2.3.1.jar 
META-INF/
META-INF/MANIFEST.MF
META-INF/versions/
META-INF/versions/9/
META-INF/versions/9/org/
META-INF/versions/9/org/newsclub/
META-INF/versions/9/org/newsclub/lib/
META-INF/versions/9/org/newsclub/lib/junixsocket/
META-INF/versions/9/org/newsclub/lib/junixsocket/common/
META-INF/versions/9/org/newsclub/lib/junixsocket/common/NarMetadata.class
META-INF/maven/
META-INF/maven/com.kohlschutter.junixsocket/
META-INF/maven/com.kohlschutter.junixsocket/junixsocket-native-common/
META-INF/maven/com.kohlschutter.junixsocket/junixsocket-native-common/pom.xml
META-INF/versions/9/module-info.class
org/
org/newsclub/
org/newsclub/lib/
org/newsclub/lib/junixsocket/
org/newsclub/lib/junixsocket/common/
org/newsclub/lib/junixsocket/common/NarMetadata.class
META-INF/maven/com.kohlschutter.junixsocket/junixsocket-native-common/pom.properties
module-info.class

Code:
root@signald:~/signald/build/install/signald/lib # tar -tf junixsocket-native-common-2.3.1.jar 
META-INF/
META-INF/MANIFEST.MF
org/
org/newsclub/
org/newsclub/lib/
org/newsclub/lib/junixsocket/
org/newsclub/lib/junixsocket/common/
org/newsclub/lib/junixsocket/common/NarMetadata.class
META-INF/versions/
META-INF/versions/9/
META-INF/versions/9/org/
META-INF/versions/9/org/newsclub/
META-INF/versions/9/org/newsclub/lib/
META-INF/versions/9/org/newsclub/lib/junixsocket/
META-INF/versions/9/org/newsclub/lib/junixsocket/common/
META-INF/versions/9/org/newsclub/lib/junixsocket/common/NarMetadata.class
META-INF/versions/9/module-info.class
META-INF/maven/
META-INF/maven/com.kohlschutter.junixsocket/
META-INF/maven/com.kohlschutter.junixsocket/junixsocket-native-common/
META-INF/maven/com.kohlschutter.junixsocket/junixsocket-native-common/pom.xml
META-INF/maven/com.kohlschutter.junixsocket/junixsocket-native-common/pom.properties
lib/
lib/x86_64-MacOSX-clang/
lib/x86_64-MacOSX-clang/jni/
lib/x86_64-MacOSX-clang/jni/libjunixsocket-native-2.3.1.dylib
lib/amd64-Linux-clang/
lib/amd64-Linux-clang/jni/
lib/amd64-Linux-clang/jni/libjunixsocket-native-2.3.1.so
lib/amd64-Linux-clang/jni/libjunixsocket-native-2.3.1.nodeps.so
lib/arm-Linux-clang/
lib/arm-Linux-clang/jni/
lib/arm-Linux-clang/jni/libjunixsocket-native-2.3.1.so
lib/arm-Linux-clang/jni/libjunixsocket-native-2.3.1.nodeps.so
lib/aarch64-Linux-clang/
lib/aarch64-Linux-clang/jni/
lib/aarch64-Linux-clang/jni/libjunixsocket-native-2.3.1.so
lib/aarch64-Linux-clang/jni/libjunixsocket-native-2.3.1.nodeps.so
lib/amd64-SunOS-clang/
lib/amd64-SunOS-clang/jni/
lib/amd64-SunOS-clang/jni/libjunixsocket-native-2.3.1.so
lib/ppc64le-Linux-clang/
lib/ppc64le-Linux-clang/jni/
lib/ppc64le-Linux-clang/jni/libjunixsocket-native-2.3.1.so
lib/ppc64le-Linux-clang/jni/libjunixsocket-native-2.3.1.nodeps.so
lib/s390x-Linux-clang/
lib/s390x-Linux-clang/jni/
lib/s390x-Linux-clang/jni/libjunixsocket-native-2.3.1.so
lib/s390x-Linux-clang/jni/libjunixsocket-native-2.3.1.nodeps.so
lib/riscv64-Linux-clang/
lib/riscv64-Linux-clang/jni/
lib/riscv64-Linux-clang/jni/libjunixsocket-native-2.3.1.so
lib/riscv64-Linux-clang/jni/libjunixsocket-native-2.3.1.nodeps.so
lib/amd64-Windows10-clang/
lib/amd64-Windows10-clang/jni/
lib/amd64-Windows10-clang/jni/junixsocket-native-2.3.1.dll
module-info.class
 
I should add, in the compiled directory I have what appears to be the compiled object file junixsocket/junixsocket-native/target/nar/junixsocket-native-2.3.1-amd64-FreeBSD-gpp-jni/lib/amd64-FreeBSD-gpp/jni/libjunixsocket-native-2.3.1.so. Is there a way to manually add it to a jar file?
 
You need to pass -Dorg.newsclub.net.unix.library.override=<library-path> to the JVM process. Java programs tend to come with annoying wrapper shell scripts, which often mess those arguments, so that might take a few attempts to get right. You can verify the passed arguments with visualvm.
 
Back
Top