Problems installing R package "devtools" on Ubuntu 16.04 (Xenial) - r

I installed RStudio and R on Ubuntu 16.04 (Xenial) Linux:
user#machine:~/.Rlibs$ R --version
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
My problem is that I am not able to install package "devtools". I get a series of errors and all my attempts to install required dependencies failed so far. It seems that packages cannot be found even though they are installed.
I would be really grateful for any help!
The errors occur when trying to install the "devtools" package in RStudio or using the R console:
install.packages("devtools")
These are the errors I am getting (leaving out the download output):
* installing *source* package ‘mime’ ...
** package ‘mime’ 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 rawmatch.c -o rawmatch.o
gcc: error: unrecognized command line option ‘-fstack-protector-strong’
gcc: error: unrecognized command line option ‘-Wdate-time’
/usr/lib/R/etc/Makeconf:132: recipe for target 'rawmatch.o' failed
make: *** [rawmatch.o] Error 1
ERROR: compilation failed for package ‘mime’
* removing ‘/home/user/.Rlibs/mime’
Warning in install.packages :
installation of package ‘mime’ had non-zero exit status
* installing *source* package ‘curl’ ...
** package ‘curl’ successfully unpacked and MD5 sums checked
Found pkg-config cflags and libs!
Using PKG_CFLAGS=
Using PKG_LIBS=-lcurl
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because libcurl was not found. Try installing:
* deb: libcurl4-openssl-dev (Debian, Ubuntu, etc)
* rpm: libcurl-devel (Fedora, CentOS, RHEL)
* csw: libcurl_dev (Solaris)
If libcurl is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a libcurl.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
--------------------------------------------------------------------
ERROR: configuration failed for package ‘curl’
* removing ‘/home/user/.Rlibs/curl’
Warning in install.packages :
installation of package ‘curl’ had non-zero exit status
* installing *source* package ‘openssl’ ...
** package ‘openssl’ successfully unpacked and MD5 sums checked
Found pkg-config cflags and libs!
Using PKG_CFLAGS=
Using PKG_LIBS=-lssl -lcrypto
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because openssl was not found. Try installing:
* deb: libssl-dev (Debian, Ubuntu, etc)
* rpm: openssl-devel (Fedora, CentOS, RHEL)
* csw: libssl_dev (Solaris)
* brew: openssl (Mac OSX)
If openssl is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a openssl.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
--------------------------------------------------------------------
ERROR: configuration failed for package ‘openssl’
* removing ‘/home/user/.Rlibs/openssl’
Warning in install.packages :
installation of package ‘openssl’ had non-zero exit status
* installing *source* package ‘digest’ ...
** package ‘digest’ 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 aes.c -o aes.o
gcc: error: unrecognized command line option ‘-fstack-protector-strong’
gcc: error: unrecognized command line option ‘-Wdate-time’
/usr/lib/R/etc/Makeconf:132: recipe for target 'aes.o' failed
make: *** [aes.o] Error 1
ERROR: compilation failed for package ‘digest’
* removing ‘/home/user/.Rlibs/digest’
Warning in install.packages :
installation of package ‘digest’ had non-zero exit status
* installing *source* package ‘jsonlite’ ...
** package ‘jsonlite’ successfully unpacked and MD5 sums checked
** libs
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -Iyajl/api -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c base64.c -o base64.o
gcc: error: unrecognized command line option ‘-fstack-protector-strong’
gcc: error: unrecognized command line option ‘-Wdate-time’
/usr/lib/R/etc/Makeconf:132: recipe for target 'base64.o' failed
make: *** [base64.o] Error 1
ERROR: compilation failed for package ‘jsonlite’
* removing ‘/home/user/.Rlibs/jsonlite’
Warning in install.packages :
installation of package ‘jsonlite’ had non-zero exit status
* installing *source* package ‘git2r’ ...
** package ‘git2r’ successfully unpacked and MD5 sums checked
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for library containing inflate... no
configure: error: in `/tmp/RtmpMyvGHt/R.INSTALL4c4a1e9555fc/git2r':
configure: error:
---------------------------------------------
The zlib library that is required to build
git2r was not found.
Please install:
zlib1g-dev (package on e.g. Debian and Ubuntu)
zlib-devel (package on e.g. Fedora, CentOS and RHEL)
and try again.
If the zlib library is installed on your
system but the git2r configuration is
unable to find it, you can specify the
include and lib path to zlib with:
R CMD INSTALL --configure-args='--with-zlib-include=INCLUDE_PATH --with-zlib-lib=LIB_PATH' git2r
---------------------------------------------
See `config.log' for more details
ERROR: configuration failed for package ‘git2r’
* removing ‘/home/user/.Rlibs/git2r’
Warning in install.packages :
installation of package ‘git2r’ had non-zero exit status
ERROR: dependencies ‘jsonlite’, ‘mime’, ‘curl’, ‘openssl’ are not available for package ‘httr’
* removing ‘/home/user/.Rlibs/httr’
Warning in install.packages :
installation of package ‘httr’ had non-zero exit status
ERROR: dependency ‘digest’ is not available for package ‘memoise’
* removing ‘/home/user/.Rlibs/memoise’
Warning in install.packages :
installation of package ‘memoise’ had non-zero exit status
ERROR: dependencies ‘httr’, ‘memoise’, ‘digest’, ‘jsonlite’, ‘git2r’ are not available for package ‘devtools’
* removing ‘/home/user/.Rlibs/devtools’
Warning in install.packages :
installation of package ‘devtools’ had non-zero exit status

