Cannot load native library libLiteCore.so

Hey All,

I have created one Spring boot application with couchbase Lite Java as maven dependency. Application is getting up in my local having windows OS. But, when I try to run my executable jar on Linux ubuntu machine I am getting following error on couchbase Init.

Caused by: java.lang.IllegalStateException: Cannot load native library libLiteCore.so @/greengrass/v2/work/DatabaseManager/CouchbaseLiteTemp/7eeb7166a5fd30ef3bfdbbd40057ccae/libLiteCore.so for Linux/amd64.

Regards,
Nalay Patel

@nalaypatel
Have you looked to see what is in /greengrass/v2/work/DatabaseManager/CouchbaseLiteTemp/7eeb7166a5fd30ef3bfdbbd40057ccae ?

You haven’t posted any of the stacktrace that the code generates, when this failure occurs. That will make it pretty difficult for me to locate the problem, precisely.

I would guess that the problem is that your Linux system is identifying itself as an “amd64” instead of an “x86_64”, which is the only ABI that we support.

Hello
CBL’s way of finding out the OS and architecture is to invoke:

  • System.getProperty(“os.name”)
  • System.getProperty(“os.arch”)
    Sometimes Java returns: “Linux” & amd64
    But if when you do “lscpu” on Linux OS you get:
    $ lscpu
    Architecture: x86_64
    CPU op-mode(s): 32-bit, 64-bit

It should be compatible.

Remember to add the environment env variable:
Add the paths of the directories <lib-directory>/support/libc++ and <lib-directory>/support/libicu to LD_LIBRARY_PATH
as it says in the documentation: Couchbase Lite on Java — Prerequisites | Couchbase Docs

Regards

Hey @nalaypatel : is there anything more we can do here? If not could you mark this thread closed?