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.
Related
I am quite new to R on Linux, and I was trying to install the package DMRcate via the BiocManager command. I kept receiving the error message that
/usr/bin/ld: cannot find -llapack: No such file or directory
/usr/bin/ld: cannot find -lblas: No such file or directory
It seems like the installation or compilation of certain dependency packages could not be carried out because of these errors.
In addition, the last line of the compilation before this error message pops up is as follows.
g++ -std=gnu++11 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o edgeR.so R_add_prior_count.o R_ave_log_cpm.o R_calculate_cpm.o R_check_poisson_bound.o R_compute_apl.o R_compute_nbdev.o R_exact_test_by_deviance.o R_fit_levenberg.o R_fit_one_group.o R_get_one_way_fitted.o R_initialize_levenberg.o R_loess_by_col.o R_maximize_interpolant.o R_process_hairpin_reads.o R_simple_good_turing.o add_prior.o adj_coxreid.o fmm_spline.o glm_levenberg.o glm_one_group.o init.o interpolator.o nbdev.o objects.o -llapack -lblas -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR
Can anyone help me with this issue? Many thanks in advance!
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.
I try to install the psych package on macOS with Revolution R Open 3.2.2. I used install.packages("psych") and all the dependencies are going to be downloaded.
The first dependency was successfully unzipped.
The following happens afterwards:
gfortran -arch x86_64 -fPIC -g -O2 -c biv-nt.f -o biv-nt.o
gfortran -arch x86_64 -fPIC -g -O2 -c sadmvnt.f -o sadmvnt.o
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/Users/Shared/Jenkins/workspace/External-R-3.3.2/vendor/build/lib -o mnormt.so biv-nt.o sadmvnt.o -L/usr/local/lib/gcc/i686-apple-darwin8/4.2.3/x86_64 -L/usr/local/lib/x86_64 -L/usr/local/lib/gcc/i686-apple-darwin8/4.2.3 -L/usr/local/lib -lgfortran -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: directory not found for option '-L/Users/Shared/Jenkins/workspace/External-R-3.3.2/vendor/build/lib'
ld: warning: directory not found for option '-L/usr/local/lib/gcc/i686-apple-darwin8/4.2.3/x86_64'
ld: warning: directory not found for option '-L/usr/local/lib/x86_64'
ld: warning: directory not found for option '-L/usr/local/lib/gcc/i686-apple-darwin8/4.2.3'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [mnormt.so] Error 1
ERROR: compilation failed for package ‘mnormt’
* removing ‘/Users/sebastian/Library/R/3.3/library/mnormt’
Warning in install.packages :
installation of package ‘mnormt’ had non-zero exit status
ERROR: dependency ‘mnormt’ is not available for package ‘psych’
* removing ‘/Users/sebastian/Library/R/3.3/library/psych’
Warning in install.packages :
installation of package ‘psych’ had non-zero exit status
The downloaded source packages are in
/private/var/folders/8d/tdsm42091lz926w1q2lx77c40000gn/T/RtmpHxWPQe/downloaded_packages
My system:
R version 3.3.2 (2016-10-31)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Sierra 10.12.1
This also happens for other packages, but not for all. I installed ggplot2, dplyr or tidyr and everything just worked fine.
I had the same issue with many other R packages when I switched to MRO on MacOS. It could be two things:
You are missing gfortran, like #hrbrmstr mentioned in the comments.
Or, you have gfortran, but the link library path was not specified by the compiler, as you can see in the error messages before it bummed out at the gfortran line.
The solution to 2, which worked for me, is to edit ~/.R/Makevars to add your GCC/GFortran libraries. For GCC5:
LDFLAGS=-L/usr/local/lib/gcc/5
Installing gfortran alone did not help in my case. Make sure that XCode is installed and uptodate. This helped me.
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
When I bring up a basic image of Debian Lenny on EC2 (actually EMR on EC2) I get Lenny version 5.0.7 and I am able to upgrade R using the method outlined in a previous question. After upgrading R I have version 2.12.
I've been unable to then install the Hmisc package. I see that it has a Debian package so I've tried:
sudo apt-get update
sudo apt-get install r-cran-hmisc
Which seems to work, but when I go into R I get the following:
> require(Hmisc)
Loading required package: Hmisc
Failed with error: ‘package 'Hmisc' was built before R 2.10.0: please re-install it’
so I presume the Hmisc in the Debian repo is an old version. So I'll just upgrade. So I go into R and:
install.packages("Hmisc")
which fails with:
...
gcc -I/usr/share/R/include -fpic -std=gnu99 -O3 -pipe -g -c string_box.c -o string_box.o
gfortran -fpic -O3 -pipe -g -c wclosest.f -o wclosest.o
gcc -shared -o Hmisc.so Hmisc.o cidxcn.o cidxcp.o hoeffd.o jacklins.o largrec.o mChoice.o nstr.o ranksort.o rcorr.o string_box.o wclosest.o -lgfortran -lm -L/usr/lib64/R/lib -lR
/usr/bin/ld: cannot find -lgfortran
collect2: ld returned 1 exit status
make: *** [Hmisc.so] Error 1
ERROR: compilation failed for package ‘Hmisc’
* removing ‘/home/hadoop/R/x86_64-pc-linux-gnu-library/2.12/Hmisc’
The downloaded packages are in
‘/tmp/Rtmp2Ej5Tn/downloaded_packages’
Warning message:
In install.packages("Hmisc") :
installation of package 'Hmisc' had non-zero exit status
>
It appears like ld is struggling with lgfortran. I checked and gfortran is installed. So I tried installing gfortran-4.1:
sudo apt-get install gfortran-4.1
That didn't change anything. Nor did installing 4.2.
Any tips on what to try next?
What happens when you install the r-base-dev package? Does it build then? It should.
I stumbled upon this previous question right after I posted here. It appears I need to manually link to the gfortran libraries:
sudo ln -s /usr/lib/libgfortran.so.3 /usr/lib/libgfortran.so
After updating the cluster package I am able to install.packages("Hmisc")