I noticed the following error:
gcc: error: unrecognized command line option ‘-fstack-protector-strong’
gcc: error: unrecognized command line option ‘-Wdate-time’
I experienced the same issue when I wanted to use an outdated version of gcc (specifically, 4.8) to resolve some compatibility issues in one of my projects. The compiler flags "-Wdate-time" and "-fstack-protector-strong" are not available in older gcc releases. A similar flag "-fstack-protector-all" is available in some older gcc releases though.
To wrap up, this error messages is due to the fact that the developers expected an up-to-date gcc and used compiler flags for that up-to-date gcc version, but the gcc installed in your system was outdated.
Hope that helps other who might run into this issue in the future.

Related

R can't install packages, gcc and g++ fatal error

I haven't been able to install any packages (such as randomForest, devtools, etc.)
I have also updated my R to 4.2 recently (not sure if they are related). I am also running Ubuntu.
I suspect it was something to do with the C++ compiler, such as the g++ and GCC.
things that I have done:
I have edit the Makevars to include:
CC=/usr/bin/gcc
CXX=/usr/bin/g++
FC=/usr/bin/gfortran
F77=/usr/bin/gfortran
Is there anyone facing the same problem? or any hints and guidance are really appreciated. Thank you in advance. If you need more information, please kindly let me know.
One of the errors is (installing devtools):
* installing *source* package ‘sourcetools’ ...
** package ‘sourcetools’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
g++ -std=gnu++14 -I"/usr/share/R/include" -DNDEBUG -I../inst/include -fpic -g -O2 -fdebug-prefix-map=/build/r-base-asoVQd/r-base-4.2.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c Reader.cpp -o Reader.o
g++: fatal error: cannot execute ‘as’: execvp: No such file or directory
compilation terminated.
make: *** [/usr/lib/R/etc/Makeconf:177: Reader.o] Error 1
ERROR: compilation failed for package ‘sourcetools’
* removing ‘/home/cindy/R/x86_64-pc-linux-gnu-library/4.2/sourcetools’
Warning in install.packages :
installation of package ‘sourcetools’ had non-zero exit status
* installing *source* package ‘systemfonts’ ...
** package ‘systemfonts’ successfully unpacked and MD5 sums checked
** using staged installation
Package fontconfig was not found in the pkg-config search path.
Perhaps you should add the directory containing `fontconfig.pc'
to the PKG_CONFIG_PATH environment variable
No package 'fontconfig' found
Package freetype2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `freetype2.pc'
to the PKG_CONFIG_PATH environment variable
No package 'freetype2' found
Using PKG_CFLAGS=
Using PKG_LIBS=-lfontconfig -lfreetype
--------------------------- [ANTICONF] --------------------------------
Configuration failed to find the fontconfig freetype2 library. Try installing:
* deb: libfontconfig1-dev (Debian, Ubuntu, etc)
* rpm: fontconfig-devel (Fedora, EPEL)
* csw: fontconfig_dev (Solaris)
* brew: freetype (OSX)
If fontconfig freetype2 is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a fontconfig freetype2.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
-------------------------- [ERROR MESSAGE] ---------------------------
<stdin>:1:10: fatal error: fontconfig/fontconfig.h: No such file or directory
compilation terminated.
--------------------------------------------------------------------
ERROR: configuration failed for package ‘systemfonts’
* removing ‘/home/cindy/R/x86_64-pc-linux-gnu-library/4.2/systemfonts’
Warning in install.packages :
installation of package ‘systemfonts’ had non-zero exit status
* installing *source* package ‘gert’ ...
** package ‘gert’ successfully unpacked and MD5 sums checked
** using staged installation
> curl::curl_download("https://r-lib.github.io/gert/get-libgit2-linux.sh","get-libgit2-linux.sh")
>
>
Using static libgit2-1.1.0 for Linux x86_64
Using PKG_CFLAGS=-DSTATIC_LIBGIT2 -I/tmp/RtmpNHz5pp/R.INSTALL48c6b475a68c2/gert/libgit2/include
Using PKG_LIBS=-L/tmp/RtmpNHz5pp/R.INSTALL48c6b475a68c2/gert/libgit2/lib -lgit2 -lrt -lpthread -lssh2 -lssl -lcrypto -ldl -lpcre -lz
Configuration OK!
** libs
rm -f gert.so branch.o clone.o commit.o config.o conflicts.o files.o init.o merge.o rebase.o stash.o submodules.o tag.o utils.o version.o
gcc -I"/usr/share/R/include" -DNDEBUG -DSTATIC_LIBGIT2 -I/tmp/RtmpNHz5pp/R.INSTALL48c6b475a68c2/gert/libgit2/include -DR_NO_REMAP -DSTRICT_R_HEADERS -fvisibility=hidden -fpic -g -O2 -fdebug-prefix-map=/build/r-base-asoVQd/r-base-4.2.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c branch.c -o branch.o
gcc: fatal error: cannot execute ‘as’: execvp: No such file or directory
compilation terminated.
make: *** [/usr/lib/R/etc/Makeconf:168: branch.o] Error 1
ERROR: compilation failed for package ‘gert’
* removing ‘/home/cindy/R/x86_64-pc-linux-gnu-library/4.2/gert’
Warning in install.packages :
installation of package ‘gert’ had non-zero exit status
* installing *source* package ‘commonmark’ ...
** package ‘commonmark’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
rm -f cmark/cmark.o cmark/node.o cmark/iterator.o cmark/blocks.o cmark/inlines.o cmark/scanners.o cmark/utf8.o cmark/buffer.o cmark/references.o cmark/render.o cmark/man.o cmark/xml.o cmark/html.o cmark/commonmark.o cmark/latex.o cmark/houdini_href_e.o cmark/houdini_html_e.o cmark/houdini_html_u.o cmark/cmark_ctype.o cmark/arena.o cmark/html.o cmark/linked_list.o cmark/plugin.o cmark/registry.o cmark/syntax_extension.o cmark/plaintext.o cmark/footnotes.o cmark/map.o extensions/autolink.o extensions/core-extensions.o extensions/ext_scanners.o extensions/strikethrough.o extensions/table.o extensions/tagfilter.o extensions/tasklist.o extensions.o init.o wrapper.o commonmark.so cmark/libstatcmark.a
gcc -I"/usr/share/R/include" -DNDEBUG -Icmark -I. -DCMARK_GFM_STATIC_DEFINE -DCMARK_GFM_EXTENSIONS_STATIC_DEFINE -DR_NO_REMAP -DSTRICT_R_HEADERS -fvisibility=hidden -fpic -g -O2 -fdebug-prefix-map=/build/r-base-asoVQd/r-base-4.2.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c extensions.c -o extensions.o
gcc: fatal error: cannot execute ‘as’: execvp: No such file or directory
compilation terminated.
make: *** [/usr/lib/R/etc/Makeconf:168: extensions.o] Error 1
ERROR: compilation failed for package ‘commonmark’
* removing ‘/home/cindy/R/x86_64-pc-linux-gnu-library/4.2/commonmark’
Warning in install.packages :
installation of package ‘commonmark’ had non-zero exit status
* installing *source* package ‘profvis’ ...
** package ‘profvis’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -I"/usr/share/R/include" -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-asoVQd/r-base-4.2.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c pause.c -o pause.o
gcc: fatal error: cannot execute ‘as’: execvp: No such file or directory
compilation terminated.
make: *** [/usr/lib/R/etc/Makeconf:168: pause.o] Error 1
ERROR: compilation failed for package ‘profvis’
* removing ‘/home/cindy/R/x86_64-pc-linux-gnu-library/4.2/profvis’
Warning in install.packages :
installation of package ‘profvis’ had non-zero exit status
* installing *source* package ‘rlang’ ...
** package ‘rlang’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -I"/usr/share/R/include" -DNDEBUG -I./rlang/ -fvisibility=hidden -fpic -g -O2 -fdebug-prefix-map=/build/r-base-asoVQd/r-base-4.2.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c capture.c -o capture.o
gcc: fatal error: cannot execute ‘as’: execvp: No such file or directory
compilation terminated.
make: *** [/usr/lib/R/etc/Makeconf:168: capture.o] Error 1
ERROR: compilation failed for package ‘rlang’
* removing ‘/home/cindy/R/x86_64-pc-linux-gnu-library/4.2/rlang’
* restoring previous ‘/home/cindy/R/x86_64-pc-linux-gnu-library/4.2/rlang’
Warning in install.packages :
installation of package ‘rlang’ had non-zero exit status
* installing *source* package ‘later’ ...
** package ‘later’ successfully unpacked and MD5 sums checked
** using staged installation
Running configure script
-latomic linker flag needed.
** libs
g++ -std=gnu++11 -I"/usr/share/R/include" -DNDEBUG -pthread -DSTRICT_R_HEADERS -I'/home/cindy/R/x86_64-pc-linux-gnu-library/4.2/Rcpp/include' -fpic -g -O2 -fdebug-prefix-map=/build/r-base-asoVQd/r-base-4.2.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c RcppExports.cpp -o RcppExports.o
g++: fatal error: cannot execute ‘as’: execvp: No such file or directory
compilation terminated.
make: *** [/usr/lib/R/etc/Makeconf:177: RcppExports.o] Error 1
ERROR: compilation failed for package ‘later’
* removing ‘/home/cindy/R/x86_64-pc-linux-gnu-library/4.2/later’
Warning in install.packages :
installation of package ‘later’ had non-zero exit status
ERROR: dependency ‘systemfonts’ is not available for package ‘textshaping’
* removing ‘/home/cindy/R/x86_64-pc-linux-gnu-library/4.2/textshaping’
Warning in install.packages :
installation of package ‘textshaping’ had non-zero exit status
* installing *source* package ‘cachem’ ...
** package ‘cachem’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gcc -I"/usr/share/R/include" -DNDEBUG -fpic -g -O2 -fdebug-prefix-map=/build/r-base-asoVQd/r-base-4.2.1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -c cache.c -o cache.o
gcc: fatal error: cannot execute ‘as’: execvp: No such file or directory
compilation terminated.
make: *** [/usr/lib/R/etc/Makeconf:168: cache.o] Error 1
ERROR: compilation failed for package ‘cachem’
* removing ‘/home/cindy/R/x86_64-pc-linux-gnu-library/4.2/cachem’
Warning in install.packages :
installation of package ‘cachem’ had non-zero exit status
ERROR: dependency ‘gert’ is not available for package ‘usethis’
* removing ‘/home/cindy/R/x86_64-pc-linux-gnu-library/4.2/usethis’
Warning in install.packages :
installation of package ‘usethis’ had non-zero exit status
* installing *source* package ‘pkgload’ ...
** package ‘pkgload’ successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
namespace ‘rlang’ 1.0.2 is being loaded, but >= 1.0.3 is required
Calls: <Anonymous> ... withCallingHandlers -> loadNamespace -> namespaceImport -> loadNamespace
Execution halted
ERROR: lazy loading failed for package ‘pkgload’
* removing ‘/home/cindy/R/x86_64-pc-linux-gnu-library/4.2/pkgload’
* restoring previous ‘/home/cindy/R/x86_64-pc-linux-gnu-library/4.2/pkgload’
Warning in install.packages :
installation of package ‘pkgload’ had non-zero exit status
ERROR: dependency ‘later’ is not available for package ‘promises’
* removing ‘/home/cindy/R/x86_64-pc-linux-gnu-library/4.2/promises’
Warning in install.packages :
installation of package ‘promises’ had non-zero exit status
ERROR: dependencies ‘systemfonts’, ‘textshaping’ are not available for package ‘ragg’
* removing ‘/home/cindy/R/x86_64-pc-linux-gnu-library/4.2/ragg’
Warning in install.packages :
installation of package ‘ragg’ had non-zero exit status
ERROR: dependency ‘cachem’ is not available for package ‘memoise’
* removing ‘/home/cindy/R/x86_64-pc-linux-gnu-library/4.2/memoise’
Warning in install.packages :
installation of package ‘memoise’ had non-zero exit status
ERROR: dependency ‘commonmark’ is not available for package ‘roxygen2’
* removing ‘/home/cindy/R/x86_64-pc-linux-gnu-library/4.2/roxygen2’
Warning in install.packages :
installation of package ‘roxygen2’ had non-zero exit status
ERROR: dependencies ‘promises’, ‘later’ are not available for package ‘httpuv’
* removing ‘/home/cindy/R/x86_64-pc-linux-gnu-library/4.2/httpuv’
Warning in install.packages :
installation of package ‘httpuv’ had non-zero exit status
ERROR: dependency ‘memoise’ is not available for package ‘downlit’
* removing ‘/home/cindy/R/x86_64-pc-linux-gnu-library/4.2/downlit’
Warning in install.packages :
installation of package ‘downlit’ had non-zero exit status
ERROR: dependencies ‘httpuv’, ‘sourcetools’, ‘later’, ‘promises’, ‘commonmark’, ‘cachem’ are not available for package ‘shiny’
* removing ‘/home/cindy/R/x86_64-pc-linux-gnu-library/4.2/shiny’
Warning in install.packages :
installation of package ‘shiny’ had non-zero exit status
ERROR: dependencies ‘downlit’, ‘memoise’, ‘ragg’ are not available for package ‘pkgdown’
* removing ‘/home/cindy/R/x86_64-pc-linux-gnu-library/4.2/pkgdown’
Warning in install.packages :
installation of package ‘pkgdown’ had non-zero exit status
ERROR: dependency ‘shiny’ is not available for package ‘miniUI’
* removing ‘/home/cindy/R/x86_64-pc-linux-gnu-library/4.2/miniUI’
Warning in install.packages :
installation of package ‘miniUI’ had non-zero exit status
ERROR: dependencies ‘usethis’, ‘memoise’, ‘miniUI’, ‘pkgdown’, ‘profvis’, ‘roxygen2’ are not available for package ‘devtools’
* removing ‘/home/cindy/R/x86_64-pc-linux-gnu-library/4.2/devtools’
Warning in install.packages :
installation of package ‘devtools’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpITL0q0/downloaded_packages’

