Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

installation of package ‘devtools’ had non-zero exit status on Ubuntu

I'm trying to install devtools in a PowerPC with a R version 3.1.1 but failed at the end because the curl library:

...
** testing if installed package can be loaded Error in dyn.load(file, DLLpath = DLLpath, ...) :    unable to load shared object '/path
to/R/powerpc-unknown-linux-gnu-library/3.1/curl/libs/curl.so':   /path
to/R/powerpc-unknown-linux-gnu-library/3.1/curl/libs/curl.so:
undefined symbol: BSWAP_32 Error: loading failed Execution halted
ERROR: loading failed
 * removing ‘/path to/R/powerpc-unknown-linux-gnu-library/3.1/curl’ ERROR: dependency ‘curl’ is not available for package ‘httr’
 * removing ‘/path to/R/powerpc-unknown-linux-gnu-library/3.1/httr’ ERROR: dependency ‘curl’ is not available for package ‘rversions’
 * removing ‘/path to/R/powerpc-unknown-linux-gnu-library/3.1/rversions’ ERROR:
dependencies ‘httr’, ‘rversions’ are not available for package
‘devtools’
* removing ‘/path to/R/powerpc-unknown-linux-gnu-library/3.1/devtools’

The downloaded source packages are in
 ‘/tmp/RtmpD0yE63/downloaded_packages’ Warning messages: 1: In
install.packages("devtools") :   installation of package ‘curl’ had
non-zero exit status 2: In install.packages("devtools") :  
installation of package ‘httr’ had non-zero exit status 3: In
install.packages("devtools") :   installation of package ‘rversions’
had non-zero exit status 4: In install.packages("devtools") :  
installation of package ‘devtools’ had non-zero exit status

I've already installed libcurl4-gnutls-dev and libcurl4-openssl-dev and the libcurl version is 7.38.0.

Does anyone know a fix to this? Thanks ;)

like image 621
Aida Palacio Hoz Avatar asked Jun 29 '15 11:06

Aida Palacio Hoz


2 Answers

The same problem happened to me when I was trying to install "devtools" package on a new machine with Ubuntu 16.04 system.

I tried many answers including the adopted one above, but I still couldn't solve the problem until I noticed another warning information "(as ‘lib’ is unspecified)". Then I realized that I was running R as a normal user while the R base is installed by root. It means the package "devtools" couldn't be installed into the default R library folder and possibly couldn't use some dependent packages. Then the solution became very easy: run R as root user and then install "devtools".

Following the instructions of Dean Attali (https://www.digitalocean.com/community/tutorials/how-to-set-up-r-on-ubuntu-14-04), I summarize the steps below. Just run them in a terminal.

$ sudo apt-get -y install libcurl4-gnutls-dev libxml2-dev libssl-dev
$ sudo su  
$ R
> install.packages('devtools', repos='http://cran.rstudio.com/')

That's it. Since the package is installed by root, it can be used by all users of the system.

like image 161
Zheng Xiaochen Avatar answered Sep 19 '22 15:09

Zheng Xiaochen


For Curl use:

apt-get -y build-dep libcurl4-gnutls-dev
apt-get -y install libcurl4-gnutls-dev

And you should update the R version to R-3.1.2

wget http://cran.r-project.org/src/base/R-3/R-3.1.2.tar.gz
like image 24
Parisa Taherian Avatar answered Sep 17 '22 15:09

Parisa Taherian