Rob Kudyba
2022-Nov-18 21:45 UTC
[R] make install libgfortran.so.5: cannot open shared object file: No such file or directory; conftest.c:1:10: fatal error: jni.h: No such file or directory
On RHEL 8 with GCC 11.2.0 loaded as a module in a non-standard location I'm
the below error with make install. libgfortran.so is definitely in
$LD_LIBRARY_PATH, i.e., /path/to/gcc-11.2/lib64
ls -l /path/to/gcc-11.2/lib64/*fortran.so*
lrwxrwxrwx 1 rk3199 user 20 Mar 24 2022 libgfortran.so ->
libgfortran.so.5.0.0
lrwxrwxrwx 1 rk3199 user 20 Mar 24 2022 libgfortran.so.5 ->
libgfortran.so.5.0.0
-rwxr-xr-x 1 rk3199 user 8595744 Mar 24 2022 libgfortran.so.5.0.0
Here is where the error occurs in make install:
[...]
installing packages ...
building HTML index ...
/path/to/R-4.2.2/bin/exec/R: error while loading shared libraries:
libgfortran.so.5: cannot open shared object file: No such file or directory
make[2]: *** [install] Error 127
make[2]: Leaving directory `/path/to/R-4.2.2/src/library'
make[1]: *** [install] Error 1
make[1]: Leaving directory `/path/to/rk3199/R-4.2.2/src'
make: *** [install] Error 1
During make I see this error with Java:
configuring Java ...
Java interpreter : /usr/bin/java
Java version : 1.8.0_161
Java home path :
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-2.b14.el7.x86_64/jre
Java compiler : not present
Java headers gen.:
Java archive tool:
trying to compile and link a JNI program
detected JNI cpp flags :
detected JNI linker flags : -L$(JAVA_HOME)/lib/amd64/server -ljvm
make[2]: Entering directory `/tmp/Rjavareconf.3sImDz'
gcc -I"/path/to/R-4.2.2/include" -DNDEBUG -I/usr/local/include
-fpic
-O3 -march=native -c conftest.c -o conftest.o
conftest.c:1:10: fatal error: jni.h: No such file or directory
1 | #include <jni.h>
| ^~~~~~~
compilation terminated.
make[2]: *** [conftest.o] Error 1
make[2]: Leaving directory `/tmp/Rjavareconf.3sImDz'
Unable to compile a JNI program
JAVA_HOME :
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.161-2.b14.el7.x86_64/jre
Java library path:
JNI cpp flags :
JNI linker flags :
Updating Java configuration in /path/to/R-4.2.2
Done.
That seems a little more straight forward in that our Java 1.7.0 nor 1.8.0
have a jni.h file. Looks like we'd need the devel package installed.
Thanks for any suggestions for the former.
[[alternative HTML version deleted]]
Ivan Krylov
2022-Nov-20 17:37 UTC
[R] make install libgfortran.so.5: cannot open shared object file: No such file or directory; conftest.c:1:10: fatal error: jni.h: No such file or directory
On Fri, 18 Nov 2022 16:45:14 -0500 Rob Kudyba <rk3199 at columbia.edu> wrote:> Here is where the error occurs in make install: > [...] > installing packages ... > building HTML index ... > /path/to/R-4.2.2/bin/exec/R: error while loading shared libraries: > libgfortran.so.5: cannot open shared object file: No such file or > directory make[2]: *** [install] Error 127 > make[2]: Leaving directory `/path/to/R-4.2.2/src/library' > make[1]: *** [install] Error 1 > make[1]: Leaving directory `/path/to/rk3199/R-4.2.2/src' > make: *** [install] Error 1It should be possible to run R without installing it, as /path/to/R-4.2.2/bin/R (strictly speaking, as bin/R under the build directory, if you're building R separately from the source tree). Does it work? Does /path/to/R-4.2.2/bin/R -d ldd give you any useful information? Can you use strace -f -e openat /path/to/R-4.2.2/bin/R to confirm that the dynamic library loader is looking in /path/to/gcc-11.2/lib64 for the shared objects? If /path/to/gcc-11.2/lib64 is missing from both /etc/ld.so.conf and the environment variable LD_LIBRARY_PATH and you don't want to set it manually every time, you can either edit /path/to/R-4.2.2/etc/ldpaths or pass the -Wl,-rpath=/path/to/gcc-11.2/lib64 flag to the linker.> During make I see this error with Java:This error is not fatal. rJava won't work, but the rest of R should be fine. -- Best regards, Ivan