Installing rJava on SLES 12 - r

I am attempting to install rJava on Suse SLES 12. I have installed JDK 7 (7u51), fixed my JAVA_HOME, run sudo R CMD javareconf and installed the package suggested here: rJava won't install on openSUSE 13.2.
gcc -std=gnu99 -o libjri.so Rengine.o jri.o Rcallbacks.o Rinit.o globals.o rjava.o -shared -L/usr/java/jdk1.7.0_51/jre/lib/amd64/server -ljvm -Wl,--export-dynamic -fopenmp -L/usr/lib64/R/lib -lR -lpcre -llzma -lz -lrt -ldl -lm -licuuc -licui18n
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: cannot find -lpcre
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: cannot find -llzma
/usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bin/ld: cannot find -lz
collect2: error: ld returned 1 exit status
Makefile.all:38: recipe for target 'libjri.so' failed
make[2]: *** [libjri.so] Error 1
make[2]: Leaving directory '/tmp/RtmptpO8Z9/R.INSTALL7e795f7a8704/rJava/jri/src'
Makefile.all:21: recipe for target 'src/JRI.jar' failed
make[1]: *** [src/JRI.jar] Error 2
make[1]: Leaving directory '/tmp/RtmptpO8Z9/R.INSTALL7e795f7a8704/rJava/jri'
Makevars:14: recipe for target 'jri' failed
make: *** [jri] Error 2
ERROR: compilation failed for package ‘rJava’
* removing ‘/opt/node_apps/acas-2016-02-03-13-07-09/r_libs/rJava’
I have attempted to update zypper install libpcre1 and zypper install liblzma5, but updating them did not change the error message.
I know that on Ubuntu there is a liblzma-dev that could help (https://github.com/s-u/rJava/issues/8), but I can't find a similar package for Suse.
Does anyone know what I am missing?

Please install the following RPM packages
xz-devel
pcre-devel
pcre-devel-static
zlib-devel
and try again. I'm not quite sure right now, but if that didn't help, please make sure that these packages are installed aswell:
xz
libpcre1
liblzma5

Related

Problem installing "nloptr" in R 4.2.2 on Ubuntu 22.04

My installation of "ggpubr" on Rstudio (based on R 4.2.2) in Ubuntu 22.04 failed because of issues in installing "nloptr". I installed NLOPT based on guides in https://nlopt.readthedocs.io/en/latest/NLopt_Installation/, but nloptr installation is still failing but with another kind of error.
Here are the last lines:
g++ -std=gnu++11 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -flto=auto -ffat-lto-objects -flto=auto -Wl,-z,relro -o nloptr.so init_nloptr.o nloptr.o test-C-API.o test-runner.o -llapack -lblas -lgfortran -lm -lquadmath -L/usr/local/lib -lnlopt -L/usr/lib/R/lib -lR
/usr/bin/ld: cannot find -llapack: No such file or directory
/usr/bin/ld: cannot find -lblas: No such file or directory
/usr/bin/ld: cannot find -lgfortran: No such file or directory
collect2: error: ld returned 1 exit status
make: *** [/usr/share/R/share/make/shlib.mk:10: nloptr.so] Error 1
ERROR: compilation failed for package ‘nloptr’
Any help is appreciated.
Best,
Amir
The comments by #jay.sf and myself give you the narrowest answer: you attempt to build from source, and compiling and linking requires the so-called -dev packages. So install r-base-dev.
Looking beyond this for a second though, you are on Ubuntu 22.04 and you have r-cran-nloptr inside the distribution too (albeit an older version). So sudo apt install r-cran-nloptr works as well.
And since this summer there is r2u which gives you (on Ubuntu 20.04 and Ubuntu 22.04) every CRAN package as an Ubuntu binary and is generally current. It is easy to set up and the command install.packages("ggpubr") would then reliably and quickly install the package and all its dependencies from binaries.

Linking error for RInside on Mac OS X 11.6 (Big Bur): pcre2-8 library not found

This is likely an error installing PCRE2 (which I did using "sudo port install pcre2"), but when I "make" sample code for RInside, I get:
$ make rinside_sample0
clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I/Library/Frameworks/R.framework/Resources/include -I/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include -I/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RInside/include -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include rinside_sample0.cpp -L/usr/local/lib -F/Library/Frameworks/R.framework/.. -framework R -L/usr/local/lib -lpcre2-8 -llzma -lbz2 -lz -licucore -ldl -lm -liconv -L/Library/Frameworks/R.framework/Resources/lib -lRblas -L/Library/Frameworks/R.framework/Resources/lib -lRlapack /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RInside/lib/libRInside.a -o rinside_sample0
In file included from rinside_sample0.cpp:10:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RInside/include/RInside.h:26:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RInside/include/RInsideCommon.h:38:
In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/Rcpp.h:57:
/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/Rcpp/DataFrame.h:136:18: warning: unused variable 'data'
[-Wunused-variable]
SEXP data = Parent::get__();
^
1 warning generated.
ld: library not found for -lpcre2-8
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [rinside_sample0] Error 1
$
Thank you for the comment, Dirk. You got me pointed in the correct direction. I had two old versions of code: pcre2 and Rcpp.
I followed the directions for installing the latest version of "pcre2" here: https://izziswift.com/how-to-install-pcre-development-headers-on-mac-osx/.
I downloaded "pcre" version 10.39, cd'd to that directory, ran:
./configure
make
make install
After that, the examples in RInside compiled, but I got a runtime error:
$ ./rinside_sample0
Error: function 'Rcpp_precious_remove' not provided by package 'Rcpp'
Execution halted
$
Some searching showed that error arose from running an older version (1.0.6) of "Rcpp". I went into RStudio, typed "install.packages("Rcpp")" to update to version 1.0.7 and now everything runs!
Hopefully going through these steps will help anyone else who encounters these problems.

collect2: error: ld returned 1 exit status" on R to install statmod package

I'm new on R version 3.6.3 (2020-02-29). I'm working on a Linux Mint 19.3 Tricia. I tried to install the package statmod with this code line:
install.package("statmod")
When I compiled this line R return this error:
error:
gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o statmod.so gaussq2.o init.o -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR
/usr/bin/ld : ne peut trouver -lgfortran
collect2: error: ld returned 1 exit status
/usr/share/R/share/make/shlib.mk:6: recipe for target 'statmod.so' failed
make: *** [statmod.so] Error 1
ERROR: compilation failed for package ‘statmod’
* removing ‘/home/etudiant/R/x86_64-pc-linux-gnu-library/3.6/statmod’
Warning in install.packages :
installation of package ‘statmod’ had non-zero exit status
The downloaded source packages are in
‘/tmp/Rtmp8yGctp/downloaded_packages’
More informations:
gfortran compile basic function and when I wrote gfortran -v in my terminal, I got this answer :
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.5.0-3ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)
I don't know how to solve this error. If someone has an idea that can really help me.
Thank you very much by advance.

