Install R package error - compilation failed in Ubuntu 18.04 - r

I try to install R packages by using devtools (for specific version) but got some errors.
I have to install packages that's specific version and use specific R version (4.1.*) plz.
R, devtools version
R version : 4.1.3
devtools: 2.4.4
Install packages
forecast : 8.13
kernlab : 0.9-29
Install commands
install_version("forecast", version = "8.13")
install_version("kernlab", version = "0.9-29")
or add option dependencies=TRUE
Error list
cc -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcpp/include' -I
'/usr/local/lib/R/site-library/RcppArmadillo/include' -fpic -g -O2 -fdebug-prefix-ma
p=/build/r-base-NlA7dw/r-base-4.1.3=. -fstack-protector-strong -Wformat -Werror=format-s
ecurity -Wdate-time -D_FORTIFY_SOURCE=2 -g -c registerDynamicSymbol.c -o registerDynami
cSymbol.o
g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcp
p/include' -I'/usr/local/lib/R/site-library/RcppArmadillo/include' -fpic -g -O2 -fde
bug-prefix-map=/build/r-base-NlA7dw/r-base-4.1.3=. -fstack-protector-strong -Wformat -We
rror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c updateMatrices.cpp -o update
Matrices.o
g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -I'/usr/local/lib/R/site-library/Rcp
p/include' -I'/usr/local/lib/R/site-library/RcppArmadillo/include' -fpic -g -O2 -fde
bug-prefix-map=/build/r-base-NlA7dw/r-base-4.1.3=. -fstack-protector-strong -Wformat -We
rror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c updateTBATSMatrices.cpp -o u
pdateTBATSMatrices.o
g++ -std=gnu++14 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o forec
ast.so calcBATS.o calcTBATS.o etsTargetFunction.o etsTargetFunctionWrapper.o etscalc.o e
tspolyroot.o makeBATSMatrices.o makeTBATSMatrices.o registerDynamicSymbol.o updateMatric
es.o updateTBATSMatrices.o -llapack -lblas -lgfortran -lm -lquadmath -L/usr/lib/R/lib -l
R
/usr/bin/ld: cannot find -llapack
/usr/bin/ld: cannot find -lblas
collect2: error: ld returned 1 exit status
/usr/share/R/share/make/shlib.mk:10: recipe for target 'forecast.so' failed
make: *** [forecast.so] Error 1
ERROR: compilation failed for package ‘forecast’
* removing ‘/usr/local/lib/R/site-library/forecast’
경고메시지(들):
i.p(...)에서:
installation of package ‘/tmp/RtmpGgApec/remotes25555374bfb7/forecast’ had non-zero ex
it status
Commands I've tried
sudo apt-get install g++
sudo apt install gfortran
sudo apt install libcurl4-gnutls-dev
R version upgrade 4.1.0 -> 4.1.3
R version downgrade 4.1.3 -> 4.1.0
install.packages('forecast')
install.packages('kernlab')

Short answer: We supply a package with the most common dependencies so consider doing sudo apt-get install r-base-dev. After that you can compile.
Longer answer: Ubuntu contains a number of pre-built CRAN packages. Consider doing sudo apt install r-cran-kernlab r-cran-forecast. For an older Ubuntu release this may reflect older versions.
Best answer (if you are on Ubuntu 20.04 or 22.04): Consider r2u which has all (!!) of the CRAN packages as r-cran-binaries, and uses bspm so that you can just say install.packages(c("kernlab", "forecast")) and still get everything pre-made as binaries, with dependencies, and managed via apt. But we do not support 18.04 for that.

In general when libraries are missing, "cannot find -lXXX", you should apt-cache search libXXX + -dev, and apt-get install what you find.
So in this case:
sudo apt-get install libblas-dev
sudo apt-get install liblapack-dev
A related answer.

Related

Installation of mclust package v5.4.6 on R v4.0.1 on Ubuntu v20.04 hangs

