Re: [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

2022-11-21 Thread Rob Kudyba
> В Mon, 21 Nov 2022 10:19:36 -0500
> Rob Kudyba  пишет:
>
> > I edited the last line to be:
> > export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/gcc-11.2/lib64 then
> > make install errored with:
> > /path/to/R-4.2.2/bin/exec/R: error while loading shared libraries:
> > libpcre2-8.so.0: cannot open shared object file: No such file or
> > directory
> >
> > So it appears that the same issue happens for PCRE! I then edited the
> > line to be:
> > export
> >
> LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/gcc-11.2/lib64:/path/to/pcre2-10.35/lib
> >
> > Then make install finished with:
> > Successfully remade target file `install'.
>
> Does the installed copy of R work?
>

Yes

Are you running make install as root? Programs starting as root are wary
> of environment variables such as LD_LIBRARY_PATH and may ignore or
> unset them while starting up (otherwise it would be trivial to load user
> code into setuid root binaries and take over the system). You may have
> to load the module again after you obtain the superuser privileges.
>

Ah I should've mentioned this. I did use sudo to install as the program
modules are shared and installed by root. That has to be the reason.


> "R Installation and Administration" [1] says that the R build process
> remembers the library paths to put into LD_LIBRARY_PATH, but only if
> they are specified in the LDFLAGS parameter, so if there's a set of
> library paths that's not expected to be normally present in
> LD_LIBRARY_PATH, perhaps it's best to mention them explicitly in the
> ./configure call.
>
> --
> Best regards,
> Ivan
>
> [1] https://cran.r-project.org/doc/manuals/R-admin.html


What would the ./configure options look like?

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [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

2022-11-21 Thread Rob Kudyba
On Sun, Nov 20, 2022 at 2:26 PM Ivan Krylov  wrote:

> On Sun, 20 Nov 2022 14:03:34 -0500
> Rob Kudyba  wrote:
>
> > /path/to/gcc-11.2/lib is definitely in LD_LIBRARY_PATH when loading
> > the GCC 11.2 module.
> >
> > If using the /path/to/R-4.2.2/etc/ldpaths where would I put the
> > correct path? I would've hoped the configure/make process would've
> > found this automatically.
>
> Interesting that bin/R works but calling bin/R from what amounts to
> `make -C src/library install` doesn't. I think that the failing step is
> the following command:
>
> @$(ECHO) "  building HTML index ..."
> @$(ECHO) "utils:::make.packages.html(.Library, verbose=FALSE,
> docdir=\"$(DESTDIR)${rdocdir}\")" | \
>  R_DEFAULT_PACKAGES=NULL LC_ALL=C ${R_EXE} >/dev/null
>
> I don't see a reason for Make to lose the LD_LIBRARY_PATH when
> launching R like this.
>
> Can you see the failing step in the `make -d install` output? There
> will be a lot of text, most of it unrelated, unfortunately.
>

I've uploaded the output to https://easyupload.io/scuujn
The gcc-related part has this:
  Considering target file `install-main'.
   File `install-main' does not exist.
Considering target file `install-Rscript'.
 File `install-Rscript' does not exist.
 Finished prerequisites of target file `install-Rscript'.
Must remake target `install-Rscript'.
Invoking recipe from Makefile:71 to update target `install-Rscript'.
make[2]: Entering directory `/path/to/me/R-4.2.2/src/unix'
gcc -I. -I../../src/include -I../../src/include  -I/usr/local/include
-DHAVE_CONFIG_H-g -O2  -L/usr/local/lib64
-DR_HOME='"/path/to/R-4.2/lib64/R"' \
  -o Rscript ./Rscript.c
Putting child 0x65bc00 (install-Rscript) PID 240122 on the chain.
Live child 0x65bc00 (install-Rscript) PID 240122

If something loses the LD_LIBRARY_PATH environment variable on the way
> from Make to R, hard-coding it in etc/ldpaths should work around the
> problem, but it may be hard to find out what went wrong.
>

I edited the last line to be:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/gcc-11.2/lib64 then make
install errored with:
/path/to/R-4.2.2/bin/exec/R: error while loading shared libraries:
libpcre2-8.so.0: cannot open shared object file: No such file or directory

So it appears that the same issue happens for PCRE! I then edited the line
to be:
export
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/gcc-11.2/lib64:/path/to/pcre2-10.35/lib

Then make install finished with:
Successfully remade target file `install'.


>
> If you run `mkfifo /tmp/1` and insert `read foo  etc/ldpaths, it should hang until you write something into /tmp/1.
> Using this, it should be possible to inspect /proc/${pid}/environ for
> the whole process tree from the parent Make process to the shell that's
> about to launch R. Can you find the first process that lacks the proper
> LD_LIBRARY_PATH environment variable?
>

I ran the 1st command and then added the 'read' to the file. I'm not
following what should've happened? I didn't need to include the back
ticks,`, in the file, correct? Perhaps the debug from make install will
provide you more info?

Would this be considered a bug or enhancement?

Thanks for your help on this.

Rob

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [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

2022-11-20 Thread Rob Kudyba
> It 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?
>

So far R does seem to be working and I've tested installing some packages.
Is there any sample R program I can run to test against this error?

>
> Does /path/to/R-4.2.2/bin/R -d ldd give you any useful information?


R -d ldd
linux-vdso.so.1 =>  (0x2aacd000)
libRblas.so => /path/to/R-4.2/lib64/R/lib/libRblas.so (0x2accf000)
libgfortran.so.5 => /path/to/gcc-11.2/lib64/libgfortran.so.5
(0x2aef9000)
libm.so.6 => /lib64/libm.so.6 (0x2b3a)
libquadmath.so.0 => /path/to/gcc-11.2/lib64/libquadmath.so.0
(0x2b6a2000)
libreadline.so.6 => /lib64/libreadline.so.6 (0x2b8e9000)
libpcre2-8.so.0 => /path/to/pcre2-10.35/lib/libpcre2-8.so.0
(0x2bb2f000)
liblzma.so.5 => /lib64/liblzma.so.5 (0x2bd88000)
libbz2.so.1 => /lib64/libbz2.so.1 (0x2bfae000)
libz.so.1 => /lib64/libz.so.1 (0x2c1be000)
librt.so.1 => /lib64/librt.so.1 (0x2c3d4000)
libdl.so.2 => /lib64/libdl.so.2 (0x2c5dc000)
libgomp.so.1 => /path/to/gcc-11.2/lib64/libgomp.so.1 (0x2c7e)
libpthread.so.0 => /lib64/libpthread.so.0 (0x2ca21000)
libc.so.6 => /lib64/libc.so.6 (0x2cc3d000)
/lib64/ld-linux-x86-64.so.2 (0x2aaab000)
libgcc_s.so.1 => /path/to/gcc-11.2/lib64/libgcc_s.so.1 (0x2d00a000)
libtinfo.so.5 => /lib64/libtinfo.so.5 (0x2d222000)


> 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?
>

[pid 241836] +++ exited with 0 +++
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=241836,
si_uid=547289, si_status=0, si_utime=0, si_stime=0} ---
openat(AT_FDCWD, "/sys/devices/system/cpu",
O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3

R version 4.2.2 (2022-10-31) -- "Innocent and Trusting"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

[Previously saved workspace restored]

strace: Process 241837 attached
strace: Process 241838 attached
[pid 241838] +++ exited with 0 +++
[pid 241837] --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED,
si_pid=241838, si_uid=547289, si_status=0, si_utime=0, si_stime=0} ---
[pid 241837] +++ exited with 0 +++
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=241837,
si_uid=547289, si_status=0, si_utime=0, si_stime=0} ---
strace: Process 241839 attached
[pid 241839] +++ exited with 0 +++
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=241839,
si_uid=547289, si_status=0, si_utime=0, si_stime=0} ---

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.
>

