mercredi 6 mars 2019

JNI load .so file compiled with c++11 arise error “/usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.18' not found”

I compiled C++ code with gcc 4.8.2 (which is c++11 version and it is necessary for my C++ code) and generated a libmy.so file. I want to call the method in libmy.so from Java code with JNI, and I have set LD_LIBRARY_PATH to be the path of libmy.so. When run Java code, errors info is like below: Exception in thread "main" java.lang.UnsatisfiedLinkError: .../libmy.so: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.18' not found (required by libmy.so)

Because this Linux machine is common used, I don't want to modify files in /usr/lib64 (e.g., modify the link of libstdc++.so.6).

By the way, my JDK version is 1.8, I tried JDK 1.11 and it also failed.

It seems that Java can't load the right version of "libstdc++.so.6" (also for "libc.so"), but I am not sure.

How to fix this problem? Thanks a lot!

Aucun commentaire:

Enregistrer un commentaire