facebook / rocksdb

A library that provides an embeddable, persistent key-value store for fast storage.
http://rocksdb.org
GNU General Public License v2.0
27.85k stars 6.2k forks source link

java.lang.UnsatisfiedLinkError: /tmp/librocksdbjni17844983601921261821.so: /tmp/librocksdbjni17844983601921261821.so: cannot open shared object file: No such file or directory (Possible cause: can't load AMD 64 .so on a AARCH64 platform) #12779

Closed suddendust closed 1 week ago

suddendust commented 2 weeks ago

I am trying to port my application to linux/aarch64 (AWS Graviton) and getting the following exception:

java.lang.UnsatisfiedLinkError: /tmp/librocksdbjni17844983601921261821.so: /tmp/librocksdbjni17844983601921261821.so: cannot open shared object file: No such file or directory (Possible cause: can't load AMD 64 .so on a AARCH64 platform)
    at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
    at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:331)
    at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:197)
    at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:139)
    at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2418)
--
    at org.apache.helix.messaging.handling.HelixTask.call(HelixTask.java:49) ~[helix-core-1.3.1.jar:1.3.1]
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317) ~[?:?]
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
    at java.base/java.lang.Thread.run(Thread.java:1583) [?:?]

I am using rocksdbjni version 8.3.2. In the unzipped jar, I see that we do have this artifact librocksdbjni-linux-aarch64.so.

Expected behavior

This exception should not occur since we have the artifact required for linux/aarch64.

Actual behavior

The exception above.

Steps to reproduce the behavior

Build https://github.com/apache/pinot on an linux/aarch64 system using the command: mvn clean install -Dcheckstyle.skip -Dlicense.skip -Dos.arch=aarch_64 -Pbin-dist -U -fn

adamretter commented 2 weeks ago

What do the following Java properties return on your system?

  1. System.getProperty("os.name")
  2. System.getProperty("os.arch")
  3. System.getenv("ROCKSDB_MUSL_LIBC")

You can see how the native library is selected here -https://github.com/facebook/rocksdb/blob/main/java/src/main/java/org/rocksdb/util/Environment.java#L229

suddendust commented 2 weeks ago

@adamretter Thanks for the response. Here's the result of what you requested:

System.getProperty("os.name"): Linux System.getProperty("os.arch"): aarch64 System.getenv("ROCKSDB_MUSL_LIBC"): null

adamretter commented 2 weeks ago

@suddendust Okay that all looks good so far. We need to exclude Apache pinot here. Can you provide a minimal reproducible test-case using just RocksJava please?

suddendust commented 1 week ago

@adamretter This is solved. I was mistakenly overrides os.arch to aarch_64 instead of aarch64 and this was messing things up šŸ¤¦ I am closing this issue.