Infisical / sdk

Infisical cross-language SDK

Home Page:https://infisical.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Java SDK: Unable to load library 'infisical_c'

tobiasfichter opened this issue · comments

We tried to use your most recent SDK v2.0.6-SNAPSHOT for Java to get secrets from our selfhosted Infisical Instance.
After adding the maven package to our pom and finishing development, building on both, windows and linux, failed.

On Windows it seems like infisical_c was expected in directory win32-x86-64, but the sdk-jar only contains the folder windows-x64
On Linux the files are expected in linux-x86-64, but no folder has a matching name.

After renaming windows-x64 to win32-x86-64 for windows and ubuntu-x64 to linux-x86-64 for linux the build was successful in both systems.

Getting Started for JNA seems to be relevant here.

Logs
Windows:

Suppressed: java.lang.UnsatisfiedLinkError: The specified module could not be found.

        at com.sun.jna.Native.open(Native Method) ~[jna-5.12.1.jar:5.12.1 (b0)]
        at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:270) ~[jna-5.12.1.jar:5.12.1 (b0)]
        ... 143 common frames omitted
    Suppressed: java.io.IOException: Native library (win32-x86-64/infisical_c.dll) not found in resource path (...;workspace\.m2\repository\com\infisical\sdk\2.0.6-SNAPSHOT\sdk-2.0.6-SNAPSHOT.jar;...)

Linux:

org.springframework.beans.BeanInstantiationException: Failed to instantiate [de.siedle.digitalplatform.sps.util.SecretResolver]: Constructor threw exception; nested exception is java.lang.UnsatisfiedLinkError: Unable to load library 'infisical_c':
libinfisical_c.so: cannot open shared object file: No such file or directory
Native library (linux-x86-64/libinfisical_c.so) not found in resource path (.../var/workspace/?/.m2/repository/com/infisical/sdk/2.0.6-SNAPSHOT/sdk-2.0.6-SNAPSHOT.jar...)

Hey @tobiasfichter, thank you for reporting this! I'll be looking into this as soon as possible. I'll keep you updated!

Hi again @tobiasfichter!

I just released a new version (2.0.7) that addresses this issue. There was indeed a mismatch between what JNA expected and our folder naming.

Thank you again for bringing this to our attention, and please let me know if the new version works for you!

Hi @DanielHougaard,

thank's a lot. Unfortunately the package requires GLIBC v2.33.
It seems like a lower version was sufficient for sdk v2.0.6.
But we are not entirely sure about that.

We are using docker image openjdk:11-slim which is based on debian 11 (bullseye). Bullseye contains GLIBC v2.31.

Logs on Linux:
Failed to instantiate [xxx.SecretResolver]: Constructor threw exception; nested exception is java.lang.UnsatisfiedLinkError: /lib/x86_64-linux-gnu/libc.so.6: version 'GLIBC_2.33' not found (required by /var/sssprod/workspace/workdir/?/.cache/JNA/temp/jna200431599513677063.tmp)

Hi @tobiasfichter, I'm glad the last patch fixed your issue.

Regarding you last issue, could I have you try to upgrade your glibc version in the image? Between the 2.0.6 and 2.0.7 version nothing has changed in that regard. I'm looking into it as well on my end, but the current resolution would appear to be upgrading the package!

Hi @DanielHougaard,
thanks a lot for your reply.
We moved to eclipse-temurin jdk, which contains glibc v2.35.
Our stack is now up and running!