-
Notifications
You must be signed in to change notification settings - Fork 123
jni: libjvm.so or libjawt.so not found at runtime #3669
Comments
Thank you for reporting this problem! This looks quite urgent. This should work by default: is maybe the TOML plugin not available?
Is there also an error? In what you pasted is only an warning.
Probably not but if the loading of a module fails warnings get emitted anyway. The easiest fix would be to deploy a /etc/ld.so.conf.d/ file which includes $JAVA_HOME/lib/server. Another approach would be to set RUNPATH like /usr/bin/r is doing. But both does not sound to be the clean way to do it. @robaerd did you already investigate what is the best way to link against libjvm.so? Maybe we are doing something wrong there. Did you find any other packages which do this? Probably we need to add some CMake magic to make libelektra-jni link against libjvm.so. |
The TOML plugin is available and working.
Sorry, no error, but the file does not get mounted.
Not yet, but I can of course do that. |
Seems like there are even several issues involved here. Can you give me Docker commands to reproduce the problem?
Thank you. It might even be a bug in CMake on these platforms, it looks to me we already link against https://stackoverflow.com/questions/7715804/how-to-use-find-jni-on-cmake/7716814#7716814 |
I used the Dockerfile in docker build -t focal-elektra --build-arg JENKINS_USERID=$(id -u) --build-arg JENKINS_GROUPID=$(id -g) -f scripts/docker/ubuntu/focal/Dockerfile scripts/docker/ubuntu/focal/
docker run -it -d --name focal-elektra focal-elektra:latest
docker exec -it focal-elektra /bin/bash
# install Elektra with jni plugin
cd /home/jenkins
git clone https://github.com/ElektraInitiative/libelektra.git
cd libelektra
mkdir build
cd build
cmake -DPLUGINS='ALL;jni' ..
make install
kdb mount test.ini system:/test/ini ini If you want to reproduce this with the Debian packages on Ubuntu Focal: docker run -it -d --name focal-elektra-packages ubuntu:focal
docker exec -it focal-elektra-packages /bin/bash
apt update
apt install gnupg software-properties-common apt-transport-https
apt-key adv --keyserver keys.gnupg.net --recv-keys F26BBE02F3C315A19BF1F791A9A25CC1CC83E839
echo "deb https://debs.libelektra.org/focal focal main" | tee /etc/apt/sources.list.d/elektra.list
apt update
apt install libelektra5-all
kdb mount test.ini system:/test/ini ini |
Thank you for the instructions! Would be nice to have such images for the next release! Part of the problem might be solved with: #3673: I suspect this loop terminated early, not finding the For JNI loading itself, we also need to find a solution. The linking does not seem to be correct:
|
On Debian Buster I get:
Which seems to be also due to wrong linkage. |
Debian Buster repo should contain the latest debs of master. My example above only was for the released packages.
Yes this fixed the issue where the file did not get mounted. Thank you! |
Thank you, my fault. I forgot the
Perfect, so we now back to the problem that loading jni fails. Any new result on that? |
After building Elektra, libjvm.so is found: $ ldd /home/jenkins/libelektra/build/lib/libelektra-jni.so
...
libjvm.so => /usr/lib/jvm/default-java/lib/server/libjvm.so (0x00007f151b479000)
... However after installing it can not be found anymore: $ ldd /usr/local/lib/elektra/libelektra-jni.so
...
libjvm.so => not found
... I'm not sure why this is the case. |
Yes, I can confirm. The RUNPATH (readelf) changes from:
to:
during installation, which might be the problem. For example, on Debian stretch
So keeping the RUNPATH (or setting an RPATH with CMAKE_INSTALL_RPATH for this module) would be an option how we can solve the problem. |
Steps to Reproduce the Problem
This error does occur if the jni plugin is built. This also affects our packages for Ubuntu, Debian and Fedora as jni gets installed as part of the
libelektra5-all
package.When setting
LD_LIBRARY=$JAVA_HOME/lib/server
, then mounting with ini, xml and json is working.As far as I can tell, the
jni
plugin shouldn't even be needed for these plugins?System Information
The text was updated successfully, but these errors were encountered: