Bug 1856636

Summary: JAVA_HOME Path are not set correct, so libjvm.so can't loaded
Product: [Fedora] Fedora EPEL Reporter: Frank Büttner <bugzilla>
Component: RAssignee: Tom "spot" Callaway <spotrh>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: epel7CC: i.ucar86, spotrh
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-07-16 11:33:41 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 Frank Büttner 2020-07-14 06:13:37 UTC
Description of problem:
In the file /usr/lib64/R/etc/ldpaths,
: ${R_JAVA_LD_LIBRARY_PATH=${JAVA_HOME}/lib/amd64/server}
must be 
: ${R_JAVA_LD_LIBRARY_PATH=${JAVA_HOME}/lib/server

because OpenJDK 8 and 11 don't have the amd64 sub dir.

Version-Release number of selected component (if applicable):
R-core-3.6.0-1.el7.x86_64


How reproducible:
Every time

Steps to Reproduce:
1. To to load the R Module rJava

Actual results:
It fails with:
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/lib64/R/library/rJava/libs/rJava.so':
  libjvm.so: cannot open shared object file: No such file or directory


Expected results:
That libjvm.so is found.

Additional info:
Workaround: modify /usr/lib64/R/etc/ldpaths via hand.

Comment 1 Tom "spot" Callaway 2020-07-14 19:17:50 UTC
Hmmm. Do you have R-java installed? That should pull in a dependency on "java-headless". Looking at the java-1.8.0-openjdk-headless package from Centos 7 (OpenJDK 8):

[spot@localhost sandbox]$ rpm -qlp java-1.8.0-openjdk-headless-1.8.0.242.b08-1.el7.x86_64.rpm |grep libjvm.so
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.242.b08-1.el7.x86_64/jre/lib/amd64/server/libjvm.so

java-11-openjdk-headless is a different story. I believe the system default in EL7 is OpenJDK 8 though...

Comment 2 Frank Büttner 2020-07-15 05:53:18 UTC
Hi, it looks like R-java is only an meta package, because it don't contains any files.

Comment 3 Tom "spot" Callaway 2020-07-15 11:28:07 UTC
Yes, R-java used to have files, but modern R has made them obsolete. Now, it mostly serves as a way to split out the "optional" java dependencies, which of course, are only optional as long as you don't need to use Java with R. :)

Comment 4 Frank Büttner 2020-07-15 11:36:47 UTC
Ok I understand,
R-java will only deliver Java8 and when Java11 is needed, simple don't install R-java.

Can /usr/lib64/R/etc/ldpaths so modified, to that the libjvm.so will searched in both paths?
: ${R_JAVA_LD_LIBRARY_PATH=${JAVA_HOME}/lib/amd64/server}
and
: ${R_JAVA_LD_LIBRARY_PATH=${JAVA_HOME}/amd64/server}

I don't have very deep knowledge about the way R searching libs.

Comment 5 Tom "spot" Callaway 2020-07-15 11:50:20 UTC
I think so. Is ${JAVA_HOME}/amd64/server correct though? I believe in OpenJDK 11+, the pathing is as you originally suggested, ${JAVA_HOME}/lib/server.

Comment 6 Frank Büttner 2020-07-15 11:57:13 UTC
Hi Tom,
no(my mistake).

for Java 1.8.0:
${JAVA_HOME}/lib/amd64/server}

ll /usr/lib/jvm/jre-1.8.0/lib/amd64/server/
insgesamt 38696
drwxr-xr-x. 2 root root       74 30. Apr 06:15 .
drwxr-xr-x. 5 root root     4096 30. Apr 06:15 ..
-r--r--r--. 1 root root 22347776 30. Apr 06:15 classes.jsa
lrwxrwxrwx. 1 root root       13 30. Apr 06:15 libjsig.so -> ../libjsig.so
-rwxr-xr-x. 1 root root 17265304 29. Apr 11:20 libjvm.so
-rw-r--r--. 1 root root     1423 29. Apr 11:05 Xusage.txt

And for Java 11:
${JAVA_HOME}/lib/server

ll /usr/lib/jvm/jre-11/lib/server/
insgesamt 41448
drwxr-xr-x. 2 root root       74 30. Apr 06:15 .
drwxr-xr-x. 7 root root     4096 30. Apr 06:15 ..
-r--r--r--. 1 root root 18112512 30. Apr 06:15 classes.jsa
-rwxr-xr-x. 1 root root    13752 29. Apr 11:22 libjsig.so
-rwxr-xr-x. 1 root root 24302424 29. Apr 11:22 libjvm.so
-rw-r--r--. 1 root root     1322 29. Apr 11:06 Xusage.txt

Comment 7 Tom "spot" Callaway 2020-07-15 12:04:57 UTC
Okay, I'll amend the R CMD javareconf calls in the scriptlets (for both R-core and R-java*) to include %{_jvmdir}/jre/lib/server as an additional valid path.

My plan is to just make this change in rawhide for now, but it will be inherited into the next R updates for EPEL8 and Fedora. We're not actually doing any additional R updates for EPEL7 because of the outdated toolchain.