3

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?

jww
  • 97,681
  • 90
  • 411
  • 885
Ravi
  • 3,223
  • 7
  • 37
  • 49
  • 1
    The error is in plain sight: `make: command not found`. See my answer below. – Dirk Eddelbuettel Apr 01 '14 at 11:34
  • We are trying to install the dependencies one by one to see. So far we have installed Make and GCC 4.8.2. I have updated the question with the new error – Ravi Apr 02 '14 at 12:48
  • On Linux, `cc` is usually a symlink to the C compiler; and `CC` is a symlink to the C++ compiler. You may need to manually create the symlinks if the package or R is not creating them. For example, `ls -Al $(command -v cc)` results in `/bin/cc -> gcc` on Fedora. And it results in `/usr/bin/cc -> /etc/alternatives/cc`, which results in `/etc/alternatives/cc -> /usr/bin/gcc` on Ubuntu. – jww Dec 18 '19 at 03:12

2 Answers2

4

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
Rahul R Dhobi
  • 5,668
  • 1
  • 29
  • 38
  • Rahul...the system doesn't have access to internet...I will have to manually download the files and move it to the machine...Could you please be specific about what packages I need to install? – Ravi Apr 01 '14 at 11:31
  • If you have another linux machine then copy make command binary to your machine – Rahul R Dhobi Apr 01 '14 at 11:33
  • This pointed me in the right direction. I'm on arch and instead of `cc` in OP's make command, mine was `gfortran`. `sudo pacman -S gcc-fortran` – young_souvlaki Aug 18 '20 at 17:35
1

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.

Dirk Eddelbuettel
  • 360,940
  • 56
  • 644
  • 725
  • Dirk...this is not a stand alone R installation...it is the R distribution that comes with Vertica database...Vertica R doesn't work properly if other versions of R is installed...not sure if r-base-dev will help here – Ravi Apr 01 '14 at 11:40
  • a) Of course it will b) Complain to Vertica as you (or someone) paid them – Dirk Eddelbuettel Apr 01 '14 at 11:47
  • We are using the community edition of Vertica and hence, we really can't complain :( Is there a list of dependencies for R apart from Make and Compiler? – Ravi Apr 02 '14 at 12:55
  • Yes there is one. Now, as you wonder what it may be, you may want to re-read my answer and examine the `r-base-dev` package. – Dirk Eddelbuettel Apr 02 '14 at 13:40