Can't install R packages on Linux Mint 17 - linux

Running R 3.1.2 on Linux Mint 17, I get a non-zero exit status when I try to install popular packages. The full output of an example install.packages attempt is as follows:
> install.packages("plyr")
Installing package into ‘/home/joe_kendrick/R/x86_64-pc-linux-gnu-library/3.1’
(as ‘lib’ is unspecified)
trying URL 'http://cran.rstudio.com/src/contrib/plyr_1.8.1.tar.gz'
Content type 'application/x-gzip' length 393233 bytes (384 Kb)
opened URL
==================================================
downloaded 384 Kb
* installing *source* package ‘plyr’ ...
** package ‘plyr’ successfully unpacked and MD5 sums checked
** libs
g++ -I/usr/share/R/include -DNDEBUG -I"/usr/lib/R/site-library/Rcpp/include" -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c RcppExports.cpp -o RcppExports.o
/bin/bash: g++: command not found
make: *** [RcppExports.o] Error 127
ERROR: compilation failed for package ‘plyr’
* removing ‘/home/joe_kendrick/R/x86_64-pc-linux-gnu-library/3.1/plyr’
The downloaded source packages are in
‘/tmp/RtmpXe52Mz/downloaded_packages’
Warning message:
In install.packages("plyr") :
installation of package ‘plyr’ had non-zero exit status
I get essentially the same message for other packages I attempt to install, eg ggplot2 and vegan, though in many cases it is more verbose as it tries and fails to install dependencies.
This seems like a somewhat common issue, but others seem to have either outdated software or insufficient memory. I am running the latest stable release of both Mint and R, and I have plenty of RAM and a swap file, so I don't think either of these are causing my issue.

Per the error message
/bin/bash: g++: command not found
you need to install a C++ compiler. I would start with one of these:
sudo apt-get install build-essentials # key tools
or
sudo apt-get install r-base-dev # many development tools for R
or of course
sudo apt-get install r-cran-rcpp # to not install from source
though the Rcpp you get may be older than the one you need.
There is a list r-sig-debian for users of Debian-based systems.

In my case, I am running a fairly new installation of Mint 18, and I was missing certain packages. Per the error message in R, I attempted to install "readr", but that wouldn't install because I was missing an underlying package, "libcurl4-openssl-dev". I apt-got that, then readr install without error, and now my packages for RStudio load as expected.

You should test which repository here 1 works for your Linux Distro. Try add one by one to your '/etc/apt/sources.list' and run:
sudo apt update
sudo apt install r-base
On Linux Mint 18.3 it worked with:
deb https://cloud.r-project.org/bin/linux/ubuntu xenial-cran35/
or
deb https://cloud.r-project.org/bin/linux/ubuntu xenial-cran40/

Related

netinet/sctp.h: No such file or directory

I'm unable to include in any of my files. It always fails during compilation.
I got the lksctp-tools package installed.
I run
gcc -Wall -lsctp -o client admin.c deserializer.c input_parser.c main.c receive_response.c send_request.c serializer.c utils.c
And I get:
main.c:2:10: fatal error: netinet/sctp.h: No such file or directory
#include <netinet/sctp.h>
^~~~~~~~~~~~~~~~
compilation terminated.
I'm using Fedora, I don't know if that changes anything.
However the project seems to work fine on CLion.
On ubuntu need to install libsctp-dev.
sudo apt install libsctp-dev
ok turns out I had to do the following:
yum install lksctp-tools-dev
For Amazon Linux 2:
yum -y install lksctp-tools-devel

How to install Petite Chez Scheme on Ubuntu?