Upon executing 'Rscript -e "install.packages('mclust')"` with R 4.0.1 on Ubuntu 20.04, the process hangs during package preparation. Any idea how to fix or debug this issue?
ENV: R v4.0.1, GCC v9, Ubuntu v20.04
CMD: Rscript -e "install.packages('mclust')"
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/mclust_5.4.6.tar.gz'
Content type 'application/x-gzip' length 2877519 bytes (2.7 MB)
==================================================
downloaded 2.7 MB
* installing *source* package ‘mclust’ ...
** package ‘mclust’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gfortran -fno-optimize-sibling-calls -fpic -g -O2 -fdebug-prefix-map=/build/r-base-dEscXG/r-base-4.0.1=. -fstack-protector-strong -c dmvnorm.f -o dmvnorm.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-dEscXG/r-base-4.0.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c init.c -o init.o
gfortran -fno-optimize-sibling-calls -fpic -g -O2 -fdebug-prefix-map=/build/r-base-dEscXG/r-base-4.0.1=. -fstack-protector-strong -c mclust.f -o mclust.o
gfortran -fno-optimize-sibling-calls -fpic -g -O2 -fdebug-prefix-map=/build/r-base-dEscXG/r-base-4.0.1=. -fstack-protector-strong -c mclustaddson.f -o mclustaddson.o
gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o mclust.so dmvnorm.o init.o mclust.o mclustaddson.o -llapack -lblas -lgfortran -lm -lquadmath -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR
installing to /usr/local/lib/R/site-library/00LOCK-mclust/00new/mclust/libs
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
Based on the response on R-sig-debian for a similar issue, I figured this issue is due to a bug in the pthread-based versions of Blas and Lapack libraries.
Until the bug is fixed, the workaround is to use libopenblas-openmp-blas and libopenblas-openmp-lapack libraries.
There are two ways to achieve use these libraries.
Uninstall the pthread-based version of the libraries and install the openmp-based version of the libraries.
Switch to openmp-based version of the libraries via update-alternatives. This can be done via sudo update-alternatives --config <name> command with being liblapack.so.3-x86_64-linux-gnu and libblas.so.3-x86_64-linux-gnu.

R - cannot find -llapack & cannot find -lblas