Compilation error of R package

I want to compile hsphase package (R package available in CRAN).
I used this command in R install.packages("hsphase").
I have got the following errors:
g++ -m64 -shared -L/usr/lib64/R/lib -Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -o hsphase.so FastDist.o MAF.o Ohd.o TypeConversion.o block.o block4Phase.o co.o diag.o hsp.o main.o memory.o oh.o swDetect.o [1] 0 -L/usr/lib64/R/lib -lRlapack -L/usr/lib64/R/lib -lRblas -lgfortran -lm -lquadmath -fopenmp -L/usr/lib64/R/lib -lR
g++: error: [1]: No such file or directory
g++: error: 0: No such file or directory
/usr/share/R/make/shlib.mk:6: recipe for target 'hsphase.so' failed
make: *** [hsphase.so] Error 1
ERROR: compilation failed for package ‘hsphase’
* removing ‘/home/mhf/R/x86_64-redhat-linux-gnu-library/3.3/hsphase’
The downloaded source packages are in
‘/tmp/RtmpYukJQa/downloaded_packages’
Warning message:
In install.packages("hsphase") :
installation of package ‘hsphase’ had non-zero exit status
I am using fedora 24.
The g++ version:
gcc version 6.1.1 20160621 (Red Hat 6.1.1-3) (GCC)
Please check the link flag:
what is this:
[1] 0
I comment this line in the scr/Makevars file:
#PKG_LIBS = `$(R_HOME)/bin/Rscript -e "Rcpp:::LdFlags()"` $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) $(SHLIB_OPENMP_CXXFLAGS)
Now, I can compile the package.

ld fails to find openssl, even though its present

I am trying to install RCurl in R 3.2.0 in RHEL 5.
install.packages("RCurl")
At the end it failed because
gcc -std=gnu99 -shared -L/home/gowthan/Downloads/R-3.2.0/lib -L/usr/local/lib64 -o RCurl.so base64.o curl.o curlInit.o curl_base64.o enums.o json.o memoryManagement.o myUTF8.o -L/local/p4clients/pkgbuild-5R4zB/workspace/build/Curl/Curl-7.18.1.155.6782/RHEL5_64/DEV.STD.PTHREAD/build/private/curl/install/lib -lcurl -L/opt/brazil-pkg-cache/packages/Fbopenssl/Fbopenssl-0.0.4.504.7765/RHEL5_64/DEV.STD.PTHREAD/build/lib -lfbopenssl -L/local/p4clients/pkgbuild-5R4zB/workspace/build/Curl/Curl-7.18.1.155.6782/RHEL5_64/DEV.STD.PTHREAD/build/private/tmp/brazil-path/[Openssl]lib.libfarm/lib -L/local/p4clients/pkgbuild-k5Vrj/workspace/build/Libxml2/Libxml2-2.7.8.334.176/RHEL5_64/DEV.STD.PTHREAD/build/private/libxml2/install/lib -lxml2 -lz -lm -L/home/gowthan/Downloads/R-3.2.0/lib -lR
/usr/bin/ld: cannot find -lfbopenssl
collect2: ld returned 1 exit status
make: *** [RCurl.so] Error 1
ERROR: compilation failed for package \u2018RCurl\u2019
The line it fails is : /usr/bin/ld: cannot find -lfbopenssl. But, I have openssl at /usr/bin/openssl. How do I make 'ld' use it?
Regarding openssl-devel, yum install openssl-devel says that I already have the latest package. But "where openssl-devel" says that its not found! Is something wrong here?
Is fbopenssl same as openssl?

Resources