Unable to install a package called 'hemp' in R

I am new to learning R and i get the following error while installing the package called 'hemp'. Its a package which is used in psychometric analysis. Can anyone tell me what causes this errror?
Downloading GitHub repo cddesja/hemp#master
Installing 1 packages: nloptr
Installing package into ‘C:/Users/UJJWAL/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)
There is a binary version available but the
source version is later:
binary source needs_compilation
nloptr 1.2.2.1 1.2.2.2 TRUE
installing the source package ‘nloptr’
trying URL 'https://cran.rstudio.com/src/contrib/nloptr_1.2.2.2.tar.gz'
Content type 'application/x-gzip' length 2450931 bytes (2.3 MB)
downloaded 2.3 MB
* installing *source* package 'nloptr' ...
** package 'nloptr' successfully unpacked and MD5 sums checked
** using staged installation
**********************************************
WARNING: this package has a configure script
It probably needs manual configuration
**********************************************
** libs
*** arch - i386
/mingw32/bin/g++ -std=gnu++11 -I"C:/PROGRA~1/R/R-4.0.2/include" -DNDEBUG -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c dummy.cpp -o dummy.o
/mingw32/bin/gcc -I"C:/PROGRA~1/R/R-4.0.2/include" -DNDEBUG -I"/i386/include" -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c init_nloptr.c -o init_nloptr.o
init_nloptr.c:35:10: fatal error: nlopt.h: No such file or directory
#include "nlopt.h"
^~~~~~~~~
compilation terminated.
make: *** [C:/PROGRA~1/R/R-4.0.2/etc/i386/Makeconf:222: init_nloptr.o] Error 1
ERROR: compilation failed for package 'nloptr'
* removing 'C:/Users/UJJWAL/Documents/R/win-library/4.0/nloptr'
Error: Failed to install 'hemp' from GitHub:
(converted from warning) installation of package ‘nloptr’ had non-zero exit status
Seems that it wouldbe a little harder to install nloptr on Windows. It require nlopt to be installed first. See this for more info: https://www.r-project.org/nosvn/pandoc/nloptr.html

