Ubuntu – java-8-oracle (1.8.0_66) problem with PrintAssembly “Could not load hsdis-amd64.so”


I'm trying to run my programs with -XX:+PrintAssembly options but I always get message like:

Java HotSpot(TM) 64-Bit Server VM warning: PrintAssembly is enabled; turning on DebugNonSafepoints to gain additional output Could not load
hsdis-amd64.so; library not loadable; PrintAssembly is disabled

I downloaded the hsdis-amd64.so from Kenai: https://kenai.com/projects/base-hsdis/downloads

I have build this library myself with http://sourceforge.net/projects/fcml/files/fcml-1.1.1/ project.

I put it everywhere "google says":


with names:


I have tried even set manually export LD_LIBRARY_PATH=/usr/lib/jvm/java-8-oracle/jre/lib/amd64/server/

… and all for nothing.

No more Google results no more combination of above solutions 🙁

Could anyone can help me?

Best Answer

First install libhsdis0-fcml as described in the other answer1:

sudo apt-get install libhsdis0-fcml

This only installs it for OpenJDK. You are, however, using java-8-oracle, so you'll need to copy it over there. Here's the exact copy command that worked for me:

sudo cp /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/hsdis-amd64.so /usr/lib/jvm/java-8-oracle/jre/lib/amd64/hsdis-amd64.so

If that's still not working, you might try an strace to see where your java is looking. I used:

strace -f java -XX:CompileCommand='print, *.*' ... |& grep hsdis

to get output like this:

[pid 10783] open("/usr/lib/jvm/java-8-oracle/jre/lib/amd64/server/libhsdis-amd64.so", O_RDONLY <unfinished ...>
[pid 10783] open("/usr/lib/jvm/java-8-oracle/jre/lib/amd64/server/libhsdis-amd64.so", O_RDONLY|O_CLOEXEC <unfinished ...>
[pid 10783] open("/usr/lib/jvm/java-8-oracle/jre/lib/amd64/server/libhsdis-amd64.so", O_RDONLY|O_NONBLOCK <unfinished ...>
[pid 10783] open("/usr/lib/jvm/java-8-oracle/jre/lib/amd64/server/hsdis-amd64.so", O_RDONLY <unfinished ...>
[pid 10783] open("/usr/lib/jvm/java-8-oracle/jre/lib/amd64/server/hsdis-amd64.so", O_RDONLY|O_CLOEXEC <unfinished ...>
[pid 10783] open("/usr/lib/jvm/java-8-oracle/jre/lib/amd64/server/hsdis-amd64.so", O_RDONLY|O_NONBLOCK <unfinished ...>
[pid 10783] open("/usr/lib/jvm/java-8-oracle/jre/lib/amd64/hsdis-amd64.so", O_RDONLY <unfinished ...>
[pid 10783] open("/usr/lib/jvm/java-8-oracle/jre/lib/amd64/hsdis-amd64.so", O_RDONLY|O_CLOEXEC) = 14

You can see that the places and names you were trying are definitely among those the JDK searches (in my case, it probably would have searched more places, but stopped since the last location above is where it found the shared object).

Note that you definitely need the -f flag to strace since the actual JVM is launched as a child process of the original java command.

Among the issues strace might reveal is a permissions issue. I only needed read perms on the library for the user launching java.

My java -version output:

java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)

1 Really, this is just a way to get a (presumably working) hsdis.so file in a package-manager friendly way. You could always just download it directly from one of the various sources as well.