/path/to/gcc-11.2/lib is definitely in LD_LIBRARY_PATH when loading the GCC
11.2 module.

If using the /path/to/R-4.2.2/etc/ldpaths where would I put the correct
path? I would've hoped the configure/make process would've found this
automatically.

if test -n "/usr/local/lib64"; then
: ${R_LD_LIBRARY_PATH=${R_HOME}/lib:/usr/local/lib64}
else
: ${R_LD_LIBRARY_PATH=${R_HOME}/lib}
fi
if test -n "${R_JAVA_LD_LIBRARY_PATH}"; then
  R_LD_LIBRARY_PATH="${R_LD_LIBRARY_PATH}:${R_JAVA_LD_LIBRARY_PATH}"
fi
## This is DYLD_FALLBACK_LIBRARY_PATH on Darwin (macOS) and
## LD_LIBRARY_PATH elsewhere.
## However, on macOS >=10.11 (if SIP is enabled, the default), the
## environment value will not be passed to a script such as R.sh, so
## would not seen here.
if test -z "${LD_LIBRARY_PATH}"; then
  LD_LIBRARY_PATH="${R_LD_LIBRARY_PATH}"
else
  LD_LIBRARY_PATH="${R_LD_LIBRARY_PATH}:${LD_LIBRARY_PATH}"
fi
export LD_LIBRARY_PATH

> 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.
>

On RHEL from what I see openjdk-devel provides jni.h.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, 

[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

2022-11-20 Thread Rob Kudyba
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 user20 Mar 24  2022 libgfortran.so ->
libgfortran.so.5.0.0
lrwxrwxrwx 1 rk3199 user20 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 
  |  ^~~
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]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.