R Studio Version 1.2.5033 - problem installing packages Part 1

On a Opensuse machine, I tried installing the "alr3" package. It failed.
enter image description here
> install.packages("alr3")
Installing package into ‘/home/by79/R/x86_64-suse-linux-gnu-library/4.0’
(as ‘lib’ is unspecified)
also installing the dependencies ‘SparseM’, ‘curl’, ‘minqa’, ‘nloptr’, ‘statmod’, ‘RcppEigen’, ‘pbkrtest’, ‘quantreg’, ‘rio’, ‘lme4’, ‘car’
* installing *source* package ‘SparseM’ ...
** package ‘SparseM’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
gfortran -fno-optimize-sibling-calls -fpic -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables -fstack-clash-protection -c bckslv.f -o bckslv.o
make: gfortran: Command not found
make: *** [/usr/lib64/R/etc/Makeconf:190: bckslv.o] Error 127
ERROR: compilation failed for package ‘SparseM’
* removing ‘/home/by79/R/x86_64-suse-linux-gnu-library/4.0/SparseM’
Warning in install.packages :
installation of package ‘SparseM’ had non-zero exit status
* installing *source* package ‘curl’ ...
** package ‘curl’ successfully unpacked and MD5 sums checked
** using staged installation
Package libcurl was not found in the pkg-config search path.
Perhaps you should add the directory containing `libcurl.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libcurl' found
Package libcurl was not found in the pkg-config search path.
Perhaps you should add the directory containing `libcurl.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libcurl' found
Using PKG_CFLAGS=
Using PKG_LIBS=-lcurl
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because libcurl was not found. Try installing:
* deb: libcurl4-openssl-dev (Debian, Ubuntu, etc)
* rpm: libcurl-devel (Fedora, CentOS, RHEL)
* csw: libcurl_dev (Solaris)
If libcurl is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a libcurl.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
--------------------------------------------------------------------
ERROR: configuration failed for package ‘curl’
* removing ‘/home/by79/R/x86_64-suse-linux-gnu-library/4.0/curl’
The rest may be too long to post but is the above sufficient for some clues? Is it because of the compiler issue....how can I go about fixing it?
Please help.