I can't install openair for some reasons:
sudo su - -c "R -e \"devtools::install_github('davidcarslaw/openair')\""
Result:
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
* installing *source* package ‘openair’ ...
** using staged installation
** libs
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I"/usr/local/lib/R/site-library/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/build/r-base-V0XiTa/r-base-3.6.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c cluster.cpp -o cluster.o
gcc -std=gnu99 -I"/usr/share/R/include" -DNDEBUG -I"/usr/local/lib/R/site-library/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/build/r-base-V0XiTa/r-base-3.6.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c init.c -o init.o
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -I"/usr/local/lib/R/site-library/Rcpp/include" -fpic -g -O2 -fdebug-prefix-map=/build/r-base-V0XiTa/r-base-3.6.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c rolling.cpp -o rolling.o
g++ -std=gnu++11 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o openair.so cluster.o init.o rolling.o -llapack -lblas -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR
/usr/bin/ld: cannot find -llapack
/usr/bin/ld: cannot find -lblas
collect2: error: ld returned 1 exit status
make: *** [/usr/share/R/share/make/shlib.mk:6: openair.so] Error 1
ERROR: compilation failed for package ‘openair’
* removing ‘/usr/local/lib/R/site-library/openair’
Error: Failed to install 'openair' from GitHub:
(converted from warning) installation of package ‘/tmp/Rtmp36VYYZ/file18ef44881cd2/openair_2.6-5.tar.gz’ had non-zero exit status
Execution halted
What am I missing?
I am on Ubuntu 19.04.
Many R packages need underlying DLLs (shared objects) that are specific for compiling against, and they often have a -dev suffix on the package name. On my 16.04 Ubuntu system, I see:
$ apt list --installed | egrep 'lapack|blas'
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
libblas-common/xenial,now 3.6.0-2ubuntu2 amd64 [installed,automatic]
libblas-dev/xenial,now 3.6.0-2ubuntu2 amd64 [installed,automatic]
libblas3/xenial,now 3.6.0-2ubuntu2 amd64 [installed,automatic]
liblapack-dev/xenial,now 3.6.0-2ubuntu2 amd64 [installed,automatic]
liblapack3/xenial,now 3.6.0-2ubuntu2 amd64 [installed,automatic]
(I also often cheat and look at:
$ ll /var/lib/dpkg/info/*lapack*.list
-rw-r--r-- 1 root root 318 Apr 27 2017 /var/lib/dpkg/info/liblapack3.list
-rw-r--r-- 1 root root 288 Apr 27 2017 /var/lib/dpkg/info/liblapack-dev.list
and while not fast or as flexible a way of looking, it quickly lets me look at the file-listings (these files) or the pre/post-install scripts, if present. Just a hack.)
If you don't have the two -dev packages, you can installed either or both with:
apt-get install libblas-dev liblapack-dev
#r2evans gave the correct answer in the general case.
For R on Debian and Ubuntu, there is short cut worth knowing about: And that short cut is, and has been for close to 20 years, that you want the r-base-dev package installed as it will bring in a number of build requirements.
Such as these lapack and blas -dev libraries.
edd#rob:~$ apt-cache show r-base-dev
Package: r-base-dev
Architecture: all
Version: 3.6.1-3disco
Priority: optional
Section: gnu-r
Source: r-base
Maintainer: Dirk Eddelbuettel <edd#debian.org>
Installed-Size: 15
Depends: r-base-core (>= 3.6.1-3disco), build-essential, gcc, g++, gfortran, libblas-dev | libatlas-base-dev, liblapack-dev | libatlas-base-dev, libncurses5-dev, libreadline-dev, libjpeg-dev, libpcre2-dev, libpc
re3-dev, libpng-dev, zlib1g-dev, libbz2-dev, liblzma-dev, libicu-dev, xauth, pkg-config
Suggests: texlive-base, texlive-latex-base, texlive-plain-generic, texlive-fonts-recommended, texlive-fonts-extra, texlive-extra-utils, texlive-latex-recommended, texlive-latex-extra, texinfo
Filename: disco-cran35/r-base-dev_3.6.1-3disco_all.deb
Size: 4488
MD5sum: 9eb92e1184dc4b959cc493ba3fdb4c22
SHA1: e7804d6bbd90eb8ed4e2d42340abbc45fd7192a3
SHA256: 18509fb6a684d011fe983384b92ba7b2b72717de7e6169007c43a4a875fcbc03
SHA512: 4ea302cddad643ede8ec9719f496b5e74569c39325b86ecebd39d9610e668ed6e0d8619e07341c91a196708f2172a9f594fb6a317e2eb386c928d5e9ed4111f5
Homepage: http://www.r-project.org/
Description-en: GNU R installation of auxiliary GNU R packages
R is a system for statistical computation and graphics. It consists
of a language plus a run-time environment with graphics, a debugger,
access to certain system functions, and the ability to run programs
stored in script files.
.
The design of R has been heavily influenced by two existing languages:
Becker, Chambers & Wilks' S and Sussman's Scheme. Whereas the
resulting language is very similar in appearance to S, the underlying
implementation and semantics are derived from Scheme.
.
.
The core of R is an interpreted computer language which allows
branching and looping as well as modular programming using functions.
Most of the user-visible functions in R are written in R. It is
possible for the user to interface to procedures written in the
C, C++, or FORTRAN languages for efficiency, and many of R's core
functions do so. The R distribution contains functionality for a
large number of statistical procedures and underlying applied math
computations. There is also a large set of functions which provide
a flexible graphical environment for creating various kinds of data
presentations.
.
Additionally, several thousand extension "packages" are available from
CRAN, the Comprehensive R Archive Network, many also as Debian packages,
named 'r-cran-<name>'.
.
This package ensures that other Debian packages needed for installation of
some auxiliary R packages are installed.
Description-md5: 1a1267651faee382ef4781870ce94812
edd#rob:~$

How to solve dependence issues and error installing qpcR package?

I cannot install qpcR package, using this command in R:
install.packages("qpcR")
Apparently, everything looks fine initially:
Installing package into ‘/home/emanuel/R/x86_64-pc-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
trying URL 'https://cloud.r-project.org/src/contrib/qpcR_1.4-1.tar.gz'
Content type 'application/x-gzip' length 4303726 bytes (4.1 MB)
==================================================
downloaded 4.1 MB
* installing *source* package ‘qpcR’ ...
** package ‘qpcR’ successfully unpacked and MD5 sums checked
** libs
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack- protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c registerDynamicSymbol.c -o registerDynamicSymbol.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c smth.c -o smth.o
g++ -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o qpcR.so registerDynamicSymbol.o smth.o -llapack -lblas -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR
And then things starts to going wrong:
usr/bin/ld: cannot find -llapack
/usr/bin/ld: cannot find -lblas
collect2: error: ld returned 1 exit status
/usr/share/R/share/make/shlib.mk:6: recipe for target 'qpcR.so' failed
make: *** [qpcR.so] Error 1
ERROR: compilation failed for package ‘qpcR’
* removing ‘/home/emanuel/R/x86_64-pc-linux-gnu-library/3.4/qpcR’
Warning in install.packages :
installation of package ‘qpcR’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpOPiQkB/downloaded_packages’
Additional (maybe) relevant info:
Before the lines presented above, I was having trouble with another qpcR dependence, the rgl package, and I solved trying all the suggestions from another question: "Error in installing rgl package".
I made a brief search about: "-llpack", "-lblas", "qpcR.so" .Unfortunately nothing seems (to me at least) to be related to my specific problem.
I using Mint with these specifications: Linux version 4.8.0-53-generic (buildd#lgw01-56) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4) ) #56~16.04.1-Ubuntu
R version 3.4.4
R studio Version 1.1.453
Thanks in advance for any help!
satisfy the dependencies using this command in terminal.
sudo apt-get install libblas-dev liblapack-dev
hope this helps (Y)

Can't find gfortran 4.8 to build package

I'm trying to install the deldir package in R via install.packages("deldir",type = 'source') but am getting the following error message (this is OSX Mavericks):
* installing *source* package ‘deldir’ ...
** package ‘deldir’ successfully unpacked and MD5 sums checked
** libs
gfortran-4.8 -fPIC -g -O2 -c acchk.f -o acchk.o
make: gfortran-4.8: No such file or directory
make: *** [acchk.o] Error 1
ERROR: compilation failed for package ‘deldir’
gfortran 4.8 does seem to be available on my system, however:
> gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/local/gfortran/libexec/gcc/x86_64-apple-darwin13/4.8.2/lto-wrapper
Target: x86_64-apple-darwin13
Configured with: ../gcc-4.8.2/configure --prefix=/usr/local/gfortran --with-gmp=/Users/fx/devel/gcc/deps-static/x86_64 --enable-languages=c,c++,fortran,objc,obj-c++ --build=x86_64-apple-darwin13
Thread model: posix
gcc version 4.8.2 (GCC)
After symlinking gfortran-4.8 to gfortran I get a bit further but fail nonetheless:
* installing *source* package ‘deldir’ ...
** package ‘deldir’ successfully unpacked and MD5 sums checked
** libs
gfortran-4.8 -fPIC -g -O2 -c acchk.f -o acchk.o
gfortran-4.8 -fPIC -g -O2 -c addpt.f -o addpt.o
gfortran-4.8 -fPIC -g -O2 -c adjchk.f -o adjchk.o
gfortran-4.8 -fPIC -g -O2 -c binsrt.f -o binsrt.o
gfortran-4.8 -fPIC -g -O2 -c circen.f -o circen.o
gfortran-4.8 -fPIC -g -O2 -c cross.f -o cross.o
gfortran-4.8 -fPIC -g -O2 -c delet.f -o delet.o
gfortran-4.8 -fPIC -g -O2 -c delet1.f -o delet1.o
gfortran-4.8 -fPIC -g -O2 -c delout.f -o delout.o
gfortran-4.8 -fPIC -g -O2 -c delseg.f -o delseg.o
gfortran-4.8 -fPIC -g -O2 -c dirout.f -o dirout.o
gfortran-4.8 -fPIC -g -O2 -c dirseg.f -o dirseg.o
gfortran-4.8 -fPIC -g -O2 -c dldins.f -o dldins.o
gfortran-4.8 -fPIC -g -O2 -c initad.f -o initad.o
gfortran-4.8 -fPIC -g -O2 -c insrt.f -o insrt.o
gfortran-4.8 -fPIC -g -O2 -c insrt1.f -o insrt1.o
gfortran-4.8 -fPIC -g -O2 -c intri.f -o intri.o
gfortran-4.8 -fPIC -g -O2 -c locn.f -o locn.o
gfortran-4.8 -fPIC -g -O2 -c master.f -o master.o
gfortran-4.8 -fPIC -g -O2 -c mnnd.f -o mnnd.o
gfortran-4.8 -fPIC -g -O2 -c pred.f -o pred.o
gfortran-4.8 -fPIC -g -O2 -c qtest.f -o qtest.o
gfortran-4.8 -fPIC -g -O2 -c qtest1.f -o qtest1.o
gfortran-4.8 -fPIC -g -O2 -c stoke.f -o stoke.o
gfortran-4.8 -fPIC -g -O2 -c succ.f -o succ.o
gfortran-4.8 -fPIC -g -O2 -c swap.f -o swap.o
gfortran-4.8 -fPIC -g -O2 -c testeq.f -o testeq.o
gfortran-4.8 -fPIC -g -O2 -c triar.f -o triar.o
gfortran-4.8 -fPIC -g -O2 -c trifnd.f -o trifnd.o
clang -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/usr/local/lib -o deldir.so acchk.o addpt.o adjchk.o binsrt.o circen.o cross.o delet.o delet1.o delout .o delseg.o dirout.o dirseg.o dldins.o initad.o insrt.o insrt1.o intri.o locn.o master.o mnnd.o pred.o qtest.o qtest1.o stoke.o succ.o swap.o testeq.o triar.o trifnd.o -L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2 - lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: directory not found for option '-L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [deldir.so] Error 1
ERROR: compilation failed for package ‘deldir’
Note that /usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.3 exists, /usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2 does not
sessionInfo():
> sessionInfo()
R version 3.1.1 (2014-07-10)
Platform: x86_64-apple-darwin13.1.0 (64-bit)
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
Sys.getenv():
> Sys.getenv()
__CF_USER_TEXT_ENCODING
"0x1F5:0:0"
__CHECKFIX1436934
"1"
Apple_PubSub_Socket_Render
"/tmp/launch-jCxLku/Render"
DISPLAY
":0"
DYLD_FALLBACK_LIBRARY_PATH
"/Users/<myusername>/lib:/usr/local/lib:/usr/lib::/Library/Frameworks/R.framework/Resources/lib"
EDITOR
"vi"
GIT_ASKPASS
"rpostback-askpass"
HOME
"/Users/<myusername>"
LANG
"en_US.UTF-8"
LC_CTYPE
"en_US.UTF-8"
LN_S
"ln -s"
LOGNAME
"<myusername>"
MAKE
"make"
PAGER
"/usr/bin/less"
PATH
"/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/texbin"
R_BROWSER
"/usr/bin/open"
R_BZIPCMD
"/usr/bin/bzip2"
R_DOC_DIR
"/Library/Frameworks/R.framework/Resources/doc"
R_GZIPCMD
"/usr/bin/gzip"
R_HOME
"/Library/Frameworks/R.framework/Resources"
R_INCLUDE_DIR
"/Library/Frameworks/R.framework/Resources/include"
R_LIBS_SITE
""
R_LIBS_USER
"~/Library/R/3.1/library"
R_PAPERSIZE
"a4"
R_PDFVIEWER
"/usr/bin/open"
R_PLATFORM
"x86_64-apple-darwin13.1.0"
R_PRINTCMD
"lpr"
R_QPDF
"/Library/Frameworks/R.framework/Resources/bin/qpdf"
R_RD4PDF
"times,inconsolata,hyper"
R_SESSION_TMPDIR
"/var/folders/jf/ds4sdyys44xckz_7f9zhrvsh0000gn/T//RtmpXaPpYF"
R_SHARE_DIR
"/Library/Frameworks/R.framework/Resources/share"
R_SYSTEM_ABI
"osx,gcc,gxx,gfortran,?"
R_TEXI2DVICMD
"/usr/bin/texi2dvi"
R_UNZIPCMD
"/usr/bin/unzip"
R_ZIPCMD
"/usr/bin/zip"
RS_RPOSTBACK_PATH
"/Applications/RStudio.app/Contents/MacOS/rpostback"
RS_SHARED_SECRET
<removed>
RSTUDIO
"1"
RSTUDIO_PANDOC
"/Applications/RStudio.app/Contents/MacOS/pandoc"
RSTUDIO_SESSION_PORT
"10153"
RSTUDIO_USER_IDENTITY
"<myusername>"
SED
"/usr/bin/sed"
SHELL
"/bin/bash"
SSH_AUTH_SOCK
"/tmp/launch-Shnu2H/Listeners"
TAR
"/usr/bin/tar"
TMPDIR
"/var/folders/jf/ds4sdyys44xckz_7f9zhrvsh0000gn/T/"
USER
"<myusername>"
I was getting the same error when installing the igraph package in R on Manjaro Linux.
It was due to the absence of a Fortran compiler (gfortran I think). I found out that gfortran package is named as gcc-fortran in Manjaro repo and many other (GNU) Linux repos. So, I just installed gcc-fortran package and then restarted RStudio and igraph package installed without any issues.
I found a solution here: https://support.rstudio.com/hc/communities/public/questions/201688563-Problem-with-Mac-Yosemite-Beta-and-RStudio-not-finding-TeX-distribution
It turns out that Adam Maxwell noted that Yosemite beta has a significant bug in passing environment variables to subprocesses.
After installing gfortran as in OS X package installation depends on gfortran-4.8 .
This works: create an alias in your .bash_profile
alias fixrs="launchctl setenv PATH /usr/texbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin"
Then close and open the terminal.
And execute the fixrs command in the terminal before launching RStudio.
Then I could build igraph successfully.
I was using a linux machine and RStudio server. I had a similar problem. I knew already that gfortran was on the machine thanks to the system administrator.
To solve, in the shell, I typed which gfortran, which gave me a path.
Then, following this SO posting, I entered the following in the shell to create a new Makevars file
# create a file called ~/.R/Makevars:
mkdir -p ~/.R
touch ~/.R/Makevars
Then, in that new file, I wrote the following
F77 = /usr/local/bin/gfortran #this was the path that I got from typing which gfortran in the shell
FC = $F77
FLIBS = -L/usr/local/bin/gfortran
From there, I was able to install the package that wasn't compiling properly (in my case vegan instead of igraph using install.packages("vegan")
I had your same problem (in OS X Yosemite), and (unfortunately) painstakingly recreated your symlink "partial solution". Finally, I was able to solve the issue by forgetting about linking or aliasing and just downgrading to gfortran-4.8.
I had installed the newer version with brew, so for me this entailed uninstalling
brew uninstall gcc
and then following the instructions here to install 4.8.2, i.e.
curl -O http://r.research.att.com/libs/gfortran-4.8.2-darwin13.tar.bz2
sudo tar fvxz gfortran-4.8.2-darwin13.tar.bz2 -C /
It still threw up some warnings but at least I got a successful installation of deldir, which I needed to run pgirmess.

Installing knncat

I am using R in Ubuntu 10.04.
I need to understand the documentation.
Installing knncat I get this error message:
gcc -I/usr/share/R/include -I . -DUSE_R_ALLOC -DCALL_FROM_R -fpic
-std=gnu99 -O3 -pipe -g -c ranlib.c -o ranlib.o gcc -I/usr/share/R/include -I . -DUSE_R_ALLOC -DCALL_FROM_R -fpic -std=gnu99 -O3 -pipe -g -c utilsR.c -o utilsR.o gcc -shared -o knncat.so com.o dodisc.o donn.o donnwrap.o dsort.o linpack.o matrix.o
objective.o ords.o ranlib.o utilsR.o -llapack -lblas -lgfortran -lm
-L/usr/lib/R/lib -lR /usr/bin/ld: cannot find -llapack collect2: ld returned 1 exit status make: *** [knncat.so] Error 1 ERROR:
compilation failed for package ‘knncat’
In the documentation I find this recomendation:
Provision is made for using an external LAPACK library, principally to
cope with BLAS libraries which contain a copy of LAPACK (such as sunperf
on Solaris, vecLib on OS X and ACML on ‘ix86’/‘x86_64’ Linux)
If it is mandatory (?), I should use this code:
--with-lapack="-L/path/to/libs -llapack -lcblas"
But where? I am using the standard installation of packages in R.
install.packages('knncat')
I am not sure of:
Is it mandatory to install lapack? I do have BLAS + LAPACK.
How to install a package without using install.packages()?
which are the choices I have now?
Please install the r-base-dev package, which will take care of the -dev packages for LAPACK and BLAS as well.
It was an old version of R. Even when I did upgrade, it does not fixed.
I followed this orders: from http://ubuntuforums.org/showthread.php?t=377323
sudo aptitude install r-base r-recommended
In R
install.packages('knncat')
Now it is working!

Resources