How to install Petite Chez Scheme on Ubuntu?
I run Ubuntu 15.10 and try to install pcsv8.4-a6le.tar.gz (non-threaded, 64 bit) for Linux.
After having unpacked this tar in /usr/locale, I enter the commands
sudo ./configure
sudo make install
from within the custom directory.
However, instead of a clean install, I get the following errors (which I hope someone can help me out with):
nlykkei#nlykkei-Studio-XPS-1640:/usr/local/csv8.4/custom$ sudo make install
if [ yes = no ]; then if [ ! -f ./scheme ]; then /bin/rm -f ./scheme; ln -s ../bin/a6le/scheme ./scheme; fi; fi
if [ ! -f ./petite ]; then /bin/rm -f ./petite; ln -s ./scheme ./petite; fi
/bin/rm -f ./scheme
echo "const char *S_date_stamp = \"`date +%m%d%Y%H%M%S`\";" > datestamp.c
gcc -m64 -rdynamic -o ./scheme datestamp.c ../boot/a6le/kernel.o ../boot/a6le/custom.o -lm -ldl -lncurses -lrt
/usr/bin/ld: cannot find -lncurses
collect2: error: ld returned 1 exit status
Mf-a6le:22: recipe for target 'scheme' failed
make[2]: *** [scheme] Error 1
Makefile:47: recipe for target 'buildpetite' failed
make[1]: *** [buildpetite] Error 2
Mf-install:64: recipe for target 'install' failed
make: *** [install] Error 2
On recent versions of Ubuntu (and future versions of Debian e.g. "Buster", and other Debian based distros), you can install Chez Scheme directly from the repo(s) by:
sudo apt install chezscheme
Previously you had to install it by compiling from source. Chez Scheme has been open source, for a few years now, and can be compiled from source, if it is not directly installable from the distribution's repo(s). Just download the source code compile and install. This will install not just the "petite" runtime version but also the full compiler. You can compile and install the software with:
./configure
sudo make install
Full build and install instructions are available here.
Pre-requisites for building are:
GNU Make
GCC
Header files and libraries for ncurses
Header files and libraries for X windows
On Ubuntu, install the libncurses5-dev package to get libncurses.so. (You can discover this by visiting http://packages.debian.org/file:libncurses.so (sadly, this doesn't seem to work for http://packages.ubuntu.com/file:libncurses.so).)
You may find other linkage errors if Chez requires other libraries to have development packages installed too. Use the same technique as above.
Go directly building from their Github.
ChezScheme
And then just do
./configure
sudo make install
Prerequisites according to Building are:
GNU Make
gcc
Header files and libraries for ncurses
Header files and libraries for X windows
And yes in case On Ubuntu, install the libncurses5-dev as Chris stated. Did just that and have no errors shown in clean install.
Chez Scheme has been open sourced since this question was asked. Since Bionic (18.04LTS) the full chezscheme is available as a repository.
First do
sudo apt update
then install the package:
sudo apt install chezscheme
This provides both the petite interpreter and the full scheme compiler.
There is also a PPA for trusty and xenial here:
https://launchpad.net/~jonathonf/+archive/ubuntu/lisp?field.series_filter=
Download the RPM package instead and use alien from terminal to produce a deb file:
fakeroot alien PetiteChezScheme-8.4-1.x86_64.rpm
You may need to install fakeroot, alien for this to work:
apt-get install fakeroot alien
Then you'll have a deb file. If you are on a desktop you can just double click the file and it will open Software Center and you can click install and it will fix your dependency problems.

How to install `build-essential` in `Cygwin`?

How to install build-essential in Cygwin?
I've tried using: apt-cyg install build-essential
But does not work.
Installing build-essential
Package build-essential not found or ambiguous name, exiting
I'm also having problems like:
(gedit: 13864): Gtk-WARNING **: can not open display:
So I can not install crunch.
See It:
$ make all
Building binary...
/usr/bin/gcc -pthread -Wall -pedantic -std=c99 undefined crunch.c -lm -o crunch
gcc: error: undefined: No such file or directory
Makefile:48: recipe for target 'crunch' failed
make: *** [crunch] Error 1
What's the problem here, and how can I fix it?
There isn't a build-essential package in Cygwin.
Build-essential is a collection of packages. So you'll have to select the packages manually, which I believe are the following:
make
automake
gcc
gcc-c++
Assuming you're doing development, you'll want to select those packages from the Devel branch. This is done when you first install Cygwin and the installer asks you to select the packages, after choosing the download site from the list.
As for the Gtk-WARNING **: can not open display: error, this is because your system is not running Cygwin's X11 display server, which provides a surface for graphical applications to render to. Check out http://x.cygwin.com/.
If you want to run gedit in Windows, you should get the binary for windows here. That's built for Windows and doesn't need Cygwin.
EDIT: Running sudo apt-get install build-essential on Elementary OS Freya mentions the following dependencies will be installed as well, so you'll probably want that for a 'closer-to-Linux' build environment as well.
The following extra packages will be installed:
g++
g++-4.8
libstdc++-4.8-dev
Suggested packages:
g++-multilib
g++-4.8-multilib
gcc-4.8-doc
libstdc++6-4.8-dbg
libstdc++-4.8-doc
The following NEW packages will be installed:
build-essential
g++
g++-4.8
libstdc++-4.8-dev
The list of files installed can be found here
and the contents of the file list (current as of 4/24/2014) can be found in this PasteBin I made.
build-essential is an abstract package, short for its dependencies:
dpkg-dev
binutils
bzip2
libdpkg-perl
make
patch
perl
tar
xz-utils
g++
gcc
libc6-dev
make
So in Cygwin, it is the same to install their substitutes:
apt-cyg install make gcc-core gcc-g++ patch bzip2 perl tar xz
make and gcc-g++ (g++), which depends on gcc-core (gcc), are the most important.
If you really want to compile various projects in Cygwin, packages below may be also helpful. Be careful, libboost-devel is very large.
apt-cyg install git automake cmake python3-devel libboost-devel

R package installation in Linux

I am trying to install a R package in Ubuntu using the following commands:
R CMD INSTALL rpart_4.1-5.tar.gz
install.packages("/home/rpart_4.1-5.tar.gz", repos = NULL, type="source")
* installing to library '/R/library'
* installing *source* package 'rpart' ...
** package 'rpart' successfully unpacked and MD5 sums checked
** libs
sh: make: command not found
ERROR: compilation failed for package 'rpart'
* removing '/R/library/rpart'
I have GCC 4.8.2 installed and the command gcc -v provides the following output:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/tools/stow/gcc-4_8_2-2.x86-64.linux.centos.5/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.8.2/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4.8.2/configure --prefix=/mnt/gcc/buildir/gcc-4.8.2
Thread model: posix
gcc version 4.8.2 (GCC)
Last time I face the same issue, installing GCC (same version) solved it (posted a similar query on Stackoverflow on this topic). However, this time it is not working. Could someone please let me know what is causing this issue.
UPDATE: We are trying to manually install the dependencies to see if it works. We have installed Make and GCC 4.8.2:
However, I still get the following error:
* installing to library '/opt/vertica/R/library'
* installing *source* package 'rpart' ...
** package 'rpart' successfully unpacked and MD5 sums checked
** libs
cc -std=gnu99 -I/opt/vertica/R/include -DNDEBUG -I/usr/local/include -fpic -c anova.c -o anova.o
make: cc: Command not found
make: *** [anova.o] Error 127
ERROR: compilation failed for package 'rpart'
* removing '/opt/vertica/R/library/rpart'
Are there any other dependencies that we need to install apart from Make and GCC?
Your system doesn't have make utility for compilation.
Please execute following command to install make in your system.
sudo apt-get install build-essential
If you just do
sudo apt-get install r-base-dev
you all the key dependencies relevant for R package building which is what you want here. This includes the compiler, make etc as part of built-essential as well as specific libraries needed by R. There is a reason we created this package :)
If your machine does not have permanent internet access, look for previously-asked questions about "apt-get without internet access" etc.

