Error in installing package: fatal error: stdlib.h: no such file or directory

14,248

R packages are downloaded as source code that needs to be compiled. R calls the appropriate compiler, provided that you have it on your system!

You appear to be missing stdlib.h as well as stdio.h
These are standard C headers, that are found in the libc package.

In Linux Mint it should be libc6-dev

So try: sudo apt-get install libc6-dev

You may also need other packages to be installed:

The R Installation manual is a good read:

You need a means of compiling C and FORTRAN 90 (see Using FORTRAN). Your C compiler should be ISO/IEC 60059, POSIX 1003.1 and C99-compliant. R tries to choose suitable flags for the C compilers it knows about, but you may have to set CC or CFLAGS suitably. For recent versions of gcc with glibc this means including -std=gnu99. If the compiler is detected as gcc, -std=gnu99 will be appended to CC unless it conflicts with a setting of CFLAGS. (Note that options essential to run the compiler even for linking, such as those to set the architecture, should be specified as part of CC rather than in CFLAGS.)

Unless you do not want to view graphs on-screen (or use a Mac) you need ‘X11’ installed, including its headers and client libraries. For recent Fedora distributions it means (at least) RPMs ‘libX11’, ‘libX11-devel’, ‘libXt’ and ‘libXt-devel’. On Debian we recommend the meta-package ‘xorg-dev’. If you really do not want these you will need to explicitly configure R without X11, using --with-x=no.

The command-line editing (and command completion) depends on the GNU readline library: version 4.2 or later is needed for all the features to be enabled. Otherwise you will need to configure with --with-readline=no (or equivalent).