gcc can't compile R packages under Linux Mint: can't find stdlib.h

I'm trying to install the R package gtools from the Linux Mint command line. After choosing the closest CRAN mirror, I'm getting the error message that no such file or directory was found and that installation of the package had a non-zero exit status. More specifically:
> install.packages('gtools')
Installing package into ‘/home/lizi/R/x86_64-pc-linux-gnu-library/3.4’
(as ‘lib’ is unspecified)
--- Please select a CRAN mirror for use in this session ---
trying URL 'https://cloud.r-
project.org/src/contrib/gtools_3.5.0.tar.gz'
Content type 'application/x-gzip' length 64855 bytes (63 KB)
==================================================
downloaded 63 KB
* installing *source* package ‘gtools’ ...
** package ‘gtools’ 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 roman2int.c -o roman2int.o
In file included from roman2int.c:1:0:
/usr/share/R/include/R.h:55:80: fatal error: stdlib.h: No such file or
directory
compilation terminated.
/usr/lib/R/etc/Makeconf:159: recipe for target 'roman2int.o' failed
make: *** [roman2int.o] Error 1
ERROR: compilation failed for package ‘gtools’
* removing ‘/home/lizi/R/x86_64-pc-linux-gnu-library/3.4/gtools’
The downloaded source packages are in
‘/tmp/Rtmp0z5PS6/downloaded_packages’
Warning message:
In install.packages("gtools") :
installation of package ‘gtools’ had non-zero exit status
The package has no dependencies, and I was under the impression that install.packages was straightforward. What am I doing wrong?