"/usr/bin/ld: cannot find -lz"

I am trying to compile Android source code under Ubuntu 10.04. I get an error saying,
/usr/bin/ld: cannot find -lz
Can you please tell me how can I fix it? What does cannot find -lz mean? Here's the full error message:
external/qemu/Makefile.android:1101: warning: overriding commands for target `external/qemu/android/avd/hw-config-defs.h'
external/qemu/Makefile.android:933: warning: ignoring old commands for target `external/qemu/android/avd/hw-config-defs.h'
host SharedLib: libneo_cgi (out/host/linux-x86/obj/lib/libneo_cgi.so)
/usr/bin/ld: skipping incompatible /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../libz.so when searching for -lz
/usr/bin/ld: skipping incompatible /usr/lib/gcc/i486-linux-gnu/4.4.3/../../../libz.a when searching for -lz
/usr/bin/ld: skipping incompatible /usr/lib/libz.so when searching for -lz
/usr/bin/ld: skipping incompatible /usr/lib/libz.a when searching for -lz
/usr/bin/ld: cannot find -lz
collect2: ld returned 1 exit status
make: *** [out/host/linux-x86/obj/lib/libneo_cgi.so] Error 1
And my GCC version output:
scheung#scheung-virtual-box:/media/EXTDIV/mydroid$ gcc --version
gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
I already have the zlib1g-dev library installed:
$ sudo apt-get install zlib1g-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
zlib1g-dev is already the newest version.
(I get that from this link.)
I had the exact same error, and like you, installing zlib1g-dev did not fix it. Installing lib32z1-dev got me past it. I have a 64 bit system and it seems like it wanted the 32 bit library.
For x64 install zlib1g-dev.
sudo apt-get install zlib1g-dev
I don't need all the x86 libs ;)
sudo apt-get install libz-dev in ubuntu.
I just encountered this problem and contrary to the accepted solution of "your make files are broken" and "host includes should never be included in a cross compile"
The android build includes many host executables used by the SDK to build an android app.
In my case the make stopped while building zipalign, which is used to optimize an apk before installing on an android device.
Installing lib32z1-dev solved my problem, under Ubuntu you can install it with the following command:
sudo apt-get install lib32z1-dev
I had the exact same error, Installing zlib-devel solved my problem,
Type the command and install zlib package.
On linux:
sudo apt-get install zlib*
On Centos:
sudo yum install zlib*
Another possible cause: You've passed --static to the linker, but you only have a dynamic version of libz (libz.so), but not a version that can be statically linked (libz.a).
Try one of those three solution. It must work :) :
sudo apt-get install zlib1g-dev
sudo apt-get install libz-dev
sudo apt-get install lib32z1-dev
In fact what is missing is not the lz command, but the development files for the zlib library.So you should install zlib1g-devlib for ex to get it.
For rhel7 like systems the package is zlib-devel
It means you asked it to include the library 'libz.a' or 'libz.so' containing a compression package, and although the compiler found some files, none of them was suitable for the build you are using.
You either need to change your build parameters or you need to get the correct library installed or you need to specify where the correct library is on the link command line with a -L/where/it/is/lib type option.
This will show you clues about why the linker doesn't want the installed library:
LD_DEBUG=all make ...
I had the same problem in a different context: my system /lib/libz.so.1 had unsatisfied dependencies on libc because I was trying to relink on a different version of the OS.
for opensuse 12.3 (Dartmouth) (i586)
sudo zypper install zlib-devel zlib-devel-static
Others have mentioned that lib32z-dev solves the problem, but in general the required packages can be found here:
http://source.android.com/source/initializing.html
See "Installing required packages"

Resources