A suitably comprehensive iconv function is essential. The R usage requires iconv to be able to translate between "latin1" and "UTF-8", to recognize "" (as the current encoding) and "ASCII", and to translate to and from the Unicode wide-character formats "UCS-[24][BL]E" — this is true for glibc but not of most commercial Unixes. However, you can make use of GNU libiconv (possibly as a plug-in replacement: see http://www.gnu.org/software/libiconv/).

The OS needs to have enough support for wide-character types: this is checked at configuration. A small number of POSIX functions are essential, and others will be used if available.

A tar program is needed to unpack the sources and packages (including the recommended packages). A version that can automagically detect compressed archives is preferred for use with untar(): the configure script looks for gtar and gnutar before tar: use environment variable TAR to override this.

There need to be suitable versions of the tools grep and sed: the problems are usually with old AT&T and BSD variants. configure will try to find suitable versions (including looking in /usr/xpg4/bin which is used on some commercial Unixes).

You will not be able to build most of the manuals unless you have makeinfo version 4.7 or later installed, and if not some of the HTML manuals will be linked to CRAN. To make PDF versions of the manuals you will also need file texinfo.tex installed (which is part of the GNU texinfo distribution but is often made part of the TeX package in re-distributions) as well as texi2dvi. Further, the versions of texi2dvi and texinfo.tex need to be compatible: we have seen problems with older TeX distributions (TeXLive 2007 and MiKTeX 2.8) used with texinfo 4.13. It is possible to use texinfo version 5.x, preferably 5.2 or later.

The PDF documentation (including doc/NEWS.pdf) and building vignettes needs pdftex and pdflatex. We require LaTeX version 2005/12/01 or later (for UTF-8 support). Building PDF package manuals (including the R reference manual) and vignettes is sensitive to the version of the LaTeX package hyperref and we recommend that the TeX distribution used is kept up-to-date. A number of standard LaTeX packages are required (including fancyvrb, url and some of the font packages such as times, helvetic, ec and cm-super) and others such as hyperref and inconsolata are desirable (and without them you may need to change R’s defaults: see Making the manuals). Note that package hyperref (currently) requires packages kvoptions, ltxcmds and refcount. For distributions based on TeXLive the simplest approach may be to install collections collection-latex, collection-fontsrecommended, collection-latexrecommended, collection-fontsextra and collection-latexextra (assuming they are not installed by default): Fedora uses names like texlive-collection-fontsextra and Debian/Ubuntu like texlive-fonts-extra.

If you want to build from the R Subversion repository you need both makeinfo and pdflatex.

The essential programs should be in your PATH at the time configure is run: this will capture the full paths.

In summary, you need a proper compiling environment.

Share:
14,248
user3182532
Author by

user3182532

Updated on July 25, 2022

Comments

  • user3182532
    user3182532 almost 2 years

    I have just set up my linux mint system and now I want to install an R package. I did:

    sudo apt-get install r-base
    
    sudo R
    

    In R I entered (just like indicated on the bioconductor homepage):

    source("http://bioconductor.org/biocLite.R")
    
    biocLite("GEOquery")
    

    This is the result:

    > source("http://bioconductor.org/biocLite.R")
    Installing package into ‘/home/robert/R/x86_64-pc-linux-gnu-library/3.0’
    (as ‘lib’ is unspecified)
    trying URL 'http://www.bioconductor.org/packages/2.13/bioc/src/contrib/BiocInstaller_1.12.1.tar.gz'
    Content type 'application/x-gzip' length 13520 bytes (13 Kb)
    opened URL
    ==================================================
    downloaded 13 Kb
    
    * installing *source* package ‘BiocInstaller’ ...
    ** R
    ** inst
    ** preparing package for lazy loading
    ** help
    *** installing help indices
    ** building package indices
    ** testing if installed package can be loaded
    Bioconductor version 2.13 (BiocInstaller 1.12.1), ?biocLite for help
    A newer version of Bioconductor is available after installing a new version of
      R, ?BiocUpgrade for help
    * DONE (BiocInstaller)
    
    The downloaded source packages are in
        ‘/tmp/RtmpDSnlDj/downloaded_packages’
    Bioconductor version 2.13 (BiocInstaller 1.12.1), ?biocLite for help
    A newer version of Bioconductor is available after installing a new version of
      R, ?BiocUpgrade for help
    > biocLite("GEOquery")
    BioC_mirror: http://bioconductor.org
    Using Bioconductor version 2.13 (BiocInstaller 1.12.1), R version 3.0.2.
    Installing package(s) 'GEOquery'
    also installing the dependencies ‘BiocGenerics’, ‘bitops’, ‘Biobase’, ‘XML’, ‘RCurl’
    
    trying URL 'http://bioconductor.org/packages/2.13/bioc/src/contrib/BiocGenerics_0.8.0.tar.gz'
    Content type 'application/x-gzip' length 30969 bytes (30 Kb)
    opened URL
    ==================================================
    downloaded 30 Kb
    
    trying URL 'http://cran.fhcrc.org/src/contrib/bitops_1.0-6.tar.gz'
    Content type 'application/x-gzip' length 8734 bytes
    opened URL
    ==================================================
    downloaded 8734 bytes
    
    trying URL 'http://bioconductor.org/packages/2.13/bioc/src/contrib/Biobase_2.22.0.tar.gz'
    Content type 'application/x-gzip' length 1848944 bytes (1.8 Mb)
    opened URL
    ==================================================
    downloaded 1.8 Mb
    
    trying URL 'http://cran.fhcrc.org/src/contrib/XML_3.98-1.1.tar.gz'
    Content type 'application/x-gzip' length 1582216 bytes (1.5 Mb)
    opened URL
    ==================================================
    downloaded 1.5 Mb
    
    trying URL 'http://cran.fhcrc.org/src/contrib/RCurl_1.95-4.3.tar.gz'
    Content type 'application/x-gzip' length 879143 bytes (858 Kb)
    opened URL
    ==================================================
    downloaded 858 Kb
    
    trying URL 'http://bioconductor.org/packages/2.13/bioc/src/contrib/GEOquery_2.28.0.tar.gz'
    Content type 'application/x-gzip' length 13630252 bytes (13.0 Mb)
    opened URL
    ==================================================
    downloaded 13.0 Mb
    
    * installing *source* package ‘BiocGenerics’ ...
    ** R
    ** inst
    ** preparing package for lazy loading
    Creating a new generic function for ‘append’ in package ‘BiocGenerics’
    Creating a new generic function for ‘as.data.frame’ in package ‘BiocGenerics’
    Creating a new generic function for ‘as.vector’ in package ‘BiocGenerics’
    Creating a new generic function for ‘cbind’ in package ‘BiocGenerics’
    Creating a new generic function for ‘rbind’ in package ‘BiocGenerics’
    Creating a new generic function for ‘duplicated’ in package ‘BiocGenerics’
    Creating a new generic function for ‘anyDuplicated’ in package ‘BiocGenerics’
    Creating a new generic function for ‘eval’ in package ‘BiocGenerics’
    Creating a new generic function for ‘pmax’ in package ‘BiocGenerics’
    Creating a new generic function for ‘pmin’ in package ‘BiocGenerics’
    Creating a new generic function for ‘pmax.int’ in package ‘BiocGenerics’
    Creating a new generic function for ‘pmin.int’ in package ‘BiocGenerics’
    Creating a new generic function for ‘Reduce’ in package ‘BiocGenerics’
    Creating a new generic function for ‘Filter’ in package ‘BiocGenerics’
    Creating a new generic function for ‘Find’ in package ‘BiocGenerics’
    Creating a new generic function for ‘Map’ in package ‘BiocGenerics’
    Creating a new generic function for ‘Position’ in package ‘BiocGenerics’
    Creating a new generic function for ‘get’ in package ‘BiocGenerics’
    Creating a new generic function for ‘mget’ in package ‘BiocGenerics’
    Creating a new generic function for ‘is.unsorted’ in package ‘BiocGenerics’
    Creating a new generic function for ‘lapply’ in package ‘BiocGenerics’
    Creating a new generic function for ‘sapply’ in package ‘BiocGenerics’
    Creating a new generic function for ‘mapply’ in package ‘BiocGenerics’
    Creating a new generic function for ‘match’ in package ‘BiocGenerics’
    Creating a new generic function for ‘order’ in package ‘BiocGenerics’
    Creating a new generic function for ‘paste’ in package ‘BiocGenerics’
    Creating a new generic function for ‘rank’ in package ‘BiocGenerics’
    Creating a new generic function for ‘rep.int’ in package ‘BiocGenerics’
    Creating a new generic function for ‘rownames’ in package ‘BiocGenerics’
    Creating a new generic function for ‘colnames’ in package ‘BiocGenerics’
    Creating a new generic function for ‘union’ in package ‘BiocGenerics’
    Creating a new generic function for ‘intersect’ in package ‘BiocGenerics’
    Creating a new generic function for ‘setdiff’ in package ‘BiocGenerics’
    Creating a new generic function for ‘sort’ in package ‘BiocGenerics’
    Creating a new generic function for ‘table’ in package ‘BiocGenerics’
    Creating a new generic function for ‘tapply’ in package ‘BiocGenerics’
    Creating a new generic function for ‘unique’ in package ‘BiocGenerics’
    Creating a new generic function for ‘unlist’ in package ‘BiocGenerics’
    Creating a new generic function for ‘xtabs’ in package ‘BiocGenerics’
    Creating a new generic function for ‘clusterCall’ in package ‘BiocGenerics’
    Creating a new generic function for ‘clusterApply’ in package ‘BiocGenerics’
    Creating a new generic function for ‘clusterApplyLB’ in package ‘BiocGenerics’
    Creating a new generic function for ‘clusterEvalQ’ in package ‘BiocGenerics’
    Warning in getPackageName(environment(fdef)) :
      Created a package name, ‘2014-08-07 15:23:56’, when none found
    Creating a new generic function for ‘clusterExport’ in package ‘BiocGenerics’
    Creating a new generic function for ‘clusterMap’ in package ‘BiocGenerics’
    Creating a new generic function for ‘parLapply’ in package ‘BiocGenerics’
    Creating a new generic function for ‘parSapply’ in package ‘BiocGenerics’
    Creating a new generic function for ‘parApply’ in package ‘BiocGenerics’
    Creating a new generic function for ‘parRapply’ in package ‘BiocGenerics’
    Creating a new generic function for ‘parCapply’ in package ‘BiocGenerics’
    Creating a new generic function for ‘parLapplyLB’ in package ‘BiocGenerics’
    Creating a new generic function for ‘parSapplyLB’ in package ‘BiocGenerics’
    ** help
    *** installing help indices
    ** building package indices
    ** testing if installed package can be loaded
    * DONE (BiocGenerics)
    * installing *source* package ‘bitops’ ...
    ** package ‘bitops’ successfully unpacked and MD5 sums checked
    ** libs
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -O3 -pipe  -g  -c bit-ops.c -o bit-ops.o
    In file included from bit-ops.c:1:0:
    /usr/share/R/include/R.h:28:20: fatal error: stdlib.h: No such file or directory
     #include <stdlib.h>
                        ^
    compilation terminated.
    make: *** [bit-ops.o] Error 1
    ERROR: compilation failed for package ‘bitops’
    * removing ‘/home/robert/R/x86_64-pc-linux-gnu-library/3.0/bitops’
    * installing *source* package ‘XML’ ...
    ** package ‘XML’ successfully unpacked and MD5 sums checked
    checking for gcc... gcc
    checking for C compiler default output file name... rm: cannot remove 'a.out.dSYM': Is a directory
    
    configure: error: C compiler cannot create executables
    See `config.log' for more details.
    ERROR: configuration failed for package ‘XML’
    * removing ‘/home/robert/R/x86_64-pc-linux-gnu-library/3.0/XML’
    * installing *source* package ‘Biobase’ ...
    ** libs
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -O3 -pipe  -g  -c Rinit.c -o Rinit.o
    In file included from Rinit.c:1:0:
    /usr/share/R/include/Rinternals.h:32:20: fatal error: stdio.h: No such file or directory
     # include <stdio.h>
                        ^
    compilation terminated.
    make: *** [Rinit.o] Error 1
    ERROR: compilation failed for package ‘Biobase’
    * removing ‘/home/robert/R/x86_64-pc-linux-gnu-library/3.0/Biobase’
    ERROR: dependency ‘bitops’ is not available for package ‘RCurl’
    * removing ‘/home/robert/R/x86_64-pc-linux-gnu-library/3.0/RCurl’
    ERROR: dependencies ‘Biobase’, ‘XML’, ‘RCurl’ are not available for package ‘GEOquery’
    * removing ‘/home/robert/R/x86_64-pc-linux-gnu-library/3.0/GEOquery’
    
    The downloaded source packages are in
        ‘/tmp/RtmpDSnlDj/downloaded_packages’
    Old packages: 'boot', 'class', 'cluster', 'foreign', 'KernSmooth', 'lattice',
      'MASS', 'Matrix', 'mgcv', 'nlme', 'nnet', 'rpart', 'spatial'
    Update all/some/none? [a/s/n]: a
    trying URL 'http://cran.fhcrc.org/src/contrib/boot_1.3-11.tar.gz'
    Content type 'application/x-gzip' length 230713 bytes (225 Kb)
    opened URL
    ==================================================
    downloaded 225 Kb
    
    trying URL 'http://cran.fhcrc.org/src/contrib/class_7.3-11.tar.gz'
    Content type 'application/x-gzip' length 19592 bytes (19 Kb)
    opened URL
    ==================================================
    downloaded 19 Kb
    
    trying URL 'http://cran.fhcrc.org/src/contrib/cluster_1.15.2.tar.gz'
    Content type 'application/x-gzip' length 271734 bytes (265 Kb)
    opened URL
    ==================================================
    downloaded 265 Kb
    
    trying URL 'http://cran.fhcrc.org/src/contrib/foreign_0.8-61.tar.gz'
    Content type 'application/x-gzip' length 333301 bytes (325 Kb)
    opened URL
    ==================================================
    downloaded 325 Kb
    
    trying URL 'http://cran.fhcrc.org/src/contrib/KernSmooth_2.23-12.tar.gz'
    Content type 'application/x-gzip' length 33518 bytes (32 Kb)
    opened URL
    ==================================================
    downloaded 32 Kb
    
    trying URL 'http://cran.fhcrc.org/src/contrib/lattice_0.20-29.tar.gz'
    Content type 'application/x-gzip' length 347091 bytes (338 Kb)
    opened URL
    ==================================================
    downloaded 338 Kb
    
    trying URL 'http://cran.fhcrc.org/src/contrib/MASS_7.3-33.tar.gz'
    Content type 'application/x-gzip' length 486785 bytes (475 Kb)
    opened URL
    ==================================================
    downloaded 475 Kb
    
    trying URL 'http://cran.fhcrc.org/src/contrib/Matrix_1.1-4.tar.gz'
    Content type 'application/x-gzip' length 1670503 bytes (1.6 Mb)
    opened URL
    ==================================================
    downloaded 1.6 Mb
    
    trying URL 'http://cran.fhcrc.org/src/contrib/mgcv_1.8-2.tar.gz'
    Content type 'application/x-gzip' length 663555 bytes (648 Kb)
    opened URL
    ==================================================
    downloaded 648 Kb
    
    trying URL 'http://cran.fhcrc.org/src/contrib/nlme_3.1-117.tar.gz'
    Content type 'application/x-gzip' length 759268 bytes (741 Kb)
    opened URL
    ==================================================
    downloaded 741 Kb
    
    trying URL 'http://cran.fhcrc.org/src/contrib/nnet_7.3-8.tar.gz'
    Content type 'application/x-gzip' length 28424 bytes (27 Kb)
    opened URL
    ==================================================
    downloaded 27 Kb
    
    trying URL 'http://cran.fhcrc.org/src/contrib/rpart_4.1-8.tar.gz'
    Content type 'application/x-gzip' length 818733 bytes (799 Kb)
    opened URL
    ==================================================
    downloaded 799 Kb
    
    trying URL 'http://cran.fhcrc.org/src/contrib/spatial_7.3-8.tar.gz'
    Content type 'application/x-gzip' length 43593 bytes (42 Kb)
    opened URL
    ==================================================
    downloaded 42 Kb
    
    * installing *source* package ‘boot’ ...
    ** package ‘boot’ successfully unpacked and MD5 sums checked
    ** R
    ** data
    *** moving datasets to lazyload DB
    ** inst
    ** byte-compile and prepare package for lazy loading
    ** help
    *** installing help indices
    ** building package indices
    ** testing if installed package can be loaded
    * DONE (boot)
    * installing *source* package ‘cluster’ ...
    ** package ‘cluster’ successfully unpacked and MD5 sums checked
    ** libs
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -O3 -pipe  -g  -c clara.c -o clara.o
    clara.c:12:18: fatal error: math.h: No such file or directory
     #include <math.h>
                      ^
    compilation terminated.
    make: *** [clara.o] Error 1
    ERROR: compilation failed for package ‘cluster’
    * removing ‘/usr/lib/R/library/cluster’
    * restoring previous ‘/usr/lib/R/library/cluster’
    * installing *source* package ‘foreign’ ...
    ** package ‘foreign’ successfully unpacked and MD5 sums checked
    ** libs
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -O3 -pipe  -g  -c R_systat.c -o R_systat.o
    R_systat.c:20:19: fatal error: stdio.h: No such file or directory
     #include <stdio.h>
                       ^
    compilation terminated.
    make: *** [R_systat.o] Error 1
    ERROR: compilation failed for package ‘foreign’
    * removing ‘/usr/lib/R/library/foreign’
    * restoring previous ‘/usr/lib/R/library/foreign’
    * installing *source* package ‘KernSmooth’ ...
    ** package ‘KernSmooth’ successfully unpacked and MD5 sums checked
    ** libs
    gfortran   -fpic  -O3 -pipe  -g  -c blkest.f -o blkest.o
    /bin/bash: gfortran: command not found
    make: *** [blkest.o] Error 127
    ERROR: compilation failed for package ‘KernSmooth’
    * removing ‘/usr/lib/R/library/KernSmooth’
    * restoring previous ‘/usr/lib/R/library/KernSmooth’
    * installing *source* package ‘lattice’ ...
    ** package ‘lattice’ successfully unpacked and MD5 sums checked
    ** libs
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -O3 -pipe  -g  -c init.c -o init.o
    In file included from init.c:2:0:
    /usr/share/R/include/R.h:28:20: fatal error: stdlib.h: No such file or directory
     #include <stdlib.h>
                        ^
    compilation terminated.
    make: *** [init.o] Error 1
    ERROR: compilation failed for package ‘lattice’
    * removing ‘/usr/lib/R/library/lattice’
    * restoring previous ‘/usr/lib/R/library/lattice’
    * installing *source* package ‘MASS’ ...
    ** package ‘MASS’ successfully unpacked and MD5 sums checked
    ** libs
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -O3 -pipe  -g  -c MASS.c -o MASS.o
    In file included from MASS.c:18:0:
    /usr/share/R/include/R.h:28:20: fatal error: stdlib.h: No such file or directory
     #include <stdlib.h>
                        ^
    compilation terminated.
    make: *** [MASS.o] Error 1
    ERROR: compilation failed for package ‘MASS’
    * removing ‘/usr/lib/R/library/MASS’
    * restoring previous ‘/usr/lib/R/library/MASS’
    * installing *source* package ‘nnet’ ...
    ** package ‘nnet’ successfully unpacked and MD5 sums checked
    ** libs
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -O3 -pipe  -g  -c nnet.c -o nnet.o
    In file included from nnet.c:25:0:
    /usr/share/R/include/R.h:28:20: fatal error: stdlib.h: No such file or directory
     #include <stdlib.h>
                        ^
    compilation terminated.
    make: *** [nnet.o] Error 1
    ERROR: compilation failed for package ‘nnet’
    * removing ‘/usr/lib/R/library/nnet’
    * restoring previous ‘/usr/lib/R/library/nnet’
    * installing *source* package ‘rpart’ ...
    ** package ‘rpart’ successfully unpacked and MD5 sums checked
    ** libs
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -O3 -pipe  -g  -c anova.c -o anova.o
    In file included from rpart.h:6:0,
                     from anova.c:4:
    /usr/share/R/include/R.h:28:20: fatal error: stdlib.h: No such file or directory
     #include <stdlib.h>
                        ^
    compilation terminated.
    make: *** [anova.o] Error 1
    ERROR: compilation failed for package ‘rpart’
    * removing ‘/usr/lib/R/library/rpart’
    * restoring previous ‘/usr/lib/R/library/rpart’
    * installing *source* package ‘spatial’ ...
    ** package ‘spatial’ successfully unpacked and MD5 sums checked
    ** libs
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -O3 -pipe  -g  -c init.c -o init.o
    In file included from init.c:18:0:
    /usr/share/R/include/R.h:28:20: fatal error: stdlib.h: No such file or directory
     #include <stdlib.h>
                        ^
    compilation terminated.
    make: *** [init.o] Error 1
    ERROR: compilation failed for package ‘spatial’
    * removing ‘/usr/lib/R/library/spatial’
    * restoring previous ‘/usr/lib/R/library/spatial’
    * installing *source* package ‘class’ ...
    ** package ‘class’ successfully unpacked and MD5 sums checked
    ** libs
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG      -fpic  -O3 -pipe  -g  -c class.c -o class.o
    In file included from class.c:19:0:
    /usr/share/R/include/R.h:28:20: fatal error: stdlib.h: No such file or directory
     #include <stdlib.h>
                        ^
    compilation terminated.
    make: *** [class.o] Error 1
    ERROR: compilation failed for package ‘class’
    * removing ‘/usr/lib/R/library/class’
    * restoring previous ‘/usr/lib/R/library/class’
    * installing *source* package ‘Matrix’ ...
    ** package ‘Matrix’ successfully unpacked and MD5 sums checked
    ** libs
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -DNTIMER -I./SuiteSparse_config     -fpic  -O3 -pipe  -g  -c CHMfactor.c -o CHMfactor.o
    In file included from Mutils.h:10:0,
                     from CHMfactor.h:4,
                     from CHMfactor.c:2:
    /usr/lib/gcc/x86_64-linux-gnu/4.8/include/stdint.h:9:26: fatal error: stdint.h: No such file or directory
     # include_next <stdint.h>
                              ^
    compilation terminated.
    make: *** [CHMfactor.o] Error 1
    ERROR: compilation failed for package ‘Matrix’
    * removing ‘/usr/lib/R/library/Matrix’
    * restoring previous ‘/usr/lib/R/library/Matrix’
    * installing *source* package ‘nlme’ ...
    ** package ‘nlme’ successfully unpacked and MD5 sums checked
    ** libs
    gfortran   -fpic  -O3 -pipe  -g  -c chol.f -o chol.o
    /bin/bash: gfortran: command not found
    make: *** [chol.o] Error 127
    ERROR: compilation failed for package ‘nlme’
    * removing ‘/usr/lib/R/library/nlme’
    * restoring previous ‘/usr/lib/R/library/nlme’
    * installing *source* package ‘mgcv’ ...
    ** package ‘mgcv’ successfully unpacked and MD5 sums checked
    ** libs
    gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG     -fopenmp -fpic  -O3 -pipe  -g  -c coxph.c -o coxph.o
    coxph.c:13:20: fatal error: stdlib.h: No such file or directory
     #include <stdlib.h>
                        ^
    compilation terminated.
    make: *** [coxph.o] Error 1
    ERROR: compilation failed for package ‘mgcv’
    * removing ‘/usr/lib/R/library/mgcv’
    * restoring previous ‘/usr/lib/R/library/mgcv’
    
    The downloaded source packages are in
        ‘/tmp/RtmpDSnlDj/downloaded_packages’
    Updating HTML index of packages in '.Library'
    Making 'packages.html' ... done
    There were 17 warnings (use warnings() to see them)
    

    Why does it fail? I haven't done anything special, I just want to install a package =(

    The first error that I see says that he cannot find stdlib.h - why should he be unable to find this library?

  • user3182532
    user3182532 almost 10 years
    i have installed g++ which has solved the problem. Then I got an error complaining about gfortran missing. So I did install that also. Now he says that he cannot find xml2-config. I don't understand this, why doesn't he just download and install what he needs, if I give him sudo rights ... ?
  • nico
    nico almost 10 years
    R is not supposed to be run as root, and just expects you have the appropriate compiling tools installed in your system. Many people would definitely not like R trying to install stuff on their system other than its own packages. In any case I strongly suggest you avoid running software as root, as it may pose security problems. Also, you may have issues with packages being installed in the /root folder rather than in your home folder (not sure if that is the case).