semPlot package dependency issues

I am trying to use the package semPlot with R version 3.2.3 on Linux Mint. Is the only solution to downgrade my R-version? I have installed package XML without errors. UPDATE BELOW
ran: install.packages("semPlot",dependencies=T) errors:
....
g++ -I/usr/share/R/include -DNDEBUG -I"/home/king/R/x86_64-pc-linux-gnu-library/3.2/Rcpp/include" -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c minqa.cpp -o minqa.o
/bin/bash: g++: command not found
make: *** [minqa.o] Error 127
ERROR: compilation failed for package ‘minqa’
* removing ‘/home/king/R/x86_64-pc-linux-gnu-library/3.2/minqa’
Warning in install.packages :
installation of package ‘minqa’ had non-zero exit status
* installing *source* package ‘nloptr’ ...
** package ‘nloptr’ successfully unpacked and MD5 sums checked
checking for g++... no
checking for c++... no
checking for gpp... no
checking for aCC... no
checking for CC... no
checking for cxx... no
checking for cc++... no
checking for cl.exe... no
checking for FCC... no
checking for KCC... no
checking for RCC... no
checking for xlC_r... no
checking for xlC... no
checking whether the C++ compiler works... no
configure: error: in `/tmp/Rtmpw7bRnY/R.INSTALL5fd12b68373/nloptr':
configure: error: C++ compiler cannot create executables
See `config.log' for more details
ERROR: configuration failed for package ‘nloptr’
* removing ‘/home/king/R/x86_64-pc-linux-gnu-library/3.2/nloptr’
Warning in install.packages :
installation of package ‘nloptr’ had non-zero exit status
* installing *source* package ‘RcppEigen’ ...
** package ‘RcppEigen’ successfully unpacked and MD5 sums checked
** libs
g++ -I/usr/share/R/include -DNDEBUG -I"/home/king/R/x86_64-pc-linux-gnu-library/3.2/Rcpp/include" -I../inst/include -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c RcppEigen.cpp -o RcppEigen.o
/bin/bash: g++: command not found
make: *** [RcppEigen.o] Error 127
ERROR: compilation failed for package ‘RcppEigen’
* removing ‘/home/king/R/x86_64-pc-linux-gnu-library/3.2/RcppEigen’
Warning in install.packages :
installation of package ‘RcppEigen’ had non-zero exit status
ERROR: dependencies ‘minqa’, ‘nloptr’, ‘RcppEigen’ are not available for package ‘lme4’
* removing ‘/home/king/R/x86_64-pc-linux-gnu-library/3.2/lme4’
Warning in install.packages :
installation of package ‘lme4’ had non-zero exit status
ERROR: dependency ‘lme4’ is not available for package ‘arm’
* removing ‘/home/king/R/x86_64-pc-linux-gnu-library/3.2/arm’
Warning in install.packages :
installation of package ‘arm’ had non-zero exit status
ERROR: dependency ‘lme4’ is not available for package ‘rockchalk’
* removing ‘/home/king/R/x86_64-pc-linux-gnu-library/3.2/rockchalk’
Warning in install.packages :
installation of package ‘rockchalk’ had non-zero exit status
ERROR: dependency ‘arm’ is not available for package ‘mi’
* removing ‘/home/king/R/x86_64-pc-linux-gnu-library/3.2/mi’
Warning in install.packages :
installation of package ‘mi’ had non-zero exit status
ERROR: dependency ‘mi’ is not available for package ‘sem’
* removing ‘/home/king/R/x86_64-pc-linux-gnu-library/3.2/sem’
Warning in install.packages :
installation of package ‘sem’ had non-zero exit status
ERROR: dependency ‘sem’ is not available for package ‘qgraph’
* removing ‘/home/king/R/x86_64-pc-linux-gnu-library/3.2/qgraph’
Warning in install.packages :
installation of package ‘qgraph’ had non-zero exit status
ERROR: dependencies ‘qgraph’, ‘sem’, ‘rockchalk’ are not available for package ‘semPlot’
* removing ‘/home/king/R/x86_64-pc-linux-gnu-library/3.2/semPlot’
Warning in install.packages :
installation of package ‘semPlot’ had non-zero exit status
The downloaded source packages are in
‘/tmp/RtmpW1PZ2x/downloaded_packages’
UPDATE
Based on the comments I discovered I had to install:
sudo apt-get install gcc
sudo apt-get install g++
sudo apt-get install build-essential
I am now getting:
/usr/bin/ld: cannot find -llapack
/usr/bin/ld: cannot find -lblas
collect2: error: ld returned 1 exit status
Thanks again to the comments I discovered I had to install:
sudo apt-get install liblapack-dev
which finally fixed my issues and I was able to install the package

Resources