Bug 2009974

Summary: libjvm.so not found
Product: [Fedora] Fedora Reporter: Iñaki Ucar <i.ucar86>
Component: RAssignee: Tom "spot" Callaway <spotrh>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 36CC: ahughes, ashundi, billcrawford1970, i.ucar86, jerboaa, jvanek, mageia-java, spotrh
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-04-04 16:05:38 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Iñaki Ucar 2021-10-02 15:10:09 UTC
This is very strange: since the latest update, if I install an R package compiled against the openjdk in a clean system, it fails to load because it doesn't find libjvm.so. Reporting against the openjdk because nothing has changed in the R spec, and reporting against rawhide because it fails for all versions. Steps to reproduce, e.g., with Fedora 34:

$ podman run fedora:34
$ dnf install 'dnf-command(copr)'
$ dnf copr enable iucar/cran
$ dnf install R-CRAN-rJava
$ Rscript -e 'library(rJava)'
Error: package or namespace load failed for ‘rJava’:
 .onLoad failed in loadNamespace() for 'rJava', details:
  call: dyn.load(file, DLLpath = DLLpath, ...)
  error: unable to load shared object '/usr/local/lib/R/library/rJava/libs/rJava.so':
  libjvm.so: cannot open shared object file: No such file or directory
Execution halted

Interestingly enough,

$ dnf install R-java
$ Rscript -e 'library(rJava)'

and the package loads correctly. Even more interestingly,

$ dnf uninstall R-java
$ Rscript -e 'library(rJava)'

and the package still loads correctly. So my guess is that the installation of R-java (which, please note, is an *empty* package) triggers something that should be triggered when Java is installed.

Comment 1 Iñaki Ucar 2021-10-29 13:46:16 UTC
Adding @spot to the CC. Maybe the R spec is doing something wrong, but this used to work. Simpler example:

$ podman run --rm -it fedora:32
# dnf -y install R
# ll $(R CMD config JAVA_HOME)
lrwxrwxrwx. 1 root root 21 Oct 29 13:31 /usr/lib/jvm/jre -> /etc/alternatives/jre

However, since F33 on (so I suspect this is since some recent Java 11 update):

$ podman run --rm -it fedora:33
# dnf -y install R
# ll $(R CMD config JAVA_HOME)
ls: cannot access '/usr/lib/jvm/java-11-openjdk-11.0.11.0.9-0.fc33.x86_64': No such file or directory

Wrong path. The R spec uses %{_jvmdir} in %post to set the proper paths: https://src.fedoraproject.org/rpms/R/blob/rawhide/f/R.spec#_861. So apparently %{_jvmdir} takes a wrong path?

Comment 2 Iñaki Ucar 2021-10-29 15:10:44 UTC
I found the issue. Alternatives creation was moved to posttrans:

- https://src.fedoraproject.org/rpms/java-11-openjdk/blob/rawhide/f/java-11-openjdk.spec#_2503
- https://src.fedoraproject.org/rpms/java-1.8.0-openjdk/blob/rawhide/f/java-1.8.0-openjdk.spec#_2674

So the call to javareconf must be moved to posttrans too. Issue moved to the R component.

Comment 3 Ben Cotton 2022-02-08 21:27:21 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 36 development cycle.
Changing version to 36.

Comment 4 Iñaki Ucar 2022-04-04 16:05:38 UTC
This was fixed in https://src.fedoraproject.org/rpms/R